| 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_.ExtensionStateMapsMatch(GetProfile(index), |
| 36 verifier_extension_state_map( | 36 verifier()); |
| 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 } | 37 } |
| 43 | 38 |
| 44 | 39 |
| 45 bool LiveAppsSyncTest::AllProfilesHaveSameAppsAsVerifier() { | 40 bool LiveAppsSyncTest::AllProfilesHaveSameAppsAsVerifier() { |
| 46 for (int i = 0; i < num_clients(); ++i) { | 41 for (int i = 0; i < num_clients(); ++i) { |
| 47 if (!HasSameAppsAsVerifier(i)) { | 42 if (!HasSameAppsAsVerifier(i)) { |
| 48 LOG(ERROR) << "Profile " << i << " doesn't have the same apps as the" | 43 LOG(ERROR) << "Profile " << i << " doesn't have the same apps as the" |
| 49 " verifier profile."; | 44 " verifier profile."; |
| 50 return false; | 45 return false; |
| 51 } | 46 } |
| 52 } | 47 } |
| 53 return true; | 48 return true; |
| 54 } | 49 } |
| 55 | 50 |
| 56 void LiveAppsSyncTest::InstallApp(Profile* profile, int index) { | 51 void LiveAppsSyncTest::InstallApp(Profile* profile, int index) { |
| 57 return extension_helper_.InstallExtension(profile, | 52 return extension_helper_.InstallExtension(profile, |
| 58 CreateFakeAppName(index), | 53 CreateFakeAppName(index), |
| 59 Extension::TYPE_HOSTED_APP); | 54 Extension::TYPE_HOSTED_APP); |
| 60 } | 55 } |
| 61 | 56 |
| 62 void LiveAppsSyncTest::UninstallApp(Profile* profile, int index) { | 57 void LiveAppsSyncTest::UninstallApp(Profile* profile, int index) { |
| 63 return extension_helper_.UninstallExtension(profile, | 58 return extension_helper_.UninstallExtension(profile, |
| 64 CreateFakeAppName(index)); | 59 CreateFakeAppName(index)); |
| 65 } | 60 } |
| 66 | 61 |
| 62 void LiveAppsSyncTest::EnableApp(Profile* profile, int index) { |
| 63 return extension_helper_.EnableExtension(profile, |
| 64 CreateFakeAppName(index)); |
| 65 } |
| 66 |
| 67 void LiveAppsSyncTest::DisableApp(Profile* profile, int index) { |
| 68 return extension_helper_.DisableExtension(profile, |
| 69 CreateFakeAppName(index)); |
| 70 } |
| 71 |
| 72 void LiveAppsSyncTest::IncognitoEnableApp(Profile* profile, int index) { |
| 73 return extension_helper_.IncognitoEnableExtension(profile, |
| 74 CreateFakeAppName(index)); |
| 75 } |
| 76 |
| 77 void LiveAppsSyncTest::IncognitoDisableApp(Profile* profile, int index) { |
| 78 return extension_helper_.IncognitoDisableExtension(profile, |
| 79 CreateFakeAppName(index)); |
| 80 } |
| 81 |
| 67 void LiveAppsSyncTest::InstallAppsPendingForSync( | 82 void LiveAppsSyncTest::InstallAppsPendingForSync( |
| 68 Profile* profile) { | 83 Profile* profile) { |
| 69 extension_helper_.InstallExtensionsPendingForSync( | 84 extension_helper_.InstallExtensionsPendingForSync( |
| 70 profile, Extension::TYPE_HOSTED_APP); | 85 profile, Extension::TYPE_HOSTED_APP); |
| 71 } | 86 } |
| OLD | NEW |