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 "chrome/browser/sync/test/integration/extensions_helper.h" | 5 #include "chrome/browser/sync/test/integration/extensions_helper.h" |
6 | 6 |
7 #include <cstring> | 7 #include <cstring> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 } | 47 } |
48 return true; | 48 return true; |
49 } | 49 } |
50 | 50 |
51 | 51 |
52 std::string InstallExtension(Profile* profile, int index) { | 52 std::string InstallExtension(Profile* profile, int index) { |
53 return SyncExtensionHelper::GetInstance()->InstallExtension( | 53 return SyncExtensionHelper::GetInstance()->InstallExtension( |
54 profile, CreateFakeExtensionName(index), Extension::TYPE_EXTENSION); | 54 profile, CreateFakeExtensionName(index), Extension::TYPE_EXTENSION); |
55 } | 55 } |
56 | 56 |
| 57 std::string InstallExtensionForAllProfiles(int index) { |
| 58 for (int i = 0; i < test()->num_clients(); ++i) |
| 59 InstallExtension(test()->GetProfile(i), index); |
| 60 return InstallExtension(test()->verifier(), index); |
| 61 } |
| 62 |
57 void UninstallExtension(Profile* profile, int index) { | 63 void UninstallExtension(Profile* profile, int index) { |
58 return SyncExtensionHelper::GetInstance()->UninstallExtension( | 64 return SyncExtensionHelper::GetInstance()->UninstallExtension( |
59 profile, CreateFakeExtensionName(index)); | 65 profile, CreateFakeExtensionName(index)); |
60 } | 66 } |
61 | 67 |
62 std::vector<int> GetInstalledExtensions(Profile* profile) { | 68 std::vector<int> GetInstalledExtensions(Profile* profile) { |
63 std::vector<int> indices; | 69 std::vector<int> indices; |
64 std::vector<std::string> names = | 70 std::vector<std::string> names = |
65 SyncExtensionHelper::GetInstance()->GetInstalledExtensionNames(profile); | 71 SyncExtensionHelper::GetInstance()->GetInstalledExtensionNames(profile); |
66 for (std::vector<std::string>::const_iterator it = names.begin(); | 72 for (std::vector<std::string>::const_iterator it = names.begin(); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 if (!StartsWithASCII(name, extension_name_prefix, true) || | 122 if (!StartsWithASCII(name, extension_name_prefix, true) || |
117 !base::StringToInt(name.substr(strlen(extension_name_prefix)), index)) { | 123 !base::StringToInt(name.substr(strlen(extension_name_prefix)), index)) { |
118 LOG(WARNING) << "Unable to convert extension name \"" << name | 124 LOG(WARNING) << "Unable to convert extension name \"" << name |
119 << "\" to index"; | 125 << "\" to index"; |
120 return false; | 126 return false; |
121 } | 127 } |
122 return true; | 128 return true; |
123 } | 129 } |
124 | 130 |
125 } // namespace extensions_helper | 131 } // namespace extensions_helper |
OLD | NEW |