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/extensions/extension_function_test_utils.h" | 5 #include "chrome/browser/extensions/extension_function_test_utils.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
11 #include "base/values.h" | 11 #include "base/values.h" |
12 #include "chrome/browser/extensions/api/tabs/tabs_constants.h" | 12 #include "chrome/browser/extensions/api/tabs/tabs_constants.h" |
13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
14 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
15 #include "chrome/test/base/ui_test_utils.h" | 15 #include "chrome/test/base/ui_test_utils.h" |
| 16 #include "components/crx_file/id_util.h" |
16 #include "extensions/browser/api_test_utils.h" | 17 #include "extensions/browser/api_test_utils.h" |
17 #include "extensions/browser/extension_function.h" | 18 #include "extensions/browser/extension_function.h" |
18 #include "extensions/browser/extension_function_dispatcher.h" | 19 #include "extensions/browser/extension_function_dispatcher.h" |
19 #include "extensions/common/extension.h" | 20 #include "extensions/common/extension.h" |
20 #include "extensions/common/id_util.h" | |
21 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
22 | 22 |
23 using content::WebContents; | 23 using content::WebContents; |
24 using extensions::Extension; | 24 using extensions::Extension; |
25 using extensions::Manifest; | 25 using extensions::Manifest; |
26 namespace keys = extensions::tabs_constants; | 26 namespace keys = extensions::tabs_constants; |
27 | 27 |
28 namespace { | 28 namespace { |
29 | 29 |
30 class TestFunctionDispatcherDelegate | 30 class TestFunctionDispatcherDelegate |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 } | 129 } |
130 | 130 |
131 scoped_refptr<Extension> CreateExtension( | 131 scoped_refptr<Extension> CreateExtension( |
132 Manifest::Location location, | 132 Manifest::Location location, |
133 base::DictionaryValue* test_extension_value, | 133 base::DictionaryValue* test_extension_value, |
134 const std::string& id_input) { | 134 const std::string& id_input) { |
135 std::string error; | 135 std::string error; |
136 const base::FilePath test_extension_path; | 136 const base::FilePath test_extension_path; |
137 std::string id; | 137 std::string id; |
138 if (!id_input.empty()) | 138 if (!id_input.empty()) |
139 id = extensions::id_util::GenerateId(id_input); | 139 id = crx_file::id_util::GenerateId(id_input); |
140 scoped_refptr<Extension> extension(Extension::Create( | 140 scoped_refptr<Extension> extension(Extension::Create( |
141 test_extension_path, | 141 test_extension_path, |
142 location, | 142 location, |
143 *test_extension_value, | 143 *test_extension_value, |
144 Extension::NO_FLAGS, | 144 Extension::NO_FLAGS, |
145 id, | 145 id, |
146 &error)); | 146 &error)); |
147 EXPECT_TRUE(error.empty()) << "Could not parse test extension " << error; | 147 EXPECT_TRUE(error.empty()) << "Could not parse test extension " << error; |
148 return extension; | 148 return extension; |
149 } | 149 } |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 // only one place. See crbug.com/394840. | 260 // only one place. See crbug.com/394840. |
261 return extensions::api_test_utils::RunFunction( | 261 return extensions::api_test_utils::RunFunction( |
262 function, | 262 function, |
263 args.Pass(), | 263 args.Pass(), |
264 browser->profile(), | 264 browser->profile(), |
265 dispatcher.Pass(), | 265 dispatcher.Pass(), |
266 static_cast<extensions::api_test_utils::RunFunctionFlags>(flags)); | 266 static_cast<extensions::api_test_utils::RunFunctionFlags>(flags)); |
267 } | 267 } |
268 | 268 |
269 } // namespace extension_function_test_utils | 269 } // namespace extension_function_test_utils |
OLD | NEW |