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

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

Issue 11961030: [Sync] Make SESSIONS an implicit type (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleanup Created 7 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
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 "chrome/browser/sync/profile_sync_service_harness.h" 7 #include "chrome/browser/sync/profile_sync_service_harness.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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 DisableNotifications(); 50 DisableNotifications();
51 51
52 const syncer::ModelTypeSet registered_types = 52 const syncer::ModelTypeSet registered_types =
53 GetClient(0)->service()->GetRegisteredDataTypes(); 53 GetClient(0)->service()->GetRegisteredDataTypes();
54 syncer::UserShare* user_share = GetClient(0)->service()->GetUserShare(); 54 syncer::UserShare* user_share = GetClient(0)->service()->GetUserShare();
55 for (syncer::ModelTypeSet::Iterator it = registered_types.First(); 55 for (syncer::ModelTypeSet::Iterator it = registered_types.First();
56 it.Good(); it.Inc()) { 56 it.Good(); it.Inc()) {
57 ASSERT_TRUE(GetClient(0)->EnableSyncForDatatype(it.Get())); 57 ASSERT_TRUE(GetClient(0)->EnableSyncForDatatype(it.Get()));
58 58
59 // AUTOFILL_PROFILE is lumped together with AUTOFILL. 59 // AUTOFILL_PROFILE is lumped together with AUTOFILL.
60 if (it.Get() == syncer::AUTOFILL_PROFILE) { 60 // SESSIONS is lumped together with TABS and HISTORY_DELETE_DIRECTIVES.
61 if (it.Get() == syncer::AUTOFILL_PROFILE || it.Get() == syncer::SESSIONS) {
61 continue; 62 continue;
62 } 63 }
63 64
64 ASSERT_TRUE(DoesTopLevelNodeExist(user_share, it.Get())) 65 if (!syncer::ProxyTypes().Has(it.Get())) {
65 << syncer::ModelTypeToString(it.Get()); 66 ASSERT_TRUE(DoesTopLevelNodeExist(user_share, it.Get()))
67 << syncer::ModelTypeToString(it.Get());
68 }
66 69
67 // AUTOFILL_PROFILE is lumped together with AUTOFILL. 70 // AUTOFILL_PROFILE is lumped together with AUTOFILL.
68 if (it.Get() == syncer::AUTOFILL) { 71 if (it.Get() == syncer::AUTOFILL) {
69 ASSERT_TRUE(DoesTopLevelNodeExist(user_share, 72 ASSERT_TRUE(DoesTopLevelNodeExist(user_share,
70 syncer::AUTOFILL_PROFILE)); 73 syncer::AUTOFILL_PROFILE));
74 } else if (it.Get() == syncer::HISTORY_DELETE_DIRECTIVES ||
75 it.Get() == syncer::TABS) {
76 ASSERT_TRUE(DoesTopLevelNodeExist(user_share,
77 syncer::SESSIONS));
71 } 78 }
72 } 79 }
73 80
74 EnableNotifications(); 81 EnableNotifications();
75 } 82 }
76 83
77 IN_PROC_BROWSER_TEST_F(EnableDisableSingleClientTest, DisableOneAtATime) { 84 IN_PROC_BROWSER_TEST_F(EnableDisableSingleClientTest, DisableOneAtATime) {
78 ASSERT_TRUE(SetupClients()); 85 ASSERT_TRUE(SetupClients());
79 86
80 // Setup sync with no disabled types. 87 // Setup sync with no disabled types.
81 ASSERT_TRUE(GetClient(0)->SetupSync()); 88 ASSERT_TRUE(GetClient(0)->SetupSync());
82 89
83 // TODO(rlarocque, 97780): It should be possible to disable notifications 90 // TODO(rlarocque, 97780): It should be possible to disable notifications
84 // before calling SetupSync(). We should move this line back to the top 91 // before calling SetupSync(). We should move this line back to the top
85 // of this function when this is supported. 92 // of this function when this is supported.
86 DisableNotifications(); 93 DisableNotifications();
87 94
88 const syncer::ModelTypeSet registered_types = 95 const syncer::ModelTypeSet registered_types =
89 GetClient(0)->service()->GetRegisteredDataTypes(); 96 GetClient(0)->service()->GetRegisteredDataTypes();
90 97
91 syncer::UserShare* user_share = GetClient(0)->service()->GetUserShare(); 98 syncer::UserShare* user_share = GetClient(0)->service()->GetUserShare();
92 99
93 // Make sure all top-level nodes exist first. 100 // Make sure all top-level nodes exist first.
94 for (syncer::ModelTypeSet::Iterator it = registered_types.First(); 101 for (syncer::ModelTypeSet::Iterator it = registered_types.First();
95 it.Good(); it.Inc()) { 102 it.Good(); it.Inc()) {
96 ASSERT_TRUE(DoesTopLevelNodeExist(user_share, it.Get())); 103 if (!syncer::ProxyTypes().Has(it.Get())) {
104 ASSERT_TRUE(DoesTopLevelNodeExist(user_share, it.Get()));
105 }
97 } 106 }
98 107
99 for (syncer::ModelTypeSet::Iterator it = registered_types.First(); 108 for (syncer::ModelTypeSet::Iterator it = registered_types.First();
100 it.Good(); it.Inc()) { 109 it.Good(); it.Inc()) {
101 ASSERT_TRUE(GetClient(0)->DisableSyncForDatatype(it.Get())); 110 ASSERT_TRUE(GetClient(0)->DisableSyncForDatatype(it.Get()));
102 111
103 // AUTOFILL_PROFILE is lumped together with AUTOFILL. 112 // AUTOFILL_PROFILE is lumped together with AUTOFILL.
104 if (it.Get() == syncer::AUTOFILL_PROFILE) { 113 // SESSIONS is lumped together with TABS and HISTORY_DELETE_DIRECTIVES.
114 if (it.Get() == syncer::AUTOFILL_PROFILE || it.Get() == syncer::SESSIONS) {
105 continue; 115 continue;
106 } 116 }
107 117
108 syncer::UserShare* user_share = 118 syncer::UserShare* user_share =
109 GetClient(0)->service()->GetUserShare(); 119 GetClient(0)->service()->GetUserShare();
110 120
111 ASSERT_FALSE(DoesTopLevelNodeExist(user_share, it.Get())) 121 ASSERT_FALSE(DoesTopLevelNodeExist(user_share, it.Get()))
112 << syncer::ModelTypeToString(it.Get()); 122 << syncer::ModelTypeToString(it.Get());
113 123
114 // AUTOFILL_PROFILE is lumped together with AUTOFILL. 124 // AUTOFILL_PROFILE is lumped together with AUTOFILL.
115 if (it.Get() == syncer::AUTOFILL) { 125 if (it.Get() == syncer::AUTOFILL) {
116 ASSERT_FALSE(DoesTopLevelNodeExist(user_share, 126 ASSERT_FALSE(DoesTopLevelNodeExist(user_share,
117 syncer::AUTOFILL_PROFILE)); 127 syncer::AUTOFILL_PROFILE));
128 } else if (it.Get() == syncer::HISTORY_DELETE_DIRECTIVES ||
129 it.Get() == syncer::TABS) {
130 ASSERT_FALSE(DoesTopLevelNodeExist(user_share,
131 syncer::SESSIONS));
118 } 132 }
119 } 133 }
120 134
121 EnableNotifications(); 135 EnableNotifications();
122 } 136 }
123 137
124 } // namespace 138 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698