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/extensions/extension_function.h" | 13 #include "chrome/browser/extensions/extension_function.h" |
14 #include "chrome/browser/extensions/extension_function_dispatcher.h" | 14 #include "chrome/browser/extensions/extension_function_dispatcher.h" |
15 #include "chrome/browser/ui/browser.h" | 15 #include "chrome/browser/ui/browser.h" |
16 #include "chrome/common/extensions/extension.h" | 16 #include "chrome/common/extensions/extension.h" |
17 #include "chrome/test/base/ui_test_utils.h" | 17 #include "chrome/test/base/ui_test_utils.h" |
| 18 #include "extensions/common/id_util.h" |
18 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
19 | 20 |
20 using content::WebContents; | 21 using content::WebContents; |
21 using extensions::Extension; | 22 using extensions::Extension; |
22 using extensions::Manifest; | 23 using extensions::Manifest; |
23 namespace keys = extensions::tabs_constants; | 24 namespace keys = extensions::tabs_constants; |
24 | 25 |
25 namespace { | 26 namespace { |
26 | 27 |
27 class TestFunctionDispatcherDelegate | 28 class TestFunctionDispatcherDelegate |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 } | 129 } |
129 | 130 |
130 scoped_refptr<Extension> CreateExtension( | 131 scoped_refptr<Extension> CreateExtension( |
131 Manifest::Location location, | 132 Manifest::Location location, |
132 base::DictionaryValue* test_extension_value, | 133 base::DictionaryValue* test_extension_value, |
133 const std::string& id_input) { | 134 const std::string& id_input) { |
134 std::string error; | 135 std::string error; |
135 const base::FilePath test_extension_path; | 136 const base::FilePath test_extension_path; |
136 std::string id; | 137 std::string id; |
137 if (!id_input.empty()) | 138 if (!id_input.empty()) |
138 CHECK(Extension::GenerateId(id_input, &id)); | 139 id = extensions::id_util::GenerateId(id_input); |
139 scoped_refptr<Extension> extension(Extension::Create( | 140 scoped_refptr<Extension> extension(Extension::Create( |
140 test_extension_path, | 141 test_extension_path, |
141 location, | 142 location, |
142 *test_extension_value, | 143 *test_extension_value, |
143 Extension::NO_FLAGS, | 144 Extension::NO_FLAGS, |
144 id, | 145 id, |
145 &error)); | 146 &error)); |
146 EXPECT_TRUE(error.empty()) << "Could not parse test extension " << error; | 147 EXPECT_TRUE(error.empty()) << "Could not parse test extension " << error; |
147 return extension; | 148 return extension; |
148 } | 149 } |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 if (!response_delegate.HasResponse()) { | 263 if (!response_delegate.HasResponse()) { |
263 response_delegate.set_should_post_quit(true); | 264 response_delegate.set_should_post_quit(true); |
264 content::RunMessageLoop(); | 265 content::RunMessageLoop(); |
265 } | 266 } |
266 | 267 |
267 EXPECT_TRUE(response_delegate.HasResponse()); | 268 EXPECT_TRUE(response_delegate.HasResponse()); |
268 return response_delegate.GetResponse(); | 269 return response_delegate.GetResponse(); |
269 } | 270 } |
270 | 271 |
271 } // namespace extension_function_test_utils | 272 } // namespace extension_function_test_utils |
OLD | NEW |