| 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 // This file contains the definition for LayoutTestController. | 5 // This file contains the definition for LayoutTestController. |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "webkit/tools/test_shell/layout_test_controller.h" | 9 #include "webkit/tools/test_shell/layout_test_controller.h" |
| 10 | 10 |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 | 182 |
| 183 void LayoutTestController::WorkQueue::AddWork(WorkItem* work) { | 183 void LayoutTestController::WorkQueue::AddWork(WorkItem* work) { |
| 184 if (frozen_) { | 184 if (frozen_) { |
| 185 delete work; | 185 delete work; |
| 186 return; | 186 return; |
| 187 } | 187 } |
| 188 queue_.push(work); | 188 queue_.push(work); |
| 189 } | 189 } |
| 190 | 190 |
| 191 void LayoutTestController::dumpAsText(const CppArgumentList& args, | 191 void LayoutTestController::dumpAsText(const CppArgumentList& args, |
| 192 CppVariant* result) { | 192 CppVariant* result) { |
| 193 dump_as_text_ = true; | 193 dump_as_text_ = true; |
| 194 result->SetNull(); | 194 result->SetNull(); |
| 195 } | 195 } |
| 196 | 196 |
| 197 void LayoutTestController::dumpEditingCallbacks( | 197 void LayoutTestController::dumpEditingCallbacks( |
| 198 const CppArgumentList& args, CppVariant* result) { | 198 const CppArgumentList& args, CppVariant* result) { |
| 199 dump_editing_callbacks_ = true; | 199 dump_editing_callbacks_ = true; |
| 200 result->SetNull(); | 200 result->SetNull(); |
| 201 } | 201 } |
| 202 | 202 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 if (shell_->layout_test_mode() && wait_until_done_ && | 272 if (shell_->layout_test_mode() && wait_until_done_ && |
| 273 !shell_->delegate()->top_loading_frame() && work_queue_.empty()) { | 273 !shell_->delegate()->top_loading_frame() && work_queue_.empty()) { |
| 274 shell_->TestFinished(); | 274 shell_->TestFinished(); |
| 275 } | 275 } |
| 276 wait_until_done_ = false; | 276 wait_until_done_ = false; |
| 277 result->SetNull(); | 277 result->SetNull(); |
| 278 } | 278 } |
| 279 | 279 |
| 280 class WorkItemBackForward : public LayoutTestController::WorkItem { | 280 class WorkItemBackForward : public LayoutTestController::WorkItem { |
| 281 public: | 281 public: |
| 282 WorkItemBackForward(int distance) : distance_(distance) {} | 282 explicit WorkItemBackForward(int distance) : distance_(distance) {} |
| 283 void Run(TestShell* shell) { | 283 void Run(TestShell* shell) { |
| 284 shell->GoBackOrForward(distance_); | 284 shell->GoBackOrForward(distance_); |
| 285 } | 285 } |
| 286 private: | 286 private: |
| 287 int distance_; | 287 int distance_; |
| 288 }; | 288 }; |
| 289 | 289 |
| 290 void LayoutTestController::queueBackNavigation( | 290 void LayoutTestController::queueBackNavigation( |
| 291 const CppArgumentList& args, CppVariant* result) { | 291 const CppArgumentList& args, CppVariant* result) { |
| 292 if (args.size() > 0 && args[0].isNumber()) | 292 if (args.size() > 0 && args[0].isNumber()) |
| (...skipping 16 matching lines...) Expand all Loading... |
| 309 }; | 309 }; |
| 310 | 310 |
| 311 void LayoutTestController::queueReload( | 311 void LayoutTestController::queueReload( |
| 312 const CppArgumentList& args, CppVariant* result) { | 312 const CppArgumentList& args, CppVariant* result) { |
| 313 work_queue_.AddWork(new WorkItemReload); | 313 work_queue_.AddWork(new WorkItemReload); |
| 314 result->SetNull(); | 314 result->SetNull(); |
| 315 } | 315 } |
| 316 | 316 |
| 317 class WorkItemScript : public LayoutTestController::WorkItem { | 317 class WorkItemScript : public LayoutTestController::WorkItem { |
| 318 public: | 318 public: |
| 319 WorkItemScript(const string& script) : script_(script) {} | 319 explicit WorkItemScript(const string& script) : script_(script) {} |
| 320 void Run(TestShell* shell) { | 320 void Run(TestShell* shell) { |
| 321 wstring url = L"javascript:" + UTF8ToWide(script_); | 321 wstring url = L"javascript:" + UTF8ToWide(script_); |
| 322 shell->LoadURL(url.c_str()); | 322 shell->LoadURL(url.c_str()); |
| 323 } | 323 } |
| 324 private: | 324 private: |
| 325 string script_; | 325 string script_; |
| 326 }; | 326 }; |
| 327 | 327 |
| 328 void LayoutTestController::queueScript( | 328 void LayoutTestController::queueScript( |
| 329 const CppArgumentList& args, CppVariant* result) { | 329 const CppArgumentList& args, CppVariant* result) { |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 656 result->SetNull(); | 656 result->SetNull(); |
| 657 } | 657 } |
| 658 | 658 |
| 659 void LayoutTestController::dumpSelectionRect( | 659 void LayoutTestController::dumpSelectionRect( |
| 660 const CppArgumentList& args, CppVariant* result) { | 660 const CppArgumentList& args, CppVariant* result) { |
| 661 result->SetNull(); | 661 result->SetNull(); |
| 662 } | 662 } |
| 663 | 663 |
| 664 void LayoutTestController::display( | 664 void LayoutTestController::display( |
| 665 const CppArgumentList& args, CppVariant* result) { | 665 const CppArgumentList& args, CppVariant* result) { |
| 666 shell_->webViewHost()->DisplayForRepaint(); |
| 666 result->SetNull(); | 667 result->SetNull(); |
| 667 } | 668 } |
| 668 | 669 |
| 669 void LayoutTestController::testRepaint( | 670 void LayoutTestController::testRepaint( |
| 670 const CppArgumentList& args, CppVariant* result) { | 671 const CppArgumentList& args, CppVariant* result) { |
| 671 result->SetNull(); | 672 result->SetNull(); |
| 672 } | 673 } |
| 673 | 674 |
| 674 void LayoutTestController::repaintSweepHorizontally( | 675 void LayoutTestController::repaintSweepHorizontally( |
| 675 const CppArgumentList& args, CppVariant* result) { | 676 const CppArgumentList& args, CppVariant* result) { |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 716 void LayoutTestController::fallbackMethod( | 717 void LayoutTestController::fallbackMethod( |
| 717 const CppArgumentList& args, CppVariant* result) { | 718 const CppArgumentList& args, CppVariant* result) { |
| 718 std::wstring message(L"JavaScript ERROR: unknown method called on LayoutTestCo
ntroller"); | 719 std::wstring message(L"JavaScript ERROR: unknown method called on LayoutTestCo
ntroller"); |
| 719 if (!shell_->layout_test_mode()) { | 720 if (!shell_->layout_test_mode()) { |
| 720 logging::LogMessage("CONSOLE:", 0).stream() << message; | 721 logging::LogMessage("CONSOLE:", 0).stream() << message; |
| 721 } else { | 722 } else { |
| 722 printf("CONSOLE MESSAGE: %S\n", message.c_str()); | 723 printf("CONSOLE MESSAGE: %S\n", message.c_str()); |
| 723 } | 724 } |
| 724 result->SetNull(); | 725 result->SetNull(); |
| 725 } | 726 } |
| OLD | NEW |