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" |
11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
13 #include "chrome/browser/sync/test/integration/sync_datatype_helper.h" | 13 #include "chrome/browser/sync/test/integration/sync_datatype_helper.h" |
14 #include "chrome/browser/sync/test/integration/sync_extension_helper.h" | 14 #include "chrome/browser/sync/test/integration/sync_extension_helper.h" |
15 #include "chrome/common/extensions/extension.h" | 15 #include "chrome/common/extensions/manifest.h" |
16 | 16 |
17 using sync_datatype_helper::test; | 17 using sync_datatype_helper::test; |
18 | 18 |
19 namespace extensions_helper { | 19 namespace extensions_helper { |
20 | 20 |
21 const char extension_name_prefix[] = "fakeextension"; | 21 const char extension_name_prefix[] = "fakeextension"; |
22 | 22 |
23 bool HasSameExtensionsAsVerifier(int index) { | 23 bool HasSameExtensionsAsVerifier(int index) { |
24 return SyncExtensionHelper::GetInstance()->ExtensionStatesMatch( | 24 return SyncExtensionHelper::GetInstance()->ExtensionStatesMatch( |
25 test()->GetProfile(index), test()->verifier()); | 25 test()->GetProfile(index), test()->verifier()); |
(...skipping 20 matching lines...) Expand all Loading... |
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, | 54 profile, |
55 CreateFakeExtensionName(index), | 55 CreateFakeExtensionName(index), |
56 extensions::Extension::TYPE_EXTENSION); | 56 extensions::Manifest::TYPE_EXTENSION); |
57 } | 57 } |
58 | 58 |
59 std::string InstallExtensionForAllProfiles(int index) { | 59 std::string InstallExtensionForAllProfiles(int index) { |
60 for (int i = 0; i < test()->num_clients(); ++i) | 60 for (int i = 0; i < test()->num_clients(); ++i) |
61 InstallExtension(test()->GetProfile(i), index); | 61 InstallExtension(test()->GetProfile(i), index); |
62 return InstallExtension(test()->verifier(), index); | 62 return InstallExtension(test()->verifier(), index); |
63 } | 63 } |
64 | 64 |
65 void UninstallExtension(Profile* profile, int index) { | 65 void UninstallExtension(Profile* profile, int index) { |
66 return SyncExtensionHelper::GetInstance()->UninstallExtension( | 66 return SyncExtensionHelper::GetInstance()->UninstallExtension( |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 if (!StartsWithASCII(name, extension_name_prefix, true) || | 123 if (!StartsWithASCII(name, extension_name_prefix, true) || |
124 !base::StringToInt(name.substr(strlen(extension_name_prefix)), index)) { | 124 !base::StringToInt(name.substr(strlen(extension_name_prefix)), index)) { |
125 LOG(WARNING) << "Unable to convert extension name \"" << name | 125 LOG(WARNING) << "Unable to convert extension name \"" << name |
126 << "\" to index"; | 126 << "\" to index"; |
127 return false; | 127 return false; |
128 } | 128 } |
129 return true; | 129 return true; |
130 } | 130 } |
131 | 131 |
132 } // namespace extensions_helper | 132 } // namespace extensions_helper |
OLD | NEW |