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 17 matching lines...) Expand all Loading... |
108 | 115 |
109 // As above, but returns a JSON-serialized version of the value, or | 116 // As above, but returns a JSON-serialized version of the value, or |
110 // "undefined", "null", "function", or "empty". | 117 // "undefined", "null", "function", or "empty". |
111 std::string GetStringPropertyFromObject(v8::Local<v8::Object> object, | 118 std::string GetStringPropertyFromObject(v8::Local<v8::Object> object, |
112 v8::Local<v8::Context> context, | 119 v8::Local<v8::Context> context, |
113 base::StringPiece key); | 120 base::StringPiece key); |
114 | 121 |
115 } // extensions | 122 } // extensions |
116 | 123 |
117 #endif // EXTENSIONS_RENDERER_API_BINDING_TEST_UTIL_H_ | 124 #endif // EXTENSIONS_RENDERER_API_BINDING_TEST_UTIL_H_ |
OLD | NEW |