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

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

Issue 408003002: [Sync] Fix namespace for sync_driver component (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 5 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
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/profile_sync_service.h" 5 #include "chrome/browser/sync/profile_sync_service.h"
6 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h" 6 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h"
7 #include "chrome/browser/sync/test/integration/sync_test.h" 7 #include "chrome/browser/sync/test/integration/sync_test.h"
8 #include "sync/internal_api/public/base/model_type.h" 8 #include "sync/internal_api/public/base/model_type.h"
9 #include "sync/internal_api/public/read_node.h" 9 #include "sync/internal_api/public/read_node.h"
10 #include "sync/internal_api/public/read_transaction.h" 10 #include "sync/internal_api/public/read_transaction.h"
(...skipping 14 matching lines...) Expand all
25 DISALLOW_COPY_AND_ASSIGN(EnableDisableSingleClientTest); 25 DISALLOW_COPY_AND_ASSIGN(EnableDisableSingleClientTest);
26 }; 26 };
27 27
28 bool DoesTopLevelNodeExist(syncer::UserShare* user_share, 28 bool DoesTopLevelNodeExist(syncer::UserShare* user_share,
29 syncer::ModelType type) { 29 syncer::ModelType type) {
30 syncer::ReadTransaction trans(FROM_HERE, user_share); 30 syncer::ReadTransaction trans(FROM_HERE, user_share);
31 syncer::ReadNode node(&trans); 31 syncer::ReadNode node(&trans);
32 return node.InitTypeRoot(type) == syncer::BaseNode::INIT_OK; 32 return node.InitTypeRoot(type) == syncer::BaseNode::INIT_OK;
33 } 33 }
34 34
35 bool IsUnready(const browser_sync::FailedDataTypesHandler& failed_handler, 35 bool IsUnready(const sync_driver::FailedDataTypesHandler& failed_handler,
36 syncer::ModelType type) { 36 syncer::ModelType type) {
37 return failed_handler.GetUnreadyErrorTypes().Has(type); 37 return failed_handler.GetUnreadyErrorTypes().Has(type);
38 } 38 }
39 39
40 IN_PROC_BROWSER_TEST_F(EnableDisableSingleClientTest, EnableOneAtATime) { 40 IN_PROC_BROWSER_TEST_F(EnableDisableSingleClientTest, EnableOneAtATime) {
41 ASSERT_TRUE(SetupClients()); 41 ASSERT_TRUE(SetupClients());
42 42
43 // Setup sync with no enabled types. 43 // Setup sync with no enabled types.
44 ASSERT_TRUE(GetClient(0)->SetupSync(syncer::ModelTypeSet())); 44 ASSERT_TRUE(GetClient(0)->SetupSync(syncer::ModelTypeSet()));
45 45
46 const syncer::ModelTypeSet registered_types = 46 const syncer::ModelTypeSet registered_types =
47 GetSyncService(0)->GetRegisteredDataTypes(); 47 GetSyncService(0)->GetRegisteredDataTypes();
48 syncer::UserShare* user_share = GetSyncService(0)->GetUserShare(); 48 syncer::UserShare* user_share = GetSyncService(0)->GetUserShare();
49 const browser_sync::FailedDataTypesHandler& failed_handler = 49 const sync_driver::FailedDataTypesHandler& failed_handler =
50 GetSyncService(0)->failed_data_types_handler(); 50 GetSyncService(0)->failed_data_types_handler();
51 for (syncer::ModelTypeSet::Iterator it = registered_types.First(); 51 for (syncer::ModelTypeSet::Iterator it = registered_types.First();
52 it.Good(); it.Inc()) { 52 it.Good(); it.Inc()) {
53 ASSERT_TRUE(GetClient(0)->EnableSyncForDatatype(it.Get())); 53 ASSERT_TRUE(GetClient(0)->EnableSyncForDatatype(it.Get()));
54 54
55 // AUTOFILL_PROFILE is lumped together with AUTOFILL. 55 // AUTOFILL_PROFILE is lumped together with AUTOFILL.
56 // SESSIONS is lumped together with PROXY_TABS and 56 // SESSIONS is lumped together with PROXY_TABS and
57 // HISTORY_DELETE_DIRECTIVES. 57 // HISTORY_DELETE_DIRECTIVES.
58 // Favicons are lumped together with PROXY_TABS and 58 // Favicons are lumped together with PROXY_TABS and
59 // HISTORY_DELETE_DIRECTIVES. 59 // HISTORY_DELETE_DIRECTIVES.
(...skipping 23 matching lines...) Expand all
83 ASSERT_TRUE(SetupClients()); 83 ASSERT_TRUE(SetupClients());
84 84
85 // Setup sync with no disabled types. 85 // Setup sync with no disabled types.
86 ASSERT_TRUE(GetClient(0)->SetupSync()); 86 ASSERT_TRUE(GetClient(0)->SetupSync());
87 87
88 const syncer::ModelTypeSet registered_types = 88 const syncer::ModelTypeSet registered_types =
89 GetSyncService(0)->GetRegisteredDataTypes(); 89 GetSyncService(0)->GetRegisteredDataTypes();
90 90
91 syncer::UserShare* user_share = GetSyncService(0)->GetUserShare(); 91 syncer::UserShare* user_share = GetSyncService(0)->GetUserShare();
92 92
93 const browser_sync::FailedDataTypesHandler& failed_handler = 93 const sync_driver::FailedDataTypesHandler& failed_handler =
94 GetSyncService(0)->failed_data_types_handler(); 94 GetSyncService(0)->failed_data_types_handler();
95 95
96 // Make sure all top-level nodes exist first. 96 // Make sure all top-level nodes exist first.
97 for (syncer::ModelTypeSet::Iterator it = registered_types.First(); 97 for (syncer::ModelTypeSet::Iterator it = registered_types.First();
98 it.Good(); it.Inc()) { 98 it.Good(); it.Inc()) {
99 if (!syncer::ProxyTypes().Has(it.Get())) { 99 if (!syncer::ProxyTypes().Has(it.Get())) {
100 ASSERT_TRUE(DoesTopLevelNodeExist(user_share, it.Get()) || 100 ASSERT_TRUE(DoesTopLevelNodeExist(user_share, it.Get()) ||
101 IsUnready(failed_handler, it.Get())); 101 IsUnready(failed_handler, it.Get()));
102 } 102 }
103 } 103 }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 ASSERT_EQ(GetClient(0)->IsTypePreferred(syncer::TYPED_URLS), 148 ASSERT_EQ(GetClient(0)->IsTypePreferred(syncer::TYPED_URLS),
149 DoesTopLevelNodeExist(user_share, syncer::SESSIONS)); 149 DoesTopLevelNodeExist(user_share, syncer::SESSIONS));
150 } else if (it.Get() == syncer::PREFERENCES) { 150 } else if (it.Get() == syncer::PREFERENCES) {
151 ASSERT_FALSE(DoesTopLevelNodeExist(user_share, 151 ASSERT_FALSE(DoesTopLevelNodeExist(user_share,
152 syncer::PRIORITY_PREFERENCES)); 152 syncer::PRIORITY_PREFERENCES));
153 } 153 }
154 } 154 }
155 } 155 }
156 156
157 } // namespace 157 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/sync/sessions/session_data_type_controller_unittest.cc ('k') | chrome/browser/sync/test_profile_sync_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698