diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-01-20 13:40:20 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-01-22 12:41:23 +0000 |
commit | 7961cea6d1041e3e454dae6a1da660b453efd238 (patch) | |
tree | c0eeb4a9ff9ba32986289c1653d9608e53ccb444 /chromium/components/suggestions | |
parent | b7034d0803538058e5c9d904ef03cf5eab34f6ef (diff) | |
download | qtwebengine-chromium-7961cea6d1041e3e454dae6a1da660b453efd238.tar.gz |
BASELINE: Update Chromium to 78.0.3904.130
Change-Id: If185e0c0061b3437531c97c9c8c78f239352a68b
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/components/suggestions')
4 files changed, 31 insertions, 36 deletions
diff --git a/chromium/components/suggestions/BUILD.gn b/chromium/components/suggestions/BUILD.gn index fd86688c7bc..fcb9c81c7b7 100644 --- a/chromium/components/suggestions/BUILD.gn +++ b/chromium/components/suggestions/BUILD.gn @@ -27,7 +27,7 @@ static_library("suggestions") { "//url", ] deps = [ - "//components/google/core/browser", + "//components/google/core/common", "//components/keyed_service/core", "//components/pref_registry", "//components/signin/public/identity_manager", diff --git a/chromium/components/suggestions/suggestions_service_impl.cc b/chromium/components/suggestions/suggestions_service_impl.cc index 943b73b30fd..3d1ed823c4c 100644 --- a/chromium/components/suggestions/suggestions_service_impl.cc +++ b/chromium/components/suggestions/suggestions_service_impl.cc @@ -24,7 +24,6 @@ #include "components/signin/public/identity_manager/primary_account_access_token_fetcher.h" #include "components/suggestions/blacklist_store.h" #include "components/suggestions/suggestions_store.h" -#include "components/sync/driver/sync_service.h" #include "components/variations/net/variations_http_headers.h" #include "google_apis/gaia/gaia_constants.h" #include "net/base/escape.h" @@ -115,7 +114,6 @@ SuggestionsServiceImpl::SuggestionsServiceImpl( const base::TickClock* tick_clock) : identity_manager_(identity_manager), sync_service_(sync_service), - sync_service_observer_(this), history_sync_state_(syncer::UploadState::INITIALIZING), url_loader_factory_(url_loader_factory), suggestions_store_(std::move(suggestions_store)), @@ -420,7 +418,7 @@ SuggestionsServiceImpl::CreateSuggestionsRequest( resource_request->url = url; resource_request->method = "GET"; resource_request->load_flags = net::LOAD_DISABLE_CACHE; - resource_request->allow_credentials = false; + resource_request->credentials_mode = network::mojom::CredentialsMode::kOmit; // Add Chrome experiment state to the request headers. // TODO: We should call AppendVariationHeaders with explicit // variations::SignedIn::kNo If the access_token is empty diff --git a/chromium/components/suggestions/suggestions_service_impl.h b/chromium/components/suggestions/suggestions_service_impl.h index 7c93353739d..9b0407ce473 100644 --- a/chromium/components/suggestions/suggestions_service_impl.h +++ b/chromium/components/suggestions/suggestions_service_impl.h @@ -24,6 +24,7 @@ #include "components/signin/public/identity_manager/access_token_info.h" #include "components/suggestions/proto/suggestions.pb.h" #include "components/suggestions/suggestions_service.h" +#include "components/sync/driver/sync_service.h" #include "components/sync/driver/sync_service_observer.h" #include "components/sync/driver/sync_service_utils.h" #include "google_apis/gaia/google_service_auth_error.h" @@ -41,10 +42,6 @@ class SharedURLLoaderFactory; class SimpleURLLoader; } // namespace network -namespace syncer { -class SyncService; -} // namespace syncer - namespace user_prefs { class PrefRegistrySyncable; } // namespace user_prefs @@ -178,7 +175,7 @@ class SuggestionsServiceImpl : public SuggestionsService, syncer::SyncService* sync_service_; ScopedObserver<syncer::SyncService, syncer::SyncServiceObserver> - sync_service_observer_; + sync_service_observer_{this}; // The state of history sync, i.e. are we uploading history data to Google? syncer::UploadState history_sync_state_; diff --git a/chromium/components/suggestions/suggestions_service_impl_unittest.cc b/chromium/components/suggestions/suggestions_service_impl_unittest.cc index 459ee072930..9ac6c86c6fd 100644 --- a/chromium/components/suggestions/suggestions_service_impl_unittest.cc +++ b/chromium/components/suggestions/suggestions_service_impl_unittest.cc @@ -14,7 +14,7 @@ #include "base/macros.h" #include "base/test/mock_callback.h" #include "base/test/scoped_feature_list.h" -#include "base/test/scoped_task_environment.h" +#include "base/test/task_environment.h" #include "components/signin/public/identity_manager/identity_test_environment.h" #include "components/suggestions/blacklist_store.h" #include "components/suggestions/proto/suggestions.pb.h" @@ -134,7 +134,7 @@ class SuggestionsServiceTest : public testing::Test { url_loader_factory()), base::WrapUnique(test_suggestions_store_), base::WrapUnique(mock_blacklist_store_), - scoped_task_environment_.GetMockTickClock()); + task_environment_.GetMockTickClock()); } GURL GetCurrentlyQueriedUrl() { @@ -171,7 +171,7 @@ class SuggestionsServiceTest : public testing::Test { bool rv = url_loader_factory()->SimulateResponseForPendingRequest( url, network::URLLoaderCompletionStatus(net_error), network::CreateResourceResponseHead(response_code), response_body); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); return rv; } @@ -193,8 +193,8 @@ class SuggestionsServiceTest : public testing::Test { return &url_loader_factory_; } - base::test::ScopedTaskEnvironment scoped_task_environment_{ - base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME}; + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::TimeSource::MOCK_TIME}; private: signin::IdentityTestEnvironment identity_test_env_; @@ -224,7 +224,7 @@ TEST_F(SuggestionsServiceTest, FetchSuggestionsData) { EXPECT_CALL(callback, Run(_)); // Wait for the eventual network request. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_TRUE(GetCurrentlyQueriedUrl().is_valid()); EXPECT_EQ(GetCurrentlyQueriedUrl().path(), kSuggestionsUrlPath); ASSERT_TRUE(RespondToFetchWithProfile(CreateSuggestionsProfile())); @@ -247,7 +247,7 @@ TEST_F(SuggestionsServiceTest, IgnoresNoopSyncChange) { ->OnStateChanged(sync_service()); // Wait for eventual (but unexpected) network requests. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(suggestions_service()->HasPendingRequestForTesting()); } @@ -263,7 +263,7 @@ TEST_F(SuggestionsServiceTest, PersistentAuthErrorState) { ->OnStateChanged(sync_service()); // Wait for eventual (but unexpected) network requests. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(suggestions_service()->HasPendingRequestForTesting()); SuggestionsProfile empty_suggestions; @@ -283,7 +283,7 @@ TEST_F(SuggestionsServiceTest, IgnoresUninterestingSyncChange) { ->OnStateChanged(sync_service()); // Wait for eventual (but unexpected) network requests. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(suggestions_service()->HasPendingRequestForTesting()); } @@ -297,7 +297,7 @@ TEST_F(SuggestionsServiceTest, DoesNotFetchOnStartup) { static_cast<SyncServiceObserver*>(suggestions_service()) ->OnStateChanged(sync_service()); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_FALSE(suggestions_service()->HasPendingRequestForTesting()); // Sync getting enabled should not result in a fetch. @@ -307,7 +307,7 @@ TEST_F(SuggestionsServiceTest, DoesNotFetchOnStartup) { ->OnStateChanged(sync_service()); // Wait for eventual (but unexpected) network requests. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(suggestions_service()->HasPendingRequestForTesting()); } @@ -326,7 +326,7 @@ TEST_F(SuggestionsServiceTest, FetchSuggestionsDataSyncNotInitializedEnabled) { suggestions_service()->FetchSuggestionsData(); // Wait for eventual (but unexpected) network requests. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(suggestions_service()->HasPendingRequestForTesting()); // |suggestions_store()| should still contain the default values. @@ -355,7 +355,7 @@ TEST_F(SuggestionsServiceTest, FetchSuggestionsDataSyncDisabled) { suggestions_service()->FetchSuggestionsData(); // Wait for eventual (but unexpected) network requests. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(suggestions_service()->HasPendingRequestForTesting()); } @@ -376,7 +376,7 @@ TEST_F(SuggestionsServiceTest, FetchSuggestionsDataNoAccessToken) { GoogleServiceAuthError::State::INVALID_GAIA_CREDENTIALS)); // Wait for eventual (but unexpected) network requests. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); EXPECT_FALSE(suggestions_service()->HasPendingRequestForTesting()); } @@ -387,7 +387,7 @@ TEST_F(SuggestionsServiceTest, FetchingSuggestionsIgnoresRequestFailure) { suggestions_service()->FetchSuggestionsData(); // Wait for the eventual network request. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_TRUE(RespondToSuggestionsFetch("irrelevant", net::HTTP_OK, net::ERR_INVALID_RESPONSE)); } @@ -403,7 +403,7 @@ TEST_F(SuggestionsServiceTest, FetchingSuggestionsClearsStoreIfResponseNotOK) { suggestions_service()->FetchSuggestionsData(); // Wait for the eventual network request. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_TRUE(RespondToSuggestionsFetch("irrelevant", net::HTTP_BAD_REQUEST)); SuggestionsProfile empty_suggestions; @@ -433,14 +433,14 @@ TEST_F(SuggestionsServiceTest, BlacklistURL) { // Wait on the upload task, the blacklist request and the next blacklist // scheduling task. - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); EXPECT_EQ(GetCurrentlyQueriedUrl().path(), kBlacklistUrlPath); // The blacklist fetch needs to contain a valid profile or the favicon will // not be set. ASSERT_TRUE(RespondToBlacklistFetch( CreateSuggestionsProfile().SerializeAsString(), net::HTTP_OK)); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); SuggestionsProfile suggestions; suggestions_store()->LoadSuggestions(&suggestions); @@ -483,7 +483,7 @@ TEST_F(SuggestionsServiceTest, RetryBlacklistURLRequestAfterFailure) { EXPECT_TRUE(suggestions_service()->BlacklistURL(GURL(kBlacklistedUrl))); // Wait for the first scheduling receiving a failing response. - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); ASSERT_TRUE(GetCurrentlyQueriedUrl().is_valid()); EXPECT_EQ(GetCurrentlyQueriedUrl().path(), kBlacklistUrlPath); ASSERT_TRUE(RespondToBlacklistFetch("irrelevant", net::HTTP_OK, @@ -503,7 +503,7 @@ TEST_F(SuggestionsServiceTest, RetryBlacklistURLRequestAfterFailure) { .WillOnce(Return(true)); // Wait for the second scheduling followed by a successful response. - scoped_task_environment_.FastForwardUntilNoTasksRemain(); + task_environment_.FastForwardUntilNoTasksRemain(); ASSERT_TRUE(suggestions_service()->HasPendingRequestForTesting()); ASSERT_TRUE(GetCurrentlyQueriedUrl().is_valid()); EXPECT_EQ(GetCurrentlyQueriedUrl().path(), kBlacklistUrlPath); @@ -562,7 +562,7 @@ TEST_F(SuggestionsServiceTest, ClearBlacklist) { suggestions_service()->ClearBlacklist(); // Wait for the eventual network request. - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_TRUE(suggestions_service()->HasPendingRequestForTesting()); EXPECT_EQ(GetCurrentlyQueriedUrl().path(), kBlacklistClearUrlPath); } @@ -628,13 +628,13 @@ TEST_F(SuggestionsServiceTest, TemporarilyIncreasesBlacklistDelayOnFailure) { // Delay unchanged on success. suggestions_service()->FetchSuggestionsData(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_TRUE(RespondToFetchWithProfile(CreateSuggestionsProfile())); EXPECT_EQ(initial_delay, suggestions_service()->BlacklistDelayForTesting()); // Delay increases on failure. suggestions_service()->FetchSuggestionsData(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_TRUE(RespondToSuggestionsFetch("irrelevant", net::HTTP_BAD_REQUEST)); base::TimeDelta delay_after_fail = suggestions_service()->BlacklistDelayForTesting(); @@ -643,15 +643,15 @@ TEST_F(SuggestionsServiceTest, TemporarilyIncreasesBlacklistDelayOnFailure) { // Success resets future delays, but the current horizon remains. Since no // time has passed, the actual current delay stays the same. suggestions_service()->FetchSuggestionsData(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_TRUE(RespondToFetchWithProfile(CreateSuggestionsProfile())); EXPECT_EQ(delay_after_fail, suggestions_service()->BlacklistDelayForTesting()); // After the current horizon has passed, we're back at the initial delay. - scoped_task_environment_.FastForwardBy(delay_after_fail); + task_environment_.FastForwardBy(delay_after_fail); suggestions_service()->FetchSuggestionsData(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); ASSERT_TRUE(RespondToFetchWithProfile(CreateSuggestionsProfile())); EXPECT_EQ(initial_delay, suggestions_service()->BlacklistDelayForTesting()); } @@ -663,7 +663,7 @@ TEST_F(SuggestionsServiceTest, DoesNotOverrideDefaultExpiryTime) { suggestions_service()->FetchSuggestionsData(); - scoped_task_environment_.RunUntilIdle(); + task_environment_.RunUntilIdle(); // Creates one suggestion without timestamp and adds a second with timestamp. SuggestionsProfile profile = CreateSuggestionsProfile(); ChromeSuggestion* suggestion = profile.add_suggestions(); |