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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 " profile 0."; | 44 " profile 0."; |
45 return false; | 45 return false; |
46 } | 46 } |
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, |
| 55 CreateFakeExtensionName(index), |
| 56 extensions::Extension::TYPE_EXTENSION); |
55 } | 57 } |
56 | 58 |
57 std::string InstallExtensionForAllProfiles(int index) { | 59 std::string InstallExtensionForAllProfiles(int index) { |
58 for (int i = 0; i < test()->num_clients(); ++i) | 60 for (int i = 0; i < test()->num_clients(); ++i) |
59 InstallExtension(test()->GetProfile(i), index); | 61 InstallExtension(test()->GetProfile(i), index); |
60 return InstallExtension(test()->verifier(), index); | 62 return InstallExtension(test()->verifier(), index); |
61 } | 63 } |
62 | 64 |
63 void UninstallExtension(Profile* profile, int index) { | 65 void UninstallExtension(Profile* profile, int index) { |
64 return SyncExtensionHelper::GetInstance()->UninstallExtension( | 66 return SyncExtensionHelper::GetInstance()->UninstallExtension( |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 profile, CreateFakeExtensionName(index)); | 106 profile, CreateFakeExtensionName(index)); |
105 } | 107 } |
106 | 108 |
107 bool IsIncognitoEnabled(Profile* profile, int index) { | 109 bool IsIncognitoEnabled(Profile* profile, int index) { |
108 return SyncExtensionHelper::GetInstance()->IsIncognitoEnabled( | 110 return SyncExtensionHelper::GetInstance()->IsIncognitoEnabled( |
109 profile, CreateFakeExtensionName(index)); | 111 profile, CreateFakeExtensionName(index)); |
110 } | 112 } |
111 | 113 |
112 void InstallExtensionsPendingForSync(Profile* profile) { | 114 void InstallExtensionsPendingForSync(Profile* profile) { |
113 SyncExtensionHelper::GetInstance()->InstallExtensionsPendingForSync( | 115 SyncExtensionHelper::GetInstance()->InstallExtensionsPendingForSync( |
114 profile, Extension::TYPE_EXTENSION); | 116 profile, extensions::Extension::TYPE_EXTENSION); |
115 } | 117 } |
116 | 118 |
117 std::string CreateFakeExtensionName(int index) { | 119 std::string CreateFakeExtensionName(int index) { |
118 return extension_name_prefix + base::IntToString(index); | 120 return extension_name_prefix + base::IntToString(index); |
119 } | 121 } |
120 | 122 |
121 bool ExtensionNameToIndex(const std::string& name, int* index) { | 123 bool ExtensionNameToIndex(const std::string& name, int* index) { |
122 if (!StartsWithASCII(name, extension_name_prefix, true) || | 124 if (!StartsWithASCII(name, extension_name_prefix, true) || |
123 !base::StringToInt(name.substr(strlen(extension_name_prefix)), index)) { | 125 !base::StringToInt(name.substr(strlen(extension_name_prefix)), index)) { |
124 LOG(WARNING) << "Unable to convert extension name \"" << name | 126 LOG(WARNING) << "Unable to convert extension name \"" << name |
125 << "\" to index"; | 127 << "\" to index"; |
126 return false; | 128 return false; |
127 } | 129 } |
128 return true; | 130 return true; |
129 } | 131 } |
130 | 132 |
131 } // namespace extensions_helper | 133 } // namespace extensions_helper |
OLD | NEW |