| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_RENDERER_API_BINDING_TEST_UTIL_H_ | 5 #ifndef EXTENSIONS_RENDERER_API_BINDING_TEST_UTIL_H_ |
| 6 #define EXTENSIONS_RENDERER_API_BINDING_TEST_UTIL_H_ | 6 #define EXTENSIONS_RENDERER_API_BINDING_TEST_UTIL_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 int argc, | 71 int argc, |
| 72 v8::Local<v8::Value> argv[]); | 72 v8::Local<v8::Value> argv[]); |
| 73 | 73 |
| 74 // Like RunFunctionOnGlobal(), but doesn't return the result. This is useful | 74 // Like RunFunctionOnGlobal(), but doesn't return the result. This is useful |
| 75 // for binding in places a result isn't expected. | 75 // for binding in places a result isn't expected. |
| 76 void RunFunctionOnGlobalAndIgnoreResult(v8::Local<v8::Function> function, | 76 void RunFunctionOnGlobalAndIgnoreResult(v8::Local<v8::Function> function, |
| 77 v8::Local<v8::Context> context, | 77 v8::Local<v8::Context> context, |
| 78 int argc, | 78 int argc, |
| 79 v8::Local<v8::Value> argv[]); | 79 v8::Local<v8::Value> argv[]); |
| 80 | 80 |
| 81 // Like RunFunctionOnGlobal(), but returns a persistent handle for the result. |
| 82 v8::Global<v8::Value> RunFunctionOnGlobalAndReturnHandle( |
| 83 v8::Local<v8::Function> function, |
| 84 v8::Local<v8::Context> context, |
| 85 int argc, |
| 86 v8::Local<v8::Value> argv[]); |
| 87 |
| 81 // Calls the given |function| with the specified |receiver| and arguments, but | 88 // Calls the given |function| with the specified |receiver| and arguments, but |
| 82 // EXPECTs the function to throw the |expected_error|. | 89 // EXPECTs the function to throw the |expected_error|. |
| 83 void RunFunctionAndExpectError(v8::Local<v8::Function> function, | 90 void RunFunctionAndExpectError(v8::Local<v8::Function> function, |
| 84 v8::Local<v8::Context> context, | 91 v8::Local<v8::Context> context, |
| 85 v8::Local<v8::Value> receiver, | 92 v8::Local<v8::Value> receiver, |
| 86 int argc, | 93 int argc, |
| 87 v8::Local<v8::Value> argv[], | 94 v8::Local<v8::Value> argv[], |
| 88 const std::string& expected_error); | 95 const std::string& expected_error); |
| 89 | 96 |
| 90 // Like RunFunctionAndExpectError(), but uses v8::Undefined for the receiver. | 97 // Like RunFunctionAndExpectError(), but uses v8::Undefined for the receiver. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 102 | 109 |
| 103 // As above, but converts the result to a base::Value. | 110 // As above, but converts the result to a base::Value. |
| 104 std::unique_ptr<base::Value> GetBaseValuePropertyFromObject( | 111 std::unique_ptr<base::Value> GetBaseValuePropertyFromObject( |
| 105 v8::Local<v8::Object> object, | 112 v8::Local<v8::Object> object, |
| 106 v8::Local<v8::Context> context, | 113 v8::Local<v8::Context> context, |
| 107 base::StringPiece key); | 114 base::StringPiece key); |
| 108 | 115 |
| 109 } // extensions | 116 } // extensions |
| 110 | 117 |
| 111 #endif // EXTENSIONS_RENDERER_API_BINDING_TEST_UTIL_H_ | 118 #endif // EXTENSIONS_RENDERER_API_BINDING_TEST_UTIL_H_ |
| OLD | NEW |