Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(132)

Side by Side Diff: chrome/browser/sync/test/integration/sync_test.cc

Issue 1701063002: CookieStore: Remove reference counting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@threadsafe
Patch Set: More IWYU fixes Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/sync/test/integration/sync_test.h" 5 #include "chrome/browser/sync/test/integration/sync_test.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <limits> 10 #include <limits>
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 #include "components/sync_driver/sync_driver_switches.h" 74 #include "components/sync_driver/sync_driver_switches.h"
75 #include "content/public/browser/navigation_entry.h" 75 #include "content/public/browser/navigation_entry.h"
76 #include "content/public/browser/notification_service.h" 76 #include "content/public/browser/notification_service.h"
77 #include "content/public/browser/web_contents.h" 77 #include "content/public/browser/web_contents.h"
78 #include "content/public/test/test_browser_thread.h" 78 #include "content/public/test/test_browser_thread.h"
79 #include "google_apis/gaia/gaia_urls.h" 79 #include "google_apis/gaia/gaia_urls.h"
80 #include "net/base/escape.h" 80 #include "net/base/escape.h"
81 #include "net/base/load_flags.h" 81 #include "net/base/load_flags.h"
82 #include "net/base/network_change_notifier.h" 82 #include "net/base/network_change_notifier.h"
83 #include "net/base/port_util.h" 83 #include "net/base/port_util.h"
84 #include "net/cookies/cookie_monster.h"
85 #include "net/url_request/test_url_fetcher_factory.h" 84 #include "net/url_request/test_url_fetcher_factory.h"
86 #include "net/url_request/url_fetcher.h" 85 #include "net/url_request/url_fetcher.h"
87 #include "net/url_request/url_fetcher_delegate.h" 86 #include "net/url_request/url_fetcher_delegate.h"
88 #include "net/url_request/url_request_context.h"
89 #include "net/url_request/url_request_context_getter.h"
90 #include "sync/engine/sync_scheduler_impl.h" 87 #include "sync/engine/sync_scheduler_impl.h"
91 #include "sync/protocol/sync.pb.h" 88 #include "sync/protocol/sync.pb.h"
92 #include "sync/test/fake_server/fake_server.h" 89 #include "sync/test/fake_server/fake_server.h"
93 #include "sync/test/fake_server/fake_server_network_resources.h" 90 #include "sync/test/fake_server/fake_server_network_resources.h"
94 #include "url/gurl.h" 91 #include "url/gurl.h"
95 92
96 #if defined(OS_CHROMEOS) 93 #if defined(OS_CHROMEOS)
97 #include "chromeos/chromeos_switches.h" 94 #include "chromeos/chromeos_switches.h"
98 #endif 95 #endif
99 96
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 explicit EncryptionChecker(ProfileSyncService* service) 166 explicit EncryptionChecker(ProfileSyncService* service)
170 : SingleClientStatusChangeChecker(service) {} 167 : SingleClientStatusChangeChecker(service) {}
171 168
172 bool IsExitConditionSatisfied() override { 169 bool IsExitConditionSatisfied() override {
173 return IsEncryptionComplete(service()); 170 return IsEncryptionComplete(service());
174 } 171 }
175 172
176 std::string GetDebugMessage() const override { return "Encryption"; } 173 std::string GetDebugMessage() const override { return "Encryption"; }
177 }; 174 };
178 175
179 void SetupNetworkCallback(
180 base::WaitableEvent* done,
181 net::URLRequestContextGetter* url_request_context_getter) {
182 url_request_context_getter->GetURLRequestContext()->
183 set_cookie_store(new net::CookieMonster(NULL, NULL));
184 done->Signal();
185 }
186
187 scoped_ptr<KeyedService> BuildFakeServerProfileInvalidationProvider( 176 scoped_ptr<KeyedService> BuildFakeServerProfileInvalidationProvider(
188 content::BrowserContext* context) { 177 content::BrowserContext* context) {
189 return make_scoped_ptr(new invalidation::ProfileInvalidationProvider( 178 return make_scoped_ptr(new invalidation::ProfileInvalidationProvider(
190 scoped_ptr<invalidation::InvalidationService>( 179 scoped_ptr<invalidation::InvalidationService>(
191 new fake_server::FakeServerInvalidationService))); 180 new fake_server::FakeServerInvalidationService)));
192 } 181 }
193 182
194 scoped_ptr<KeyedService> BuildP2PProfileInvalidationProvider( 183 scoped_ptr<KeyedService> BuildP2PProfileInvalidationProvider(
195 content::BrowserContext* context, 184 content::BrowserContext* context,
196 syncer::P2PNotificationTarget notification_target) { 185 syncer::P2PNotificationTarget notification_target) {
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 509
521 EXPECT_FALSE(GetBrowser(index) == NULL) << "Could not create Browser " 510 EXPECT_FALSE(GetBrowser(index) == NULL) << "Could not create Browser "
522 << index << "."; 511 << index << ".";
523 512
524 // Make sure the ProfileSyncService has been created before creating the 513 // Make sure the ProfileSyncService has been created before creating the
525 // ProfileSyncServiceHarness - some tests expect the ProfileSyncService to 514 // ProfileSyncServiceHarness - some tests expect the ProfileSyncService to
526 // already exist. 515 // already exist.
527 ProfileSyncService* profile_sync_service = 516 ProfileSyncService* profile_sync_service =
528 ProfileSyncServiceFactory::GetForProfile(GetProfile(index)); 517 ProfileSyncServiceFactory::GetForProfile(GetProfile(index));
529 518
530 SetupNetwork(GetProfile(index)->GetRequestContext());
531
532 if (server_type_ == IN_PROCESS_FAKE_SERVER) { 519 if (server_type_ == IN_PROCESS_FAKE_SERVER) {
533 // TODO(pvalenzuela): Run the fake server via EmbeddedTestServer. 520 // TODO(pvalenzuela): Run the fake server via EmbeddedTestServer.
534 profile_sync_service->OverrideNetworkResourcesForTest( 521 profile_sync_service->OverrideNetworkResourcesForTest(
535 make_scoped_ptr<syncer::NetworkResources>( 522 make_scoped_ptr<syncer::NetworkResources>(
536 new fake_server::FakeServerNetworkResources( 523 new fake_server::FakeServerNetworkResources(
537 fake_server_->AsWeakPtr()))); 524 fake_server_->AsWeakPtr())));
538 } 525 }
539 526
540 ProfileSyncServiceHarness::SigninType singin_type = UsingExternalServers() 527 ProfileSyncServiceHarness::SigninType singin_type = UsingExternalServers()
541 ? ProfileSyncServiceHarness::SigninType::UI_SIGNIN 528 ? ProfileSyncServiceHarness::SigninType::UI_SIGNIN
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after
1109 void SyncTest::TriggerCreateSyncedBookmarks() { 1096 void SyncTest::TriggerCreateSyncedBookmarks() {
1110 ASSERT_TRUE(ServerSupportsErrorTriggering()); 1097 ASSERT_TRUE(ServerSupportsErrorTriggering());
1111 std::string path = "chromiumsync/createsyncedbookmarks"; 1098 std::string path = "chromiumsync/createsyncedbookmarks";
1112 ui_test_utils::NavigateToURL(browser(), sync_server_.GetURL(path)); 1099 ui_test_utils::NavigateToURL(browser(), sync_server_.GetURL(path));
1113 ASSERT_EQ("Synced Bookmarks", 1100 ASSERT_EQ("Synced Bookmarks",
1114 base::UTF16ToASCII( 1101 base::UTF16ToASCII(
1115 browser()->tab_strip_model()->GetActiveWebContents()-> 1102 browser()->tab_strip_model()->GetActiveWebContents()->
1116 GetTitle())); 1103 GetTitle()));
1117 } 1104 }
1118 1105
1119 void SyncTest::SetupNetwork(net::URLRequestContextGetter* context_getter) {
1120 base::WaitableEvent done(false, false);
1121 BrowserThread::PostTask(
1122 BrowserThread::IO, FROM_HERE,
1123 base::Bind(&SetupNetworkCallback, &done,
1124 make_scoped_refptr(context_getter)));
1125 done.Wait();
1126 }
1127
1128 fake_server::FakeServer* SyncTest::GetFakeServer() const { 1106 fake_server::FakeServer* SyncTest::GetFakeServer() const {
1129 return fake_server_.get(); 1107 return fake_server_.get();
1130 } 1108 }
1131 1109
1132 void SyncTest::TriggerSyncForModelTypes(int index, 1110 void SyncTest::TriggerSyncForModelTypes(int index,
1133 syncer::ModelTypeSet model_types) { 1111 syncer::ModelTypeSet model_types) {
1134 GetSyncService(index)->TriggerRefresh(model_types); 1112 GetSyncService(index)->TriggerRefresh(model_types);
1135 } 1113 }
1136 1114
1137 void SyncTest::SetPreexistingPreferencesFileContents( 1115 void SyncTest::SetPreexistingPreferencesFileContents(
1138 const std::string& contents) { 1116 const std::string& contents) {
1139 preexisting_preferences_file_contents_ = contents; 1117 preexisting_preferences_file_contents_ = contents;
1140 } 1118 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698