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