| 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 "base/macros.h" | 5 #include "base/macros.h" |
| 6 #include "base/strings/stringprintf.h" | 6 #include "base/strings/stringprintf.h" |
| 7 #include "chrome/browser/profiles/profile.h" | 7 #include "chrome/browser/profiles/profile.h" |
| 8 #include "chrome/browser/sync/test/integration/apps_helper.h" | 8 #include "chrome/browser/sync/test/integration/apps_helper.h" |
| 9 #include "chrome/browser/sync/test/integration/extension_settings_helper.h" | 9 #include "chrome/browser/sync/test/integration/extension_settings_helper.h" |
| 10 #include "chrome/browser/sync/test/integration/extensions_helper.h" | 10 #include "chrome/browser/sync/test/integration/extensions_helper.h" |
| 11 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h" | 11 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h" |
| 12 #include "chrome/browser/sync/test/integration/sync_datatype_helper.h" | 12 #include "chrome/browser/sync/test/integration/sync_datatype_helper.h" |
| 13 #include "chrome/browser/sync/test/integration/sync_test.h" | 13 #include "chrome/browser/sync/test/integration/sync_test.h" |
| 14 | 14 |
| 15 namespace { | 15 namespace { |
| 16 | 16 |
| 17 using apps_helper::InstallAppForAllProfiles; | 17 using apps_helper::InstallAppForAllProfiles; |
| 18 using extension_settings_helper::AllExtensionSettingsSameAsVerifier; | 18 using extension_settings_helper::AllExtensionSettingsSameAsVerifier; |
| 19 using extension_settings_helper::SetExtensionSettings; | 19 using extension_settings_helper::SetExtensionSettings; |
| 20 using extension_settings_helper::SetExtensionSettingsForAllProfiles; | 20 using extension_settings_helper::SetExtensionSettingsForAllProfiles; |
| 21 using extensions_helper::InstallExtensionForAllProfiles; | 21 using extensions_helper::InstallExtensionForAllProfiles; |
| 22 using sync_datatype_helper::test; | 22 using sync_datatype_helper::test; |
| 23 | 23 |
| 24 // Generic mutations done after the initial setup of all tests. Note that | 24 // Generic mutations done after the initial setup of all tests. Note that |
| 25 // unfortuately we can't test existing configurations of the sync server since | 25 // unfortuately we can't test existing configurations of the sync server since |
| 26 // the tests don't support that. | 26 // the tests don't support that. |
| 27 void MutateSomeSettings( | 27 void MutateSomeSettings( |
| 28 int seed, // used to modify the mutation values, not keys. | 28 int seed, // used to modify the mutation values, not keys. |
| 29 const std::string& extension0, | 29 const std::string& extension0, |
| 30 const std::string& extension1, | 30 const std::string& extension1, |
| 31 const std::string& extension2) { | 31 const std::string& extension2) { |
| 32 { | 32 { |
| 33 // Write to extension0 from profile 0 but not profile 1. | 33 // Write to extension0 from profile 0 but not profile 1. |
| 34 base::DictionaryValue settings; | 34 base::DictionaryValue settings; |
| 35 settings.SetString("asdf", base::StringPrintf("asdfasdf-%d", seed)); | 35 settings.SetString("asdf", base::StringPrintf("asdfasdf-%d", seed)); |
| 36 SetExtensionSettings(test()->verifier(), extension0, settings); | 36 SetExtensionSettings(test()->verifier(), extension0, settings); |
| 37 SetExtensionSettings(test()->GetProfile(0), extension0, settings); | 37 SetExtensionSettings(test()->GetProfile(0), extension0, settings); |
| 38 } | 38 } |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 return testing::AssertionFailure(); | 175 return testing::AssertionFailure(); |
| 176 if (!AllExtensionSettingsSameAsVerifier()) | 176 if (!AllExtensionSettingsSameAsVerifier()) |
| 177 return testing::AssertionFailure(); | 177 return testing::AssertionFailure(); |
| 178 | 178 |
| 179 return testing::AssertionSuccess(); | 179 return testing::AssertionSuccess(); |
| 180 } | 180 } |
| 181 | 181 |
| 182 IN_PROC_BROWSER_TEST_F(TwoClientExtensionSettingsAndAppSettingsSyncTest, | 182 IN_PROC_BROWSER_TEST_F(TwoClientExtensionSettingsAndAppSettingsSyncTest, |
| 183 ExtensionsStartWithSameSettings) { | 183 ExtensionsStartWithSameSettings) { |
| 184 ASSERT_TRUE(SetupClients()); | 184 ASSERT_TRUE(SetupClients()); |
| 185 ASSERT_PRED3(StartWithSameSettingsTest, | 185 ASSERT_PRED3(StartWithSameSettingsTest, InstallExtensionForAllProfiles(0), |
| 186 InstallExtensionForAllProfiles(0), | 186 InstallExtensionForAllProfiles(1), |
| 187 InstallExtensionForAllProfiles(1), | 187 InstallExtensionForAllProfiles(2)); |
| 188 InstallExtensionForAllProfiles(2) | |
| 189 ); | |
| 190 } | 188 } |
| 191 | 189 |
| 192 IN_PROC_BROWSER_TEST_F(TwoClientExtensionSettingsAndAppSettingsSyncTest, | 190 IN_PROC_BROWSER_TEST_F(TwoClientExtensionSettingsAndAppSettingsSyncTest, |
| 193 AppsStartWithSameSettings) { | 191 AppsStartWithSameSettings) { |
| 194 ASSERT_TRUE(SetupClients()); | 192 ASSERT_TRUE(SetupClients()); |
| 195 ASSERT_PRED3(StartWithSameSettingsTest, | 193 ASSERT_PRED3(StartWithSameSettingsTest, InstallAppForAllProfiles(0), |
| 196 InstallAppForAllProfiles(0), | 194 InstallAppForAllProfiles(1), InstallAppForAllProfiles(2)); |
| 197 InstallAppForAllProfiles(1), | |
| 198 InstallAppForAllProfiles(2) | |
| 199 ); | |
| 200 } | 195 } |
| 201 | 196 |
| 202 IN_PROC_BROWSER_TEST_F(TwoClientExtensionSettingsAndAppSettingsSyncTest, | 197 IN_PROC_BROWSER_TEST_F(TwoClientExtensionSettingsAndAppSettingsSyncTest, |
| 203 ExtensionsStartWithDifferentSettings) { | 198 ExtensionsStartWithDifferentSettings) { |
| 204 ASSERT_TRUE(SetupClients()); | 199 ASSERT_TRUE(SetupClients()); |
| 205 ASSERT_PRED3(StartWithDifferentSettingsTest, | 200 ASSERT_PRED3( |
| 206 InstallExtensionForAllProfiles(0), | 201 StartWithDifferentSettingsTest, InstallExtensionForAllProfiles(0), |
| 207 InstallExtensionForAllProfiles(1), | 202 InstallExtensionForAllProfiles(1), InstallExtensionForAllProfiles(2)); |
| 208 InstallExtensionForAllProfiles(2) | |
| 209 ); | |
| 210 } | 203 } |
| 211 | 204 |
| 212 IN_PROC_BROWSER_TEST_F(TwoClientExtensionSettingsAndAppSettingsSyncTest, | 205 IN_PROC_BROWSER_TEST_F(TwoClientExtensionSettingsAndAppSettingsSyncTest, |
| 213 AppsStartWithDifferentSettings) { | 206 AppsStartWithDifferentSettings) { |
| 214 ASSERT_TRUE(SetupClients()); | 207 ASSERT_TRUE(SetupClients()); |
| 215 ASSERT_PRED3(StartWithDifferentSettingsTest, | 208 ASSERT_PRED3(StartWithDifferentSettingsTest, InstallAppForAllProfiles(0), |
| 216 InstallAppForAllProfiles(0), | 209 InstallAppForAllProfiles(1), InstallAppForAllProfiles(2)); |
| 217 InstallAppForAllProfiles(1), | |
| 218 InstallAppForAllProfiles(2) | |
| 219 ); | |
| 220 } | 210 } |
| 221 | 211 |
| 222 } // namespace | 212 } // namespace |
| OLD | NEW |