| OLD | NEW |
| 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 Loading... |
| 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 PROXY_TABS and |
| 61 // HISTORY_DELETE_DIRECTIVES. |
| 62 if (it.Get() == syncer::AUTOFILL_PROFILE || it.Get() == syncer::SESSIONS) { |
| 61 continue; | 63 continue; |
| 62 } | 64 } |
| 63 | 65 |
| 64 ASSERT_TRUE(DoesTopLevelNodeExist(user_share, it.Get())) | 66 if (!syncer::ProxyTypes().Has(it.Get())) { |
| 65 << syncer::ModelTypeToString(it.Get()); | 67 ASSERT_TRUE(DoesTopLevelNodeExist(user_share, it.Get())) |
| 68 << syncer::ModelTypeToString(it.Get()); |
| 69 } |
| 66 | 70 |
| 67 // AUTOFILL_PROFILE is lumped together with AUTOFILL. | 71 // AUTOFILL_PROFILE is lumped together with AUTOFILL. |
| 68 if (it.Get() == syncer::AUTOFILL) { | 72 if (it.Get() == syncer::AUTOFILL) { |
| 69 ASSERT_TRUE(DoesTopLevelNodeExist(user_share, | 73 ASSERT_TRUE(DoesTopLevelNodeExist(user_share, |
| 70 syncer::AUTOFILL_PROFILE)); | 74 syncer::AUTOFILL_PROFILE)); |
| 75 } else if (it.Get() == syncer::HISTORY_DELETE_DIRECTIVES || |
| 76 it.Get() == syncer::PROXY_TABS) { |
| 77 ASSERT_TRUE(DoesTopLevelNodeExist(user_share, |
| 78 syncer::SESSIONS)); |
| 71 } | 79 } |
| 72 } | 80 } |
| 73 | 81 |
| 74 EnableNotifications(); | 82 EnableNotifications(); |
| 75 } | 83 } |
| 76 | 84 |
| 77 IN_PROC_BROWSER_TEST_F(EnableDisableSingleClientTest, DisableOneAtATime) { | 85 IN_PROC_BROWSER_TEST_F(EnableDisableSingleClientTest, DisableOneAtATime) { |
| 78 ASSERT_TRUE(SetupClients()); | 86 ASSERT_TRUE(SetupClients()); |
| 79 | 87 |
| 80 // Setup sync with no disabled types. | 88 // Setup sync with no disabled types. |
| 81 ASSERT_TRUE(GetClient(0)->SetupSync()); | 89 ASSERT_TRUE(GetClient(0)->SetupSync()); |
| 82 | 90 |
| 83 // TODO(rlarocque, 97780): It should be possible to disable notifications | 91 // TODO(rlarocque, 97780): It should be possible to disable notifications |
| 84 // before calling SetupSync(). We should move this line back to the top | 92 // before calling SetupSync(). We should move this line back to the top |
| 85 // of this function when this is supported. | 93 // of this function when this is supported. |
| 86 DisableNotifications(); | 94 DisableNotifications(); |
| 87 | 95 |
| 88 const syncer::ModelTypeSet registered_types = | 96 const syncer::ModelTypeSet registered_types = |
| 89 GetClient(0)->service()->GetRegisteredDataTypes(); | 97 GetClient(0)->service()->GetRegisteredDataTypes(); |
| 90 | 98 |
| 91 syncer::UserShare* user_share = GetClient(0)->service()->GetUserShare(); | 99 syncer::UserShare* user_share = GetClient(0)->service()->GetUserShare(); |
| 92 | 100 |
| 93 // Make sure all top-level nodes exist first. | 101 // Make sure all top-level nodes exist first. |
| 94 for (syncer::ModelTypeSet::Iterator it = registered_types.First(); | 102 for (syncer::ModelTypeSet::Iterator it = registered_types.First(); |
| 95 it.Good(); it.Inc()) { | 103 it.Good(); it.Inc()) { |
| 96 ASSERT_TRUE(DoesTopLevelNodeExist(user_share, it.Get())); | 104 if (!syncer::ProxyTypes().Has(it.Get())) { |
| 105 ASSERT_TRUE(DoesTopLevelNodeExist(user_share, it.Get())); |
| 106 } |
| 97 } | 107 } |
| 98 | 108 |
| 99 for (syncer::ModelTypeSet::Iterator it = registered_types.First(); | 109 for (syncer::ModelTypeSet::Iterator it = registered_types.First(); |
| 100 it.Good(); it.Inc()) { | 110 it.Good(); it.Inc()) { |
| 101 ASSERT_TRUE(GetClient(0)->DisableSyncForDatatype(it.Get())); | 111 ASSERT_TRUE(GetClient(0)->DisableSyncForDatatype(it.Get())); |
| 102 | 112 |
| 103 // AUTOFILL_PROFILE is lumped together with AUTOFILL. | 113 // AUTOFILL_PROFILE is lumped together with AUTOFILL. |
| 104 if (it.Get() == syncer::AUTOFILL_PROFILE) { | 114 // SESSIONS is lumped together with PROXY_TABS and |
| 115 // HISTORY_DELETE_DIRECTIVES. |
| 116 if (it.Get() == syncer::AUTOFILL_PROFILE || it.Get() == syncer::SESSIONS) { |
| 105 continue; | 117 continue; |
| 106 } | 118 } |
| 107 | 119 |
| 108 syncer::UserShare* user_share = | 120 syncer::UserShare* user_share = |
| 109 GetClient(0)->service()->GetUserShare(); | 121 GetClient(0)->service()->GetUserShare(); |
| 110 | 122 |
| 111 ASSERT_FALSE(DoesTopLevelNodeExist(user_share, it.Get())) | 123 ASSERT_FALSE(DoesTopLevelNodeExist(user_share, it.Get())) |
| 112 << syncer::ModelTypeToString(it.Get()); | 124 << syncer::ModelTypeToString(it.Get()); |
| 113 | 125 |
| 114 // AUTOFILL_PROFILE is lumped together with AUTOFILL. | 126 // AUTOFILL_PROFILE is lumped together with AUTOFILL. |
| 115 if (it.Get() == syncer::AUTOFILL) { | 127 if (it.Get() == syncer::AUTOFILL) { |
| 116 ASSERT_FALSE(DoesTopLevelNodeExist(user_share, | 128 ASSERT_FALSE(DoesTopLevelNodeExist(user_share, |
| 117 syncer::AUTOFILL_PROFILE)); | 129 syncer::AUTOFILL_PROFILE)); |
| 130 } else if (it.Get() == syncer::HISTORY_DELETE_DIRECTIVES || |
| 131 it.Get() == syncer::PROXY_TABS) { |
| 132 ASSERT_FALSE(DoesTopLevelNodeExist(user_share, |
| 133 syncer::SESSIONS)); |
| 118 } | 134 } |
| 119 } | 135 } |
| 120 | 136 |
| 121 EnableNotifications(); | 137 EnableNotifications(); |
| 122 } | 138 } |
| 123 | 139 |
| 124 } // namespace | 140 } // namespace |
| OLD | NEW |