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/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_piece.h" | |
11 #include "base/string_util.h" | 12 #include "base/string_util.h" |
12 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
13 #include "chrome/browser/sync/test/integration/sync_datatype_helper.h" | 14 #include "chrome/browser/sync/test/integration/sync_datatype_helper.h" |
14 #include "chrome/browser/sync/test/integration/sync_extension_helper.h" | 15 #include "chrome/browser/sync/test/integration/sync_extension_helper.h" |
15 #include "chrome/common/extensions/extension.h" | 16 #include "chrome/common/extensions/extension.h" |
16 | 17 |
17 using sync_datatype_helper::test; | 18 using sync_datatype_helper::test; |
18 | 19 |
19 namespace extensions_helper { | 20 namespace extensions_helper { |
20 | 21 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
107 SyncExtensionHelper::GetInstance()->InstallExtensionsPendingForSync( | 108 SyncExtensionHelper::GetInstance()->InstallExtensionsPendingForSync( |
108 profile, Extension::TYPE_EXTENSION); | 109 profile, Extension::TYPE_EXTENSION); |
109 } | 110 } |
110 | 111 |
111 std::string CreateFakeExtensionName(int index) { | 112 std::string CreateFakeExtensionName(int index) { |
112 return extension_name_prefix + base::IntToString(index); | 113 return extension_name_prefix + base::IntToString(index); |
113 } | 114 } |
114 | 115 |
115 bool ExtensionNameToIndex(const std::string& name, int* index) { | 116 bool ExtensionNameToIndex(const std::string& name, int* index) { |
116 if (!StartsWithASCII(name, extension_name_prefix, true) || | 117 if (!StartsWithASCII(name, extension_name_prefix, true) || |
117 !base::StringToInt(name.substr(strlen(extension_name_prefix)), index)) { | 118 !base::StringToInt(base::StringPiece(name, strlen(extension_name_prefix)), |
erikwright (departed)
2011/12/16 21:05:50
Are you sure this works? Looks like it needs to be
| |
119 index)) { | |
118 LOG(WARNING) << "Unable to convert extension name \"" << name | 120 LOG(WARNING) << "Unable to convert extension name \"" << name |
119 << "\" to index"; | 121 << "\" to index"; |
120 return false; | 122 return false; |
121 } | 123 } |
122 return true; | 124 return true; |
123 } | 125 } |
124 | 126 |
125 } // namespace extensions_helper | 127 } // namespace extensions_helper |
OLD | NEW |