| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/browser/api_test_utils.h" | 5 #include "extensions/browser/api_test_utils.h" |
| 6 | 6 |
| 7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "components/crx_file/id_util.h" | 10 #include "components/crx_file/id_util.h" |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 EXPECT_TRUE(error.empty()) << "Could not parse test extension " << error; | 128 EXPECT_TRUE(error.empty()) << "Could not parse test extension " << error; |
| 129 return extension; | 129 return extension; |
| 130 } | 130 } |
| 131 | 131 |
| 132 scoped_refptr<Extension> CreateExtension( | 132 scoped_refptr<Extension> CreateExtension( |
| 133 base::DictionaryValue* test_extension_value) { | 133 base::DictionaryValue* test_extension_value) { |
| 134 return CreateExtension(Manifest::INTERNAL, test_extension_value, | 134 return CreateExtension(Manifest::INTERNAL, test_extension_value, |
| 135 std::string()); | 135 std::string()); |
| 136 } | 136 } |
| 137 | 137 |
| 138 scoped_refptr<Extension> CreateEmptyExtensionWithLocation( |
| 139 Manifest::Location location) { |
| 140 scoped_ptr<base::DictionaryValue> test_extension_value( |
| 141 ParseDictionary("{\"name\": \"Test\", \"version\": \"1.0\"}")); |
| 142 return CreateExtension(location, test_extension_value.get(), std::string()); |
| 143 } |
| 144 |
| 138 base::Value* RunFunctionWithDelegateAndReturnSingleResult( | 145 base::Value* RunFunctionWithDelegateAndReturnSingleResult( |
| 139 UIThreadExtensionFunction* function, | 146 UIThreadExtensionFunction* function, |
| 140 const std::string& args, | 147 const std::string& args, |
| 141 content::BrowserContext* context, | 148 content::BrowserContext* context, |
| 142 scoped_ptr<extensions::ExtensionFunctionDispatcher> dispatcher) { | 149 scoped_ptr<extensions::ExtensionFunctionDispatcher> dispatcher) { |
| 143 return RunFunctionWithDelegateAndReturnSingleResult( | 150 return RunFunctionWithDelegateAndReturnSingleResult( |
| 144 function, args, context, dispatcher.Pass(), NONE); | 151 function, args, context, dispatcher.Pass(), NONE); |
| 145 } | 152 } |
| 146 | 153 |
| 147 base::Value* RunFunctionWithDelegateAndReturnSingleResult( | 154 base::Value* RunFunctionWithDelegateAndReturnSingleResult( |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 response_delegate.set_should_post_quit(true); | 255 response_delegate.set_should_post_quit(true); |
| 249 content::RunMessageLoop(); | 256 content::RunMessageLoop(); |
| 250 } | 257 } |
| 251 | 258 |
| 252 EXPECT_TRUE(response_delegate.HasResponse()); | 259 EXPECT_TRUE(response_delegate.HasResponse()); |
| 253 return response_delegate.GetResponse(); | 260 return response_delegate.GetResponse(); |
| 254 } | 261 } |
| 255 | 262 |
| 256 } // namespace api_test_utils | 263 } // namespace api_test_utils |
| 257 } // namespace extensions | 264 } // namespace extensions |
| OLD | NEW |