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 <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 const std::string& id_input); | 58 const std::string& id_input); |
59 | 59 |
60 // Creates an extension instance with a specified location that can be attached | 60 // Creates an extension instance with a specified location that can be attached |
61 // to an ExtensionFunction before running. | 61 // to an ExtensionFunction before running. |
62 scoped_refptr<extensions::Extension> CreateEmptyExtensionWithLocation( | 62 scoped_refptr<extensions::Extension> CreateEmptyExtensionWithLocation( |
63 extensions::Manifest::Location location); | 63 extensions::Manifest::Location location); |
64 | 64 |
65 // Run |function| with |args| and return the result. Adds an error to the | 65 // Run |function| with |args| and return the result. Adds an error to the |
66 // current test if |function| returns an error. Takes ownership of | 66 // current test if |function| returns an error. Takes ownership of |
67 // |function|. The caller takes ownership of the result. | 67 // |function|. The caller takes ownership of the result. |
68 base::Value* RunFunctionWithDelegateAndReturnSingleResult( | 68 std::unique_ptr<base::Value> RunFunctionWithDelegateAndReturnSingleResult( |
69 UIThreadExtensionFunction* function, | 69 scoped_refptr<UIThreadExtensionFunction> function, |
70 const std::string& args, | 70 const std::string& args, |
71 content::BrowserContext* context, | 71 content::BrowserContext* context, |
72 std::unique_ptr<ExtensionFunctionDispatcher> dispatcher); | 72 std::unique_ptr<ExtensionFunctionDispatcher> dispatcher); |
73 base::Value* RunFunctionWithDelegateAndReturnSingleResult( | 73 std::unique_ptr<base::Value> RunFunctionWithDelegateAndReturnSingleResult( |
74 UIThreadExtensionFunction* function, | 74 scoped_refptr<UIThreadExtensionFunction> function, |
75 const std::string& args, | 75 const std::string& args, |
76 content::BrowserContext* context, | 76 content::BrowserContext* context, |
77 std::unique_ptr<ExtensionFunctionDispatcher> dispatcher, | 77 std::unique_ptr<ExtensionFunctionDispatcher> dispatcher, |
78 RunFunctionFlags flags); | 78 RunFunctionFlags flags); |
| 79 std::unique_ptr<base::Value> RunFunctionWithDelegateAndReturnSingleResult( |
| 80 scoped_refptr<UIThreadExtensionFunction> function, |
| 81 std::unique_ptr<base::ListValue> args, |
| 82 content::BrowserContext* context, |
| 83 std::unique_ptr<ExtensionFunctionDispatcher> dispatcher, |
| 84 RunFunctionFlags flags); |
79 | 85 |
80 // RunFunctionWithDelegateAndReturnSingleResult, except with a NULL | 86 // RunFunctionWithDelegateAndReturnSingleResult, except with a NULL |
81 // implementation of the Delegate. | 87 // implementation of the Delegate. |
82 base::Value* RunFunctionAndReturnSingleResult( | 88 std::unique_ptr<base::Value> RunFunctionAndReturnSingleResult( |
83 UIThreadExtensionFunction* function, | 89 UIThreadExtensionFunction* function, |
84 const std::string& args, | 90 const std::string& args, |
85 content::BrowserContext* context); | 91 content::BrowserContext* context); |
86 base::Value* RunFunctionAndReturnSingleResult( | 92 std::unique_ptr<base::Value> RunFunctionAndReturnSingleResult( |
87 UIThreadExtensionFunction* function, | 93 UIThreadExtensionFunction* function, |
88 const std::string& args, | 94 const std::string& args, |
89 content::BrowserContext* context, | 95 content::BrowserContext* context, |
90 RunFunctionFlags flags); | 96 RunFunctionFlags flags); |
91 | 97 |
92 // Run |function| with |args| and return the resulting error. Adds an error to | 98 // Run |function| with |args| and return the resulting error. Adds an error to |
93 // the current test if |function| returns a result. Takes ownership of | 99 // the current test if |function| returns a result. Takes ownership of |
94 // |function|. | 100 // |function|. |
95 std::string RunFunctionAndReturnError(UIThreadExtensionFunction* function, | 101 std::string RunFunctionAndReturnError(UIThreadExtensionFunction* function, |
96 const std::string& args, | 102 const std::string& args, |
(...skipping 24 matching lines...) Expand all Loading... |
121 bool RunFunction(UIThreadExtensionFunction* function, | 127 bool RunFunction(UIThreadExtensionFunction* function, |
122 std::unique_ptr<base::ListValue> args, | 128 std::unique_ptr<base::ListValue> args, |
123 content::BrowserContext* context, | 129 content::BrowserContext* context, |
124 std::unique_ptr<ExtensionFunctionDispatcher> dispatcher, | 130 std::unique_ptr<ExtensionFunctionDispatcher> dispatcher, |
125 RunFunctionFlags flags); | 131 RunFunctionFlags flags); |
126 | 132 |
127 } // namespace api_test_utils | 133 } // namespace api_test_utils |
128 } // namespace extensions | 134 } // namespace extensions |
129 | 135 |
130 #endif // EXTENSIONS_BROWSER_API_TEST_UTILS_H_ | 136 #endif // EXTENSIONS_BROWSER_API_TEST_UTILS_H_ |
OLD | NEW |