| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 /* | 5 /* |
| 6 LayoutTestController class: | 6 LayoutTestController class: |
| 7 Bound to a JavaScript window.layoutTestController object using the | 7 Bound to a JavaScript window.layoutTestController object using the |
| 8 CppBoundClass::BindToJavascript(), this allows layout tests that are run in | 8 CppBoundClass::BindToJavascript(), this allows layout tests that are run in |
| 9 the test_shell (or, in principle, any web page loaded into a client app built | 9 the test_shell (or, in principle, any web page loaded into a client app built |
| 10 with this class) to control various aspects of how the tests are run and what | 10 with this class) to control various aspects of how the tests are run and what |
| 11 sort of output they produce. | 11 sort of output they produce. |
| 12 */ | 12 */ |
| 13 | 13 |
| 14 #ifndef WEBKIT_TOOLS_TEST_SHELL_LAYOUT_TEST_CONTROLLER_H_ | 14 #ifndef WEBKIT_TOOLS_TEST_SHELL_LAYOUT_TEST_CONTROLLER_H_ |
| 15 #define WEBKIT_TOOLS_TEST_SHELL_LAYOUT_TEST_CONTROLLER_H_ | 15 #define WEBKIT_TOOLS_TEST_SHELL_LAYOUT_TEST_CONTROLLER_H_ |
| 16 | 16 |
| 17 #include <queue> | 17 #include <queue> |
| 18 | 18 |
| 19 #include "base/memory/weak_ptr.h" | 19 #include "base/memory/weak_ptr.h" |
| 20 #include "base/timer.h" | 20 #include "base/timer.h" |
| 21 #include "base/string16.h" | 21 #include "base/string16.h" |
| 22 #include "webkit/glue/cpp_bound_class.h" | 22 #include "webkit/glue/cpp_bound_class.h" |
| 23 | 23 |
| 24 class TestShell; | 24 class TestShell; |
| 25 | 25 |
| 26 class LayoutTestController : public CppBoundClass { | 26 class LayoutTestController : public webkit_glue::CppBoundClass { |
| 27 public: | 27 public: |
| 28 // Builds the property and method lists needed to bind this class to a JS | 28 // Builds the property and method lists needed to bind this class to a JS |
| 29 // object. | 29 // object. |
| 30 LayoutTestController(TestShell* shell); | 30 LayoutTestController(TestShell* shell); |
| 31 virtual ~LayoutTestController(); | 31 virtual ~LayoutTestController(); |
| 32 | 32 |
| 33 // By default, tests end when page load is complete. These methods are used | 33 // By default, tests end when page load is complete. These methods are used |
| 34 // to delay the completion of the test until notifyDone is called. | 34 // to delay the completion of the test until notifyDone is called. |
| 35 void waitUntilDone(const CppArgumentList& args, CppVariant* result); | 35 void waitUntilDone(const webkit_glue::CppArgumentList& args, |
| 36 void notifyDone(const CppArgumentList& args, CppVariant* result); | 36 webkit_glue::CppVariant* result); |
| 37 void notifyDone(const webkit_glue::CppArgumentList& args, |
| 38 webkit_glue::CppVariant* result); |
| 37 | 39 |
| 38 // The fallback method is called when a nonexistent method is called on | 40 // The fallback method is called when a nonexistent method is called on |
| 39 // the layout test controller object. | 41 // the layout test controller object. |
| 40 // It is usefull to catch typos in the JavaScript code (a few layout tests | 42 // It is usefull to catch typos in the JavaScript code (a few layout tests |
| 41 // do have typos in them) and it allows the script to continue running in | 43 // do have typos in them) and it allows the script to continue running in |
| 42 // that case (as the Mac does). | 44 // that case (as the Mac does). |
| 43 void fallbackMethod(const CppArgumentList& args, CppVariant* result); | 45 void fallbackMethod(const webkit_glue::CppArgumentList& args, |
| 46 webkit_glue::CppVariant* result); |
| 44 | 47 |
| 45 public: | 48 public: |
| 46 // The following methods are not exposed to JavaScript. | 49 // The following methods are not exposed to JavaScript. |
| 47 void SetWorkQueueFrozen(bool frozen) { work_queue_.set_frozen(frozen); } | 50 void SetWorkQueueFrozen(bool frozen) { work_queue_.set_frozen(frozen); } |
| 48 | 51 |
| 49 bool AcceptsEditing() { return accepts_editing_; } | 52 bool AcceptsEditing() { return accepts_editing_; } |
| 50 bool CanOpenWindows() { return can_open_windows_; } | 53 bool CanOpenWindows() { return can_open_windows_; } |
| 51 bool StopProvisionalFrameLoads() { return stop_provisional_frame_loads_; } | 54 bool StopProvisionalFrameLoads() { return stop_provisional_frame_loads_; } |
| 52 | 55 |
| 53 // Called by the webview delegate when the toplevel frame load is done. | 56 // Called by the webview delegate when the toplevel frame load is done. |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 // DidStartProvisionalLoadForFrame callback. | 136 // DidStartProvisionalLoadForFrame callback. |
| 134 static bool stop_provisional_frame_loads_; | 137 static bool stop_provisional_frame_loads_; |
| 135 | 138 |
| 136 // If true, don't dump output until notifyDone is called. | 139 // If true, don't dump output until notifyDone is called. |
| 137 static bool wait_until_done_; | 140 static bool wait_until_done_; |
| 138 | 141 |
| 139 static WorkQueue work_queue_; | 142 static WorkQueue work_queue_; |
| 140 }; | 143 }; |
| 141 | 144 |
| 142 #endif // WEBKIT_TOOLS_TEST_SHELL_LAYOUT_TEST_CONTROLLER_H_ | 145 #endif // WEBKIT_TOOLS_TEST_SHELL_LAYOUT_TEST_CONTROLLER_H_ |
| OLD | NEW |