OLD | NEW |
---|---|
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 22 matching lines...) Expand all Loading... | |
33 bool DoesTopLevelNodeExist(sync_api::UserShare* user_share, | 33 bool DoesTopLevelNodeExist(sync_api::UserShare* user_share, |
34 syncable::ModelType type) { | 34 syncable::ModelType type) { |
35 sync_api::ReadTransaction trans(FROM_HERE, user_share); | 35 sync_api::ReadTransaction trans(FROM_HERE, user_share); |
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(); | |
44 | |
45 // Setup sync with no enabled types. | 43 // Setup sync with no enabled types. |
46 ASSERT_TRUE(GetClient(0)->SetupSync(syncable::ModelTypeSet())); | 44 ASSERT_TRUE(GetClient(0)->SetupSync(syncable::ModelTypeSet())); |
47 | 45 |
46 DisableNotifications(); | |
akalin
2012/01/20 22:41:51
why was this necessary? i.e. why does setting up
rlarocque
2012/01/20 23:04:56
The problem is that SetupSync() doesn't complete u
akalin
2012/01/20 23:07:24
Okay, if this is a temporary change, add a TODO to
| |
47 | |
48 const syncable::ModelTypeSet 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::ModelTypeSet::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(); | |
77 | |
78 // Setup sync with no disabled types. | 76 // Setup sync with no disabled types. |
79 ASSERT_TRUE(GetClient(0)->SetupSync()); | 77 ASSERT_TRUE(GetClient(0)->SetupSync()); |
80 | 78 |
79 DisableNotifications(); | |
akalin
2012/01/20 22:41:51
why was this necessary?
rlarocque
2012/01/20 23:04:56
Same reasoning as above.
akalin
2012/01/20 23:07:24
add todo.
| |
80 | |
81 const syncable::ModelTypeSet 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::ModelTypeSet::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 } |
(...skipping 17 matching lines...) Expand all Loading... | |
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 |
OLD | NEW |