OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_TEST_UTILS_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_TEST_UTILS_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_TEST_UTILS_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_TEST_UTILS_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 // current test if |function| returns an error. The caller takes ownership of | 62 // current test if |function| returns an error. The caller takes ownership of |
63 // the result. | 63 // the result. |
64 base::Value* RunFunctionAndReturnResult(UIThreadExtensionFunction* function, | 64 base::Value* RunFunctionAndReturnResult(UIThreadExtensionFunction* function, |
65 const std::string& args, | 65 const std::string& args, |
66 Browser* browser, | 66 Browser* browser, |
67 RunFunctionFlags flags); | 67 RunFunctionFlags flags); |
68 base::Value* RunFunctionAndReturnResult(UIThreadExtensionFunction* function, | 68 base::Value* RunFunctionAndReturnResult(UIThreadExtensionFunction* function, |
69 const std::string& args, | 69 const std::string& args, |
70 Browser* browser); | 70 Browser* browser); |
71 | 71 |
| 72 // Run |function| with |args|. Adds an error to the current test if |function| |
| 73 // returns an error, or is passed a result. |
| 74 bool RunFunctionWithoutResult(UIThreadExtensionFunction* function, |
| 75 const std::string& args, |
| 76 Browser* browser, |
| 77 RunFunctionFlags flags); |
| 78 bool RunFunctionWithoutResult(UIThreadExtensionFunction* function, |
| 79 const std::string& args, |
| 80 Browser* browser); |
| 81 |
72 // Create and run |function| with |args|. Works with both synchronous and async | 82 // Create and run |function| with |args|. Works with both synchronous and async |
73 // functions. | 83 // functions. |
74 // | 84 // |
75 // TODO(aa): It would be nice if |args| could be validated against the schema | 85 // TODO(aa): It would be nice if |args| could be validated against the schema |
76 // that |function| expects. That way, we know that we are testing something | 86 // that |function| expects. That way, we know that we are testing something |
77 // close to what the bindings would actually send. | 87 // close to what the bindings would actually send. |
78 // | 88 // |
79 // TODO(aa): I'm concerned that this style won't scale to all the bits and bobs | 89 // TODO(aa): I'm concerned that this style won't scale to all the bits and bobs |
80 // we're going to need to frob for all the different extension functions. But | 90 // we're going to need to frob for all the different extension functions. But |
81 // we can refactor when we see what is needed. | 91 // we can refactor when we see what is needed. |
82 bool RunFunction(UIThreadExtensionFunction* function, | 92 bool RunFunction(UIThreadExtensionFunction* function, |
83 const std::string& args, | 93 const std::string& args, |
84 Browser* browser, | 94 Browser* browser, |
85 RunFunctionFlags flags); | 95 RunFunctionFlags flags); |
86 | 96 |
87 } // namespace extension_function_test_utils | 97 } // namespace extension_function_test_utils |
88 | 98 |
89 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_TEST_UTILS_H_ | 99 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_TEST_UTILS_H_ |
OLD | NEW |