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

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

Issue 2388673002: Revert of [Sync] Move //components/sync to the syncer namespace. (patchset #5 id:40001 of https://co (Closed)
Patch Set: Created 4 years, 2 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 "base/macros.h" 5 #include "base/macros.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 "components/browser_sync/profile_sync_service.h" 8 #include "components/browser_sync/profile_sync_service.h"
9 #include "components/sync/base/model_type.h" 9 #include "components/sync/base/model_type.h"
10 #include "components/sync/core/read_node.h" 10 #include "components/sync/core/read_node.h"
(...skipping 16 matching lines...) Expand all
27 DISALLOW_COPY_AND_ASSIGN(EnableDisableSingleClientTest); 27 DISALLOW_COPY_AND_ASSIGN(EnableDisableSingleClientTest);
28 }; 28 };
29 29
30 bool DoesTopLevelNodeExist(syncer::UserShare* user_share, 30 bool DoesTopLevelNodeExist(syncer::UserShare* user_share,
31 syncer::ModelType type) { 31 syncer::ModelType type) {
32 syncer::ReadTransaction trans(FROM_HERE, user_share); 32 syncer::ReadTransaction trans(FROM_HERE, user_share);
33 syncer::ReadNode node(&trans); 33 syncer::ReadNode node(&trans);
34 return node.InitTypeRoot(type) == syncer::BaseNode::INIT_OK; 34 return node.InitTypeRoot(type) == syncer::BaseNode::INIT_OK;
35 } 35 }
36 36
37 bool IsUnready(const syncer::DataTypeStatusTable& data_type_status_table, 37 bool IsUnready(const sync_driver::DataTypeStatusTable& data_type_status_table,
38 syncer::ModelType type) { 38 syncer::ModelType type) {
39 return data_type_status_table.GetUnreadyErrorTypes().Has(type); 39 return data_type_status_table.GetUnreadyErrorTypes().Has(type);
40 } 40 }
41 41
42 IN_PROC_BROWSER_TEST_F(EnableDisableSingleClientTest, EnableOneAtATime) { 42 IN_PROC_BROWSER_TEST_F(EnableDisableSingleClientTest, EnableOneAtATime) {
43 ASSERT_TRUE(SetupClients()); 43 ASSERT_TRUE(SetupClients());
44 44
45 // Setup sync with no enabled types. 45 // Setup sync with no enabled types.
46 ASSERT_TRUE(GetClient(0)->SetupSync(syncer::ModelTypeSet())); 46 ASSERT_TRUE(GetClient(0)->SetupSync(syncer::ModelTypeSet()));
47 47
48 syncer::UserShare* user_share = GetSyncService(0)->GetUserShare(); 48 syncer::UserShare* user_share = GetSyncService(0)->GetUserShare();
49 const syncer::DataTypeStatusTable& data_type_status_table = 49 const sync_driver::DataTypeStatusTable& data_type_status_table =
50 GetSyncService(0)->data_type_status_table(); 50 GetSyncService(0)->data_type_status_table();
51 51
52 const syncer::ModelTypeSet registered_types = 52 const syncer::ModelTypeSet registered_types =
53 GetSyncService(0)->GetRegisteredDataTypes(); 53 GetSyncService(0)->GetRegisteredDataTypes();
54 const syncer::ModelTypeSet registered_user_types = 54 const syncer::ModelTypeSet registered_user_types =
55 Intersection(registered_types, syncer::UserSelectableTypes()); 55 Intersection(registered_types, syncer::UserSelectableTypes());
56 for (syncer::ModelTypeSet::Iterator it = registered_user_types.First(); 56 for (syncer::ModelTypeSet::Iterator it = registered_user_types.First();
57 it.Good(); it.Inc()) { 57 it.Good(); it.Inc()) {
58 ASSERT_TRUE(GetClient(0)->EnableSyncForDatatype(it.Get())); 58 ASSERT_TRUE(GetClient(0)->EnableSyncForDatatype(it.Get()));
59 59
(...skipping 28 matching lines...) Expand all
88 ASSERT_TRUE(SetupClients()); 88 ASSERT_TRUE(SetupClients());
89 89
90 // Setup sync with no disabled types. 90 // Setup sync with no disabled types.
91 ASSERT_TRUE(GetClient(0)->SetupSync()); 91 ASSERT_TRUE(GetClient(0)->SetupSync());
92 92
93 const syncer::ModelTypeSet registered_types = 93 const syncer::ModelTypeSet registered_types =
94 GetSyncService(0)->GetRegisteredDataTypes(); 94 GetSyncService(0)->GetRegisteredDataTypes();
95 95
96 syncer::UserShare* user_share = GetSyncService(0)->GetUserShare(); 96 syncer::UserShare* user_share = GetSyncService(0)->GetUserShare();
97 97
98 const syncer::DataTypeStatusTable& data_type_status_table = 98 const sync_driver::DataTypeStatusTable& data_type_status_table =
99 GetSyncService(0)->data_type_status_table(); 99 GetSyncService(0)->data_type_status_table();
100 100
101 // Make sure all top-level nodes exist first. 101 // Make sure all top-level nodes exist first.
102 for (syncer::ModelTypeSet::Iterator it = registered_types.First(); 102 for (syncer::ModelTypeSet::Iterator it = registered_types.First();
103 it.Good(); it.Inc()) { 103 it.Good(); it.Inc()) {
104 if (!syncer::ProxyTypes().Has(it.Get())) { 104 if (!syncer::ProxyTypes().Has(it.Get())) {
105 ASSERT_TRUE(DoesTopLevelNodeExist(user_share, it.Get()) || 105 ASSERT_TRUE(DoesTopLevelNodeExist(user_share, it.Get()) ||
106 IsUnready(data_type_status_table, it.Get())); 106 IsUnready(data_type_status_table, it.Get()));
107 } 107 }
108 } 108 }
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 ASSERT_EQ(GetClient(0)->IsTypePreferred(syncer::TYPED_URLS), 157 ASSERT_EQ(GetClient(0)->IsTypePreferred(syncer::TYPED_URLS),
158 DoesTopLevelNodeExist(user_share, syncer::SESSIONS)); 158 DoesTopLevelNodeExist(user_share, syncer::SESSIONS));
159 } else if (it.Get() == syncer::PREFERENCES) { 159 } else if (it.Get() == syncer::PREFERENCES) {
160 ASSERT_FALSE(DoesTopLevelNodeExist(user_share, 160 ASSERT_FALSE(DoesTopLevelNodeExist(user_share,
161 syncer::PRIORITY_PREFERENCES)); 161 syncer::PRIORITY_PREFERENCES));
162 } 162 }
163 } 163 }
164 } 164 }
165 165
166 } // namespace 166 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/sync/sync_ui_util_unittest.cc ('k') | chrome/browser/sync/test/integration/migration_watcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698