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

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

Issue 513543004: [Sync] Rename FailedDataTypesHandler -> DataTypeStatusTable (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Created 6 years, 3 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/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 sync_driver::FailedDataTypesHandler& failed_handler, 35 bool IsUnready(const sync_driver::DataTypeStatusTable& data_type_status_table,
36 syncer::ModelType type) { 36 syncer::ModelType type) {
37 return failed_handler.GetUnreadyErrorTypes().Has(type); 37 return data_type_status_table.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 sync_driver::FailedDataTypesHandler& failed_handler = 49 const sync_driver::DataTypeStatusTable& data_type_status_table =
50 GetSyncService(0)->failed_data_types_handler(); 50 GetSyncService(0)->data_type_status_table();
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.
60 if (it.Get() == syncer::AUTOFILL_PROFILE || it.Get() == syncer::SESSIONS) { 60 if (it.Get() == syncer::AUTOFILL_PROFILE || it.Get() == syncer::SESSIONS) {
61 continue; 61 continue;
62 } 62 }
63 63
64 if (!syncer::ProxyTypes().Has(it.Get())) { 64 if (!syncer::ProxyTypes().Has(it.Get())) {
65 ASSERT_TRUE(DoesTopLevelNodeExist(user_share, it.Get()) || 65 ASSERT_TRUE(DoesTopLevelNodeExist(user_share, it.Get()) ||
66 IsUnready(failed_handler, it.Get())) 66 IsUnready(data_type_status_table, it.Get()))
67 << syncer::ModelTypeToString(it.Get()); 67 << syncer::ModelTypeToString(it.Get());
68 } 68 }
69 69
70 // AUTOFILL_PROFILE is lumped together with AUTOFILL. 70 // AUTOFILL_PROFILE is lumped together with AUTOFILL.
71 if (it.Get() == syncer::AUTOFILL) { 71 if (it.Get() == syncer::AUTOFILL) {
72 ASSERT_TRUE(DoesTopLevelNodeExist(user_share, 72 ASSERT_TRUE(DoesTopLevelNodeExist(user_share,
73 syncer::AUTOFILL_PROFILE)); 73 syncer::AUTOFILL_PROFILE));
74 } else if (it.Get() == syncer::HISTORY_DELETE_DIRECTIVES || 74 } else if (it.Get() == syncer::HISTORY_DELETE_DIRECTIVES ||
75 it.Get() == syncer::PROXY_TABS) { 75 it.Get() == syncer::PROXY_TABS) {
76 ASSERT_TRUE(DoesTopLevelNodeExist(user_share, 76 ASSERT_TRUE(DoesTopLevelNodeExist(user_share,
77 syncer::SESSIONS)); 77 syncer::SESSIONS));
78 } 78 }
79 } 79 }
80 } 80 }
81 81
82 IN_PROC_BROWSER_TEST_F(EnableDisableSingleClientTest, DisableOneAtATime) { 82 IN_PROC_BROWSER_TEST_F(EnableDisableSingleClientTest, DisableOneAtATime) {
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 sync_driver::FailedDataTypesHandler& failed_handler = 93 const sync_driver::DataTypeStatusTable& data_type_status_table =
94 GetSyncService(0)->failed_data_types_handler(); 94 GetSyncService(0)->data_type_status_table();
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(data_type_status_table, it.Get()));
102 } 102 }
103 } 103 }
104 104
105 for (syncer::ModelTypeSet::Iterator it = registered_types.First(); 105 for (syncer::ModelTypeSet::Iterator it = registered_types.First();
106 it.Good(); it.Inc()) { 106 it.Good(); it.Inc()) {
107 // SUPERVISED_USERS and SUPERVISED_USER_SHARED_SETTINGS are always synced. 107 // SUPERVISED_USERS and SUPERVISED_USER_SHARED_SETTINGS are always synced.
108 if (it.Get() == syncer::SUPERVISED_USERS || 108 if (it.Get() == syncer::SUPERVISED_USERS ||
109 it.Get() == syncer::SUPERVISED_USER_SHARED_SETTINGS || 109 it.Get() == syncer::SUPERVISED_USER_SHARED_SETTINGS ||
110 it.Get() == syncer::SYNCED_NOTIFICATIONS || 110 it.Get() == syncer::SYNCED_NOTIFICATIONS ||
111 it.Get() == syncer::SYNCED_NOTIFICATION_APP_INFO) 111 it.Get() == syncer::SYNCED_NOTIFICATION_APP_INFO)
(...skipping 36 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/profile_sync_service_typed_url_unittest.cc ('k') | components/sync_driver.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698