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 #ifndef EXTENSIONS_BROWSER_API_TEST_UTILS_H_ | 5 #ifndef EXTENSIONS_BROWSER_API_TEST_UTILS_H_ |
6 #define EXTENSIONS_BROWSER_API_TEST_UTILS_H_ | 6 #define EXTENSIONS_BROWSER_API_TEST_UTILS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 | 11 |
12 class UIThreadExtensionFunction; | 12 class UIThreadExtensionFunction; |
13 | 13 |
14 namespace base { | 14 namespace base { |
| 15 class ListValue; |
15 class Value; | 16 class Value; |
16 } | 17 } |
17 | 18 |
18 namespace content { | 19 namespace content { |
19 class BrowserContext; | 20 class BrowserContext; |
20 } | 21 } |
21 | 22 |
22 namespace extensions { | 23 namespace extensions { |
23 class ExtensionFunctionDispatcher; | 24 class ExtensionFunctionDispatcher; |
24 | 25 |
25 // TODO(yoz): crbug.com/394840: Remove duplicate functionality in | 26 // TODO(yoz): crbug.com/394840: Remove duplicate functionality in |
26 // chrome/browser/extensions/extension_function_test_utils.h. | 27 // chrome/browser/extensions/extension_function_test_utils.h. |
| 28 // |
| 29 // TODO(ckehoe): Accept args as scoped_ptr<base::Value>, |
| 30 // and migrate existing users to the new API. |
27 namespace api_test_utils { | 31 namespace api_test_utils { |
28 | 32 |
29 enum RunFunctionFlags { NONE = 0, INCLUDE_INCOGNITO = 1 << 0 }; | 33 enum RunFunctionFlags { NONE = 0, INCLUDE_INCOGNITO = 1 << 0 }; |
30 | 34 |
31 // Run |function| with |args| and return the result. Adds an error to the | 35 // Run |function| with |args| and return the result. Adds an error to the |
32 // current test if |function| returns an error. Takes ownership of | 36 // current test if |function| returns an error. Takes ownership of |
33 // |function|. The caller takes ownership of the result. | 37 // |function|. The caller takes ownership of the result. |
34 base::Value* RunFunctionWithDelegateAndReturnSingleResult( | 38 base::Value* RunFunctionWithDelegateAndReturnSingleResult( |
35 UIThreadExtensionFunction* function, | 39 UIThreadExtensionFunction* function, |
36 const std::string& args, | 40 const std::string& args, |
(...skipping 26 matching lines...) Expand all Loading... |
63 // close to what the bindings would actually send. | 67 // close to what the bindings would actually send. |
64 // | 68 // |
65 // TODO(aa): I'm concerned that this style won't scale to all the bits and bobs | 69 // TODO(aa): I'm concerned that this style won't scale to all the bits and bobs |
66 // we're going to need to frob for all the different extension functions. But | 70 // we're going to need to frob for all the different extension functions. But |
67 // we can refactor when we see what is needed. | 71 // we can refactor when we see what is needed. |
68 bool RunFunction(UIThreadExtensionFunction* function, | 72 bool RunFunction(UIThreadExtensionFunction* function, |
69 const std::string& args, | 73 const std::string& args, |
70 content::BrowserContext* context, | 74 content::BrowserContext* context, |
71 scoped_ptr<ExtensionFunctionDispatcher> dispatcher, | 75 scoped_ptr<ExtensionFunctionDispatcher> dispatcher, |
72 RunFunctionFlags flags); | 76 RunFunctionFlags flags); |
| 77 bool RunFunction(UIThreadExtensionFunction* function, |
| 78 scoped_ptr<base::ListValue> args, |
| 79 content::BrowserContext* context, |
| 80 scoped_ptr<ExtensionFunctionDispatcher> dispatcher, |
| 81 RunFunctionFlags flags); |
73 | 82 |
74 } // namespace function_test_utils | 83 } // namespace function_test_utils |
75 } // namespace extensions | 84 } // namespace extensions |
76 | 85 |
77 #endif // EXTENSIONS_BROWSER_API_TEST_UTILS_H_ | 86 #endif // EXTENSIONS_BROWSER_API_TEST_UTILS_H_ |
OLD | NEW |