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 /* | 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 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 // By default, tests end when page load is complete. These methods are used | 73 // By default, tests end when page load is complete. These methods are used |
74 // to delay the completion of the test until notifyDone is called. | 74 // to delay the completion of the test until notifyDone is called. |
75 void waitUntilDone(const CppArgumentList& args, CppVariant* result); | 75 void waitUntilDone(const CppArgumentList& args, CppVariant* result); |
76 void notifyDone(const CppArgumentList& args, CppVariant* result); | 76 void notifyDone(const CppArgumentList& args, CppVariant* result); |
77 | 77 |
78 // Methods for adding actions to the work queue. Used in conjunction with | 78 // Methods for adding actions to the work queue. Used in conjunction with |
79 // waitUntilDone/notifyDone above. | 79 // waitUntilDone/notifyDone above. |
80 void queueBackNavigation(const CppArgumentList& args, CppVariant* result); | 80 void queueBackNavigation(const CppArgumentList& args, CppVariant* result); |
81 void queueForwardNavigation(const CppArgumentList& args, CppVariant* result); | 81 void queueForwardNavigation(const CppArgumentList& args, CppVariant* result); |
82 void queueReload(const CppArgumentList& args, CppVariant* result); | 82 void queueReload(const CppArgumentList& args, CppVariant* result); |
83 void queueScript(const CppArgumentList& args, CppVariant* result); | 83 void queueLoadingScript(const CppArgumentList& args, CppVariant* result); |
| 84 void queueNonLoadingScript(const CppArgumentList& args, CppVariant* result); |
84 void queueLoad(const CppArgumentList& args, CppVariant* result); | 85 void queueLoad(const CppArgumentList& args, CppVariant* result); |
85 | 86 |
86 // Although this is named "objC" to match the Mac version, it actually tests | 87 // Although this is named "objC" to match the Mac version, it actually tests |
87 // the identity of its two arguments in C++. | 88 // the identity of its two arguments in C++. |
88 void objCIdentityIsEqual(const CppArgumentList& args, CppVariant* result); | 89 void objCIdentityIsEqual(const CppArgumentList& args, CppVariant* result); |
89 | 90 |
90 // Gives focus to the window. | 91 // Gives focus to the window. |
91 void setWindowIsKey(const CppArgumentList& args, CppVariant* result); | 92 void setWindowIsKey(const CppArgumentList& args, CppVariant* result); |
92 | 93 |
93 // Method that controls whether pressing Tab key cycles through page elements | 94 // Method that controls whether pressing Tab key cycles through page elements |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 | 208 |
208 // Reinitializes all static values. The Reset() method should be called | 209 // Reinitializes all static values. The Reset() method should be called |
209 // before the start of each test (currently from | 210 // before the start of each test (currently from |
210 // TestShell::RunFileTest). | 211 // TestShell::RunFileTest). |
211 void Reset(); | 212 void Reset(); |
212 | 213 |
213 // A single item in the work queue. | 214 // A single item in the work queue. |
214 class WorkItem { | 215 class WorkItem { |
215 public: | 216 public: |
216 virtual ~WorkItem() {} | 217 virtual ~WorkItem() {} |
217 virtual void Run(TestShell* shell) = 0; | 218 |
| 219 // Returns true if this started a load. |
| 220 virtual bool Run(TestShell* shell) = 0; |
218 }; | 221 }; |
219 | 222 |
220 // Used to clear the value of shell_ from test_shell_tests. | 223 // Used to clear the value of shell_ from test_shell_tests. |
221 static void ClearShell() { shell_ = NULL; } | 224 static void ClearShell() { shell_ = NULL; } |
222 | 225 |
223 private: | 226 private: |
224 friend class WorkItem; | 227 friend class WorkItem; |
225 | 228 |
226 // Helper class for managing events queued by methods like queueLoad or | 229 // Helper class for managing events queued by methods like queueLoad or |
227 // queueScript. | 230 // queueScript. |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 | 318 |
316 static WorkQueue work_queue_; | 319 static WorkQueue work_queue_; |
317 | 320 |
318 static CppVariant globalFlag_; | 321 static CppVariant globalFlag_; |
319 | 322 |
320 // Bound variable counting the number of top URLs visited. | 323 // Bound variable counting the number of top URLs visited. |
321 static CppVariant webHistoryItemCount_; | 324 static CppVariant webHistoryItemCount_; |
322 }; | 325 }; |
323 | 326 |
324 #endif // WEBKIT_TOOLS_TEST_SHELL_LAYOUT_TEST_CONTROLLER_H_ | 327 #endif // WEBKIT_TOOLS_TEST_SHELL_LAYOUT_TEST_CONTROLLER_H_ |
OLD | NEW |