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

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: Fix includes 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
« no previous file with comments | « chrome/browser/sync/test/integration/sync_test.h ('k') | chrome/test/base/testing_profile.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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" 87 #include "net/url_request/url_request_context.h"
Nicolas Zea 2016/03/02 22:33:18 remove the request context and context getter head
mmenke 2016/03/02 22:37:09 Done, thanks!
89 #include "net/url_request/url_request_context_getter.h" 88 #include "net/url_request/url_request_context_getter.h"
90 #include "sync/engine/sync_scheduler_impl.h" 89 #include "sync/engine/sync_scheduler_impl.h"
91 #include "sync/protocol/sync.pb.h" 90 #include "sync/protocol/sync.pb.h"
92 #include "sync/test/fake_server/fake_server.h" 91 #include "sync/test/fake_server/fake_server.h"
93 #include "sync/test/fake_server/fake_server_network_resources.h" 92 #include "sync/test/fake_server/fake_server_network_resources.h"
94 #include "url/gurl.h" 93 #include "url/gurl.h"
95 94
96 #if defined(OS_CHROMEOS) 95 #if defined(OS_CHROMEOS)
97 #include "chromeos/chromeos_switches.h" 96 #include "chromeos/chromeos_switches.h"
98 #endif 97 #endif
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 explicit EncryptionChecker(ProfileSyncService* service) 168 explicit EncryptionChecker(ProfileSyncService* service)
170 : SingleClientStatusChangeChecker(service) {} 169 : SingleClientStatusChangeChecker(service) {}
171 170
172 bool IsExitConditionSatisfied() override { 171 bool IsExitConditionSatisfied() override {
173 return IsEncryptionComplete(service()); 172 return IsEncryptionComplete(service());
174 } 173 }
175 174
176 std::string GetDebugMessage() const override { return "Encryption"; } 175 std::string GetDebugMessage() const override { return "Encryption"; }
177 }; 176 };
178 177
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( 178 scoped_ptr<KeyedService> BuildFakeServerProfileInvalidationProvider(
188 content::BrowserContext* context) { 179 content::BrowserContext* context) {
189 return make_scoped_ptr(new invalidation::ProfileInvalidationProvider( 180 return make_scoped_ptr(new invalidation::ProfileInvalidationProvider(
190 scoped_ptr<invalidation::InvalidationService>( 181 scoped_ptr<invalidation::InvalidationService>(
191 new fake_server::FakeServerInvalidationService))); 182 new fake_server::FakeServerInvalidationService)));
192 } 183 }
193 184
194 scoped_ptr<KeyedService> BuildP2PProfileInvalidationProvider( 185 scoped_ptr<KeyedService> BuildP2PProfileInvalidationProvider(
195 content::BrowserContext* context, 186 content::BrowserContext* context,
196 syncer::P2PNotificationTarget notification_target) { 187 syncer::P2PNotificationTarget notification_target) {
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 511
521 EXPECT_FALSE(GetBrowser(index) == NULL) << "Could not create Browser " 512 EXPECT_FALSE(GetBrowser(index) == NULL) << "Could not create Browser "
522 << index << "."; 513 << index << ".";
523 514
524 // Make sure the ProfileSyncService has been created before creating the 515 // Make sure the ProfileSyncService has been created before creating the
525 // ProfileSyncServiceHarness - some tests expect the ProfileSyncService to 516 // ProfileSyncServiceHarness - some tests expect the ProfileSyncService to
526 // already exist. 517 // already exist.
527 ProfileSyncService* profile_sync_service = 518 ProfileSyncService* profile_sync_service =
528 ProfileSyncServiceFactory::GetForProfile(GetProfile(index)); 519 ProfileSyncServiceFactory::GetForProfile(GetProfile(index));
529 520
530 SetupNetwork(GetProfile(index)->GetRequestContext());
531
532 if (server_type_ == IN_PROCESS_FAKE_SERVER) { 521 if (server_type_ == IN_PROCESS_FAKE_SERVER) {
533 // TODO(pvalenzuela): Run the fake server via EmbeddedTestServer. 522 // TODO(pvalenzuela): Run the fake server via EmbeddedTestServer.
534 profile_sync_service->OverrideNetworkResourcesForTest( 523 profile_sync_service->OverrideNetworkResourcesForTest(
535 make_scoped_ptr<syncer::NetworkResources>( 524 make_scoped_ptr<syncer::NetworkResources>(
536 new fake_server::FakeServerNetworkResources( 525 new fake_server::FakeServerNetworkResources(
537 fake_server_->AsWeakPtr()))); 526 fake_server_->AsWeakPtr())));
538 } 527 }
539 528
540 ProfileSyncServiceHarness::SigninType singin_type = UsingExternalServers() 529 ProfileSyncServiceHarness::SigninType singin_type = UsingExternalServers()
541 ? ProfileSyncServiceHarness::SigninType::UI_SIGNIN 530 ? ProfileSyncServiceHarness::SigninType::UI_SIGNIN
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after
1109 void SyncTest::TriggerCreateSyncedBookmarks() { 1098 void SyncTest::TriggerCreateSyncedBookmarks() {
1110 ASSERT_TRUE(ServerSupportsErrorTriggering()); 1099 ASSERT_TRUE(ServerSupportsErrorTriggering());
1111 std::string path = "chromiumsync/createsyncedbookmarks"; 1100 std::string path = "chromiumsync/createsyncedbookmarks";
1112 ui_test_utils::NavigateToURL(browser(), sync_server_.GetURL(path)); 1101 ui_test_utils::NavigateToURL(browser(), sync_server_.GetURL(path));
1113 ASSERT_EQ("Synced Bookmarks", 1102 ASSERT_EQ("Synced Bookmarks",
1114 base::UTF16ToASCII( 1103 base::UTF16ToASCII(
1115 browser()->tab_strip_model()->GetActiveWebContents()-> 1104 browser()->tab_strip_model()->GetActiveWebContents()->
1116 GetTitle())); 1105 GetTitle()));
1117 } 1106 }
1118 1107
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 { 1108 fake_server::FakeServer* SyncTest::GetFakeServer() const {
1129 return fake_server_.get(); 1109 return fake_server_.get();
1130 } 1110 }
1131 1111
1132 void SyncTest::TriggerSyncForModelTypes(int index, 1112 void SyncTest::TriggerSyncForModelTypes(int index,
1133 syncer::ModelTypeSet model_types) { 1113 syncer::ModelTypeSet model_types) {
1134 GetSyncService(index)->TriggerRefresh(model_types); 1114 GetSyncService(index)->TriggerRefresh(model_types);
1135 } 1115 }
1136 1116
1137 void SyncTest::SetPreexistingPreferencesFileContents( 1117 void SyncTest::SetPreexistingPreferencesFileContents(
1138 const std::string& contents) { 1118 const std::string& contents) {
1139 preexisting_preferences_file_contents_ = contents; 1119 preexisting_preferences_file_contents_ = contents;
1140 } 1120 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/test/integration/sync_test.h ('k') | chrome/test/base/testing_profile.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698