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

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

Issue 8919021: [Sync] Rename ModelEnumSet to ModelTypeSet (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/sync/profile_sync_service_harness.h" 7 #include "chrome/browser/sync/profile_sync_service_harness.h"
8 #include "chrome/browser/sync/internal_api/read_node.h" 8 #include "chrome/browser/sync/internal_api/read_node.h"
9 #include "chrome/browser/sync/internal_api/read_transaction.h" 9 #include "chrome/browser/sync/internal_api/read_transaction.h"
10 #include "chrome/browser/sync/syncable/model_type.h" 10 #include "chrome/browser/sync/syncable/model_type.h"
(...skipping 25 matching lines...) Expand all
36 sync_api::ReadNode node(&trans); 36 sync_api::ReadNode node(&trans);
37 return node.InitByTagLookup(syncable::ModelTypeToRootTag(type)); 37 return node.InitByTagLookup(syncable::ModelTypeToRootTag(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 DisableNotifications(); 43 DisableNotifications();
44 44
45 // Setup sync with no enabled types. 45 // Setup sync with no enabled types.
46 ASSERT_TRUE(GetClient(0)->SetupSync(syncable::ModelEnumSet())); 46 ASSERT_TRUE(GetClient(0)->SetupSync(syncable::ModelTypeSet()));
47 47
48 const syncable::ModelEnumSet registered_types = 48 const syncable::ModelTypeSet registered_types =
49 GetClient(0)->service()->GetRegisteredDataTypes(); 49 GetClient(0)->service()->GetRegisteredDataTypes();
50 sync_api::UserShare* user_share = GetClient(0)->service()->GetUserShare(); 50 sync_api::UserShare* user_share = GetClient(0)->service()->GetUserShare();
51 for (syncable::ModelEnumSet::Iterator it = registered_types.First(); 51 for (syncable::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 if (it.Get() == syncable::AUTOFILL_PROFILE) { 56 if (it.Get() == syncable::AUTOFILL_PROFILE) {
57 continue; 57 continue;
58 } 58 }
59 59
60 ASSERT_TRUE(DoesTopLevelNodeExist(user_share, it.Get())) 60 ASSERT_TRUE(DoesTopLevelNodeExist(user_share, it.Get()))
61 << syncable::ModelTypeToString(it.Get()); 61 << syncable::ModelTypeToString(it.Get());
62 62
63 // AUTOFILL_PROFILE is lumped together with AUTOFILL. 63 // AUTOFILL_PROFILE is lumped together with AUTOFILL.
64 if (it.Get() == syncable::AUTOFILL) { 64 if (it.Get() == syncable::AUTOFILL) {
65 ASSERT_TRUE(DoesTopLevelNodeExist(user_share, 65 ASSERT_TRUE(DoesTopLevelNodeExist(user_share,
66 syncable::AUTOFILL_PROFILE)); 66 syncable::AUTOFILL_PROFILE));
67 } 67 }
68 } 68 }
69 69
70 EnableNotifications(); 70 EnableNotifications();
71 } 71 }
72 72
73 IN_PROC_BROWSER_TEST_F(EnableDisableSingleClientTest, DisableOneAtATime) { 73 IN_PROC_BROWSER_TEST_F(EnableDisableSingleClientTest, DisableOneAtATime) {
74 ASSERT_TRUE(SetupClients()); 74 ASSERT_TRUE(SetupClients());
75 75
76 DisableNotifications(); 76 DisableNotifications();
77 77
78 // Setup sync with no disabled types. 78 // Setup sync with no disabled types.
79 ASSERT_TRUE(GetClient(0)->SetupSync()); 79 ASSERT_TRUE(GetClient(0)->SetupSync());
80 80
81 const syncable::ModelEnumSet registered_types = 81 const syncable::ModelTypeSet registered_types =
82 GetClient(0)->service()->GetRegisteredDataTypes(); 82 GetClient(0)->service()->GetRegisteredDataTypes();
83 83
84 sync_api::UserShare* user_share = GetClient(0)->service()->GetUserShare(); 84 sync_api::UserShare* user_share = GetClient(0)->service()->GetUserShare();
85 85
86 // Make sure all top-level nodes exist first. 86 // Make sure all top-level nodes exist first.
87 for (syncable::ModelEnumSet::Iterator it = registered_types.First(); 87 for (syncable::ModelTypeSet::Iterator it = registered_types.First();
88 it.Good(); it.Inc()) { 88 it.Good(); it.Inc()) {
89 ASSERT_TRUE(DoesTopLevelNodeExist(user_share, it.Get())); 89 ASSERT_TRUE(DoesTopLevelNodeExist(user_share, it.Get()));
90 } 90 }
91 91
92 for (syncable::ModelEnumSet::Iterator it = registered_types.First(); 92 for (syncable::ModelTypeSet::Iterator it = registered_types.First();
93 it.Good(); it.Inc()) { 93 it.Good(); it.Inc()) {
94 ASSERT_TRUE(GetClient(0)->DisableSyncForDatatype(it.Get())); 94 ASSERT_TRUE(GetClient(0)->DisableSyncForDatatype(it.Get()));
95 95
96 // AUTOFILL_PROFILE is lumped together with AUTOFILL. 96 // AUTOFILL_PROFILE is lumped together with AUTOFILL.
97 if (it.Get() == syncable::AUTOFILL_PROFILE) { 97 if (it.Get() == syncable::AUTOFILL_PROFILE) {
98 continue; 98 continue;
99 } 99 }
100 100
101 sync_api::UserShare* user_share = 101 sync_api::UserShare* user_share =
102 GetClient(0)->service()->GetUserShare(); 102 GetClient(0)->service()->GetUserShare();
103 103
104 ASSERT_FALSE(DoesTopLevelNodeExist(user_share, it.Get())) 104 ASSERT_FALSE(DoesTopLevelNodeExist(user_share, it.Get()))
105 << syncable::ModelTypeToString(it.Get()); 105 << syncable::ModelTypeToString(it.Get());
106 106
107 // AUTOFILL_PROFILE is lumped together with AUTOFILL. 107 // AUTOFILL_PROFILE is lumped together with AUTOFILL.
108 if (it.Get() == syncable::AUTOFILL) { 108 if (it.Get() == syncable::AUTOFILL) {
109 ASSERT_FALSE(DoesTopLevelNodeExist(user_share, 109 ASSERT_FALSE(DoesTopLevelNodeExist(user_share,
110 syncable::AUTOFILL_PROFILE)); 110 syncable::AUTOFILL_PROFILE));
111 } 111 }
112 } 112 }
113 113
114 EnableNotifications(); 114 EnableNotifications();
115 } 115 }
116 116
117 } // namespace 117 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698