| 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/test/live_sync/live_apps_sync_test.h" | 5 #include "chrome/test/live_sync/live_apps_sync_test.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/string_number_conversions.h" | 8 #include "base/string_number_conversions.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/common/extensions/extension.h" | 10 #include "chrome/common/extensions/extension.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 bool LiveAppsSyncTest::SetupClients() { | 25 bool LiveAppsSyncTest::SetupClients() { |
| 26 if (!LiveSyncTest::SetupClients()) | 26 if (!LiveSyncTest::SetupClients()) |
| 27 return false; | 27 return false; |
| 28 | 28 |
| 29 extension_helper_.Setup(this); | 29 extension_helper_.Setup(this); |
| 30 return true; | 30 return true; |
| 31 } | 31 } |
| 32 | 32 |
| 33 bool LiveAppsSyncTest::HasSameAppsAsVerifier(int index) { | 33 bool LiveAppsSyncTest::HasSameAppsAsVerifier(int index) { |
| 34 // TODO(akalin): We may want to filter out non-apps for some tests. | 34 // TODO(akalin): We may want to filter out non-apps for some tests. |
| 35 LiveSyncExtensionHelper::ExtensionStateMap | 35 return extension_helper_.ExtensionStatesMatch(GetProfile(index), verifier()); |
| 36 verifier_extension_state_map( | |
| 37 extension_helper_.GetExtensionStates(verifier())); | |
| 38 LiveSyncExtensionHelper::ExtensionStateMap | |
| 39 extension_state_map( | |
| 40 extension_helper_.GetExtensionStates(GetProfile(index))); | |
| 41 return (extension_state_map == verifier_extension_state_map); | |
| 42 } | 36 } |
| 43 | 37 |
| 44 | |
| 45 bool LiveAppsSyncTest::AllProfilesHaveSameAppsAsVerifier() { | 38 bool LiveAppsSyncTest::AllProfilesHaveSameAppsAsVerifier() { |
| 46 for (int i = 0; i < num_clients(); ++i) { | 39 for (int i = 0; i < num_clients(); ++i) { |
| 47 if (!HasSameAppsAsVerifier(i)) { | 40 if (!HasSameAppsAsVerifier(i)) { |
| 48 LOG(ERROR) << "Profile " << i << " doesn't have the same apps as the" | 41 LOG(ERROR) << "Profile " << i << " doesn't have the same apps as the" |
| 49 " verifier profile."; | 42 " verifier profile."; |
| 50 return false; | 43 return false; |
| 51 } | 44 } |
| 52 } | 45 } |
| 53 return true; | 46 return true; |
| 54 } | 47 } |
| 55 | 48 |
| 56 void LiveAppsSyncTest::InstallApp(Profile* profile, int index) { | 49 void LiveAppsSyncTest::InstallApp(Profile* profile, int index) { |
| 57 return extension_helper_.InstallExtension(profile, | 50 return extension_helper_.InstallExtension(profile, |
| 58 CreateFakeAppName(index), | 51 CreateFakeAppName(index), |
| 59 Extension::TYPE_HOSTED_APP); | 52 Extension::TYPE_HOSTED_APP); |
| 60 } | 53 } |
| 61 | 54 |
| 62 void LiveAppsSyncTest::UninstallApp(Profile* profile, int index) { | 55 void LiveAppsSyncTest::UninstallApp(Profile* profile, int index) { |
| 63 return extension_helper_.UninstallExtension(profile, | 56 return extension_helper_.UninstallExtension(profile, |
| 64 CreateFakeAppName(index)); | 57 CreateFakeAppName(index)); |
| 65 } | 58 } |
| 66 | 59 |
| 60 void LiveAppsSyncTest::EnableApp(Profile* profile, int index) { |
| 61 return extension_helper_.EnableExtension(profile, |
| 62 CreateFakeAppName(index)); |
| 63 } |
| 64 |
| 65 void LiveAppsSyncTest::DisableApp(Profile* profile, int index) { |
| 66 return extension_helper_.DisableExtension(profile, |
| 67 CreateFakeAppName(index)); |
| 68 } |
| 69 |
| 70 void LiveAppsSyncTest::IncognitoEnableApp(Profile* profile, int index) { |
| 71 return extension_helper_.IncognitoEnableExtension(profile, |
| 72 CreateFakeAppName(index)); |
| 73 } |
| 74 |
| 75 void LiveAppsSyncTest::IncognitoDisableApp(Profile* profile, int index) { |
| 76 return extension_helper_.IncognitoDisableExtension(profile, |
| 77 CreateFakeAppName(index)); |
| 78 } |
| 79 |
| 67 void LiveAppsSyncTest::InstallAppsPendingForSync( | 80 void LiveAppsSyncTest::InstallAppsPendingForSync( |
| 68 Profile* profile) { | 81 Profile* profile) { |
| 69 extension_helper_.InstallExtensionsPendingForSync( | 82 extension_helper_.InstallExtensionsPendingForSync( |
| 70 profile, Extension::TYPE_HOSTED_APP); | 83 profile, Extension::TYPE_HOSTED_APP); |
| 71 } | 84 } |
| OLD | NEW |