| 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_extensions_sync_test.h" | 5 #include "chrome/test/live_sync/live_extensions_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 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 bool LiveExtensionsSyncTest::SetupClients() { | 25 bool LiveExtensionsSyncTest::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 LiveExtensionsSyncTest::HasSameExtensionsAsVerifier(int index) { | 33 bool LiveExtensionsSyncTest::HasSameExtensionsAsVerifier(int index) { |
| 34 LiveSyncExtensionHelper::ExtensionStateMap | 34 return extension_helper_.ExtensionStateMapsMatch(GetProfile(index), |
| 35 verifier_extension_state_map( | 35 verifier()); |
| 36 extension_helper_.GetExtensionStates(verifier())); | |
| 37 LiveSyncExtensionHelper::ExtensionStateMap | |
| 38 extension_state_map( | |
| 39 extension_helper_.GetExtensionStates(GetProfile(index))); | |
| 40 return (extension_state_map == verifier_extension_state_map); | |
| 41 } | 36 } |
| 42 | 37 |
| 43 bool LiveExtensionsSyncTest::AllProfilesHaveSameExtensionsAsVerifier() { | 38 bool LiveExtensionsSyncTest::AllProfilesHaveSameExtensionsAsVerifier() { |
| 44 for (int i = 0; i < num_clients(); ++i) { | 39 for (int i = 0; i < num_clients(); ++i) { |
| 45 if (!HasSameExtensionsAsVerifier(i)) { | 40 if (!HasSameExtensionsAsVerifier(i)) { |
| 46 LOG(ERROR) << "Profile " << i << " doesn't have the same extensions as" | 41 LOG(ERROR) << "Profile " << i << " doesn't have the same extensions as" |
| 47 " the verifier profile."; | 42 " the verifier profile."; |
| 48 return false; | 43 return false; |
| 49 } | 44 } |
| 50 } | 45 } |
| 51 return true; | 46 return true; |
| 52 } | 47 } |
| 53 | 48 |
| 54 void LiveExtensionsSyncTest::InstallExtension(Profile* profile, int index) { | 49 void LiveExtensionsSyncTest::InstallExtension(Profile* profile, int index) { |
| 55 return extension_helper_.InstallExtension(profile, | 50 return extension_helper_.InstallExtension(profile, |
| 56 CreateFakeExtensionName(index), | 51 CreateFakeExtensionName(index), |
| 57 Extension::TYPE_EXTENSION); | 52 Extension::TYPE_EXTENSION); |
| 58 } | 53 } |
| 59 | 54 |
| 60 void LiveExtensionsSyncTest::UninstallExtension(Profile* profile, int index) { | 55 void LiveExtensionsSyncTest::UninstallExtension(Profile* profile, int index) { |
| 61 return extension_helper_.UninstallExtension(profile, | 56 return extension_helper_.UninstallExtension(profile, |
| 62 CreateFakeExtensionName(index)); | 57 CreateFakeExtensionName(index)); |
| 63 } | 58 } |
| 64 | 59 |
| 60 void LiveExtensionsSyncTest::EnableExtension(Profile* profile, int index) { |
| 61 return extension_helper_.EnableExtension(profile, |
| 62 CreateFakeExtensionName(index)); |
| 63 } |
| 64 |
| 65 void LiveExtensionsSyncTest::DisableExtension(Profile* profile, int index) { |
| 66 return extension_helper_.DisableExtension(profile, |
| 67 CreateFakeExtensionName(index)); |
| 68 } |
| 69 |
| 70 void LiveExtensionsSyncTest::IncognitoEnableExtension(Profile* profile, |
| 71 int index) { |
| 72 return extension_helper_.IncognitoEnableExtension( |
| 73 profile, CreateFakeExtensionName(index)); |
| 74 } |
| 75 |
| 76 void LiveExtensionsSyncTest::IncognitoDisableExtension(Profile* profile, |
| 77 int index) { |
| 78 return extension_helper_.IncognitoDisableExtension( |
| 79 profile, CreateFakeExtensionName(index)); |
| 80 } |
| 81 |
| 65 void LiveExtensionsSyncTest::InstallExtensionsPendingForSync( | 82 void LiveExtensionsSyncTest::InstallExtensionsPendingForSync( |
| 66 Profile* profile) { | 83 Profile* profile) { |
| 67 extension_helper_.InstallExtensionsPendingForSync( | 84 extension_helper_.InstallExtensionsPendingForSync( |
| 68 profile, Extension::TYPE_EXTENSION); | 85 profile, Extension::TYPE_EXTENSION); |
| 69 } | 86 } |
| OLD | NEW |