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

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

Issue 165393010: Draft: Moving code out of ProfileSyncServiceHarness (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/sync/test/integration/sync_test.h ('k') | chrome/chrome_tests.gypi » ('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 <vector> 7 #include <vector>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 new net::ProxyConfigServiceFixed(proxy_config)); 104 new net::ProxyConfigServiceFixed(proxy_config));
105 done->Signal(); 105 done->Signal();
106 } 106 }
107 107
108 SyncTest::SyncTest(TestType test_type) 108 SyncTest::SyncTest(TestType test_type)
109 : test_type_(test_type), 109 : test_type_(test_type),
110 server_type_(SERVER_TYPE_UNDECIDED), 110 server_type_(SERVER_TYPE_UNDECIDED),
111 num_clients_(-1), 111 num_clients_(-1),
112 use_verifier_(true), 112 use_verifier_(true),
113 notifications_enabled_(true), 113 notifications_enabled_(true),
114 test_server_handle_(base::kNullProcessHandle), 114 test_server_handle_(base::kNullProcessHandle) {
115 number_of_default_sync_items_(0) {
116 sync_datatype_helper::AssociateWithTest(this); 115 sync_datatype_helper::AssociateWithTest(this);
117 switch (test_type_) { 116 switch (test_type_) {
118 case SINGLE_CLIENT: { 117 case SINGLE_CLIENT: {
119 num_clients_ = 1; 118 num_clients_ = 1;
120 break; 119 break;
121 } 120 }
122 case TWO_CLIENT: { 121 case TWO_CLIENT: {
123 num_clients_ = 2; 122 num_clients_ = 2;
124 break; 123 break;
125 } 124 }
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 for (int i = 0; i < num_clients_; ++i) { 359 for (int i = 0; i < num_clients_; ++i) {
361 if (!GetClient(i)->SetupSync()) 360 if (!GetClient(i)->SetupSync())
362 LOG(FATAL) << "SetupSync() failed."; 361 LOG(FATAL) << "SetupSync() failed.";
363 } 362 }
364 363
365 // Because clients may modify sync data as part of startup (for example local 364 // Because clients may modify sync data as part of startup (for example local
366 // session-releated data is rewritten), we need to ensure all startup-based 365 // session-releated data is rewritten), we need to ensure all startup-based
367 // changes have propagated between the clients. 366 // changes have propagated between the clients.
368 AwaitQuiescence(); 367 AwaitQuiescence();
369 368
370 // The number of default entries is the number of entries existing after
371 // sync startup excluding top level folders and other permanent items.
372 // This value must be updated whenever new permanent items are added (although
373 // this should handle new datatype-specific top level folders).
374 number_of_default_sync_items_ = GetClient(0)->GetNumEntries() -
375 GetClient(0)->GetNumDatatypes() - 6;
376 DVLOG(1) << "Setting " << number_of_default_sync_items_ << " as default "
377 << " number of entries.";
378
379 return true; 369 return true;
380 } 370 }
381 371
382 void SyncTest::CleanUpOnMainThread() { 372 void SyncTest::CleanUpOnMainThread() {
383 for (size_t i = 0; i < clients_.size(); ++i) { 373 for (size_t i = 0; i < clients_.size(); ++i) {
384 clients_[i]->service()->DisableForUser(); 374 clients_[i]->service()->DisableForUser();
385 } 375 }
386 376
387 // Some of the pending messages might rely on browser windows still being 377 // Some of the pending messages might rely on browser windows still being
388 // around, so run messages both before and after closing all browsers. 378 // around, so run messages both before and after closing all browsers.
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
861 851
862 void SyncTest::TriggerCreateSyncedBookmarks() { 852 void SyncTest::TriggerCreateSyncedBookmarks() {
863 ASSERT_TRUE(ServerSupportsErrorTriggering()); 853 ASSERT_TRUE(ServerSupportsErrorTriggering());
864 std::string path = "chromiumsync/createsyncedbookmarks"; 854 std::string path = "chromiumsync/createsyncedbookmarks";
865 ui_test_utils::NavigateToURL(browser(), sync_server_.GetURL(path)); 855 ui_test_utils::NavigateToURL(browser(), sync_server_.GetURL(path));
866 ASSERT_EQ("Synced Bookmarks", 856 ASSERT_EQ("Synced Bookmarks",
867 UTF16ToASCII(browser()->tab_strip_model()->GetActiveWebContents()-> 857 UTF16ToASCII(browser()->tab_strip_model()->GetActiveWebContents()->
868 GetTitle())); 858 GetTitle()));
869 } 859 }
870 860
871 int SyncTest::NumberOfDefaultSyncItems() const {
872 return number_of_default_sync_items_;
873 }
874
875 void SyncTest::SetProxyConfig(net::URLRequestContextGetter* context_getter, 861 void SyncTest::SetProxyConfig(net::URLRequestContextGetter* context_getter,
876 const net::ProxyConfig& proxy_config) { 862 const net::ProxyConfig& proxy_config) {
877 base::WaitableEvent done(false, false); 863 base::WaitableEvent done(false, false);
878 BrowserThread::PostTask( 864 BrowserThread::PostTask(
879 BrowserThread::IO, FROM_HERE, 865 BrowserThread::IO, FROM_HERE,
880 base::Bind(&SetProxyConfigCallback, &done, 866 base::Bind(&SetProxyConfigCallback, &done,
881 make_scoped_refptr(context_getter), proxy_config)); 867 make_scoped_refptr(context_getter), proxy_config));
882 done.Wait(); 868 done.Wait();
883 } 869 }
884 870
885 void SyncTest::UseFakeServer() { 871 void SyncTest::UseFakeServer() {
886 DCHECK_EQ(SERVER_TYPE_UNDECIDED, server_type_); 872 DCHECK_EQ(SERVER_TYPE_UNDECIDED, server_type_);
887 server_type_ = IN_PROCESS_FAKE_SERVER; 873 server_type_ = IN_PROCESS_FAKE_SERVER;
888 } 874 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/test/integration/sync_test.h ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698