OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 // Tests for CppBoundClass, in conjunction with CppBindingExample. Binds | 5 // Tests for CppBoundClass, in conjunction with CppBindingExample. Binds |
6 // a CppBindingExample class into JavaScript in a custom test shell and tests | 6 // a CppBindingExample class into JavaScript in a custom test shell and tests |
7 // the binding from the outside by loading JS into the shell. | 7 // the binding from the outside by loading JS into the shell. |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 TEST_F(CppBoundClassTest, InvokeMethods) { | 231 TEST_F(CppBoundClassTest, InvokeMethods) { |
232 // The expression on the left is expected to return the value on the right. | 232 // The expression on the left is expected to return the value on the right. |
233 static const std::string tests[] = { | 233 static const std::string tests[] = { |
234 "example.echoValue(true)", "true", | 234 "example.echoValue(true)", "true", |
235 "example.echoValue(13)", "13", | 235 "example.echoValue(13)", "13", |
236 "example.echoValue(2.718)", "2.718", | 236 "example.echoValue(2.718)", "2.718", |
237 "example.echoValue('yes')", "'yes'", | 237 "example.echoValue('yes')", "'yes'", |
238 "example.echoValue()", "null", // Too few arguments | 238 "example.echoValue()", "null", // Too few arguments |
239 | 239 |
240 "example.echoType(false)", "true", | 240 "example.echoType(false)", "true", |
241 // Re-enable after merging r72243. | 241 "example.echoType(19)", "3.14159", |
242 //"example.echoType(19)", "3.14159", | |
243 "example.echoType(9.876)", "3.14159", | 242 "example.echoType(9.876)", "3.14159", |
244 "example.echoType('test string')", "'Success!'", | 243 "example.echoType('test string')", "'Success!'", |
245 "example.echoType()", "null", // Too few arguments | 244 "example.echoType()", "null", // Too few arguments |
246 | 245 |
247 // Comparing floats that aren't integer-valued is usually problematic due | 246 // Comparing floats that aren't integer-valued is usually problematic due |
248 // to rounding, but exact powers of 2 should also be safe. | 247 // to rounding, but exact powers of 2 should also be safe. |
249 "example.plus(2.5, 18.0)", "20.5", | 248 "example.plus(2.5, 18.0)", "20.5", |
250 "example.plus(2, 3.25)", "5.25", | 249 "example.plus(2, 3.25)", "5.25", |
251 "example.plus(2, 3)", "5", | 250 "example.plus(2, 3)", "5", |
252 "example.plus()", "null", // Too few arguments | 251 "example.plus()", "null", // Too few arguments |
(...skipping 27 matching lines...) Expand all Loading... |
280 | 279 |
281 // Ensures existent methods can be invoked successfully when the fallback method | 280 // Ensures existent methods can be invoked successfully when the fallback method |
282 // is used | 281 // is used |
283 TEST_F(CppBoundClassWithFallbackMethodTest, | 282 TEST_F(CppBoundClassWithFallbackMethodTest, |
284 InvokeExistentMethodsWithFallback) { | 283 InvokeExistentMethodsWithFallback) { |
285 std::string js = BuildJSCondition("example.echoValue(34)", "34"); | 284 std::string js = BuildJSCondition("example.echoValue(34)", "34"); |
286 CheckJavaScriptSuccess(js); | 285 CheckJavaScriptSuccess(js); |
287 } | 286 } |
288 | 287 |
289 } // namespace | 288 } // namespace |
OLD | NEW |