| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 class ExampleTestShell : public TestShell { | 56 class ExampleTestShell : public TestShell { |
| 57 public: | 57 public: |
| 58 | 58 |
| 59 ExampleTestShell(bool use_fallback_method) { | 59 ExampleTestShell(bool use_fallback_method) { |
| 60 example_bound_class_.set_fallback_method_enabled(use_fallback_method); | 60 example_bound_class_.set_fallback_method_enabled(use_fallback_method); |
| 61 } | 61 } |
| 62 | 62 |
| 63 // When called by WebViewDelegate::WindowObjectCleared method, this binds a | 63 // When called by WebViewDelegate::WindowObjectCleared method, this binds a |
| 64 // CppExampleObject to window.example. | 64 // CppExampleObject to window.example. |
| 65 virtual void BindJSObjectsToWindow(WebFrame* frame) { | 65 virtual void BindJSObjectsToWindow(WebFrame* frame) { |
| 66 example_bound_class_.BindToJavascript(frame, L"example"); | 66 example_bound_class_.BindToJavascript(frame, "example"); |
| 67 // We use the layoutTestController binding for notifyDone. | 67 // We use the layoutTestController binding for notifyDone. |
| 68 TestShell::BindJSObjectsToWindow(frame); | 68 TestShell::BindJSObjectsToWindow(frame); |
| 69 } | 69 } |
| 70 | 70 |
| 71 // This is a public interface to TestShell's protected method, so it | 71 // This is a public interface to TestShell's protected method, so it |
| 72 // can be called by our CreateEmptyWindow. | 72 // can be called by our CreateEmptyWindow. |
| 73 bool PublicInitialize(const std::string& starting_url) { | 73 bool PublicInitialize(const std::string& starting_url) { |
| 74 return Initialize(GURL(starting_url)); | 74 return Initialize(GURL(starting_url)); |
| 75 } | 75 } |
| 76 | 76 |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 | 279 |
| 280 // Ensures existent methods can be invoked successfully when the fallback method | 280 // Ensures existent methods can be invoked successfully when the fallback method |
| 281 // is used | 281 // is used |
| 282 TEST_F(CppBoundClassWithFallbackMethodTest, | 282 TEST_F(CppBoundClassWithFallbackMethodTest, |
| 283 InvokeExistentMethodsWithFallback) { | 283 InvokeExistentMethodsWithFallback) { |
| 284 std::string js = BuildJSCondition("example.echoValue(34)", "34"); | 284 std::string js = BuildJSCondition("example.echoValue(34)", "34"); |
| 285 CheckJavaScriptSuccess(js); | 285 CheckJavaScriptSuccess(js); |
| 286 } | 286 } |
| 287 | 287 |
| 288 } // namespace | 288 } // namespace |
| OLD | NEW |