Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "content/shell/renderer/test_runner/test_runner.h" | 5 #include "content/shell/renderer/test_runner/test_runner.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "content/shell/common/test_runner/test_preferences.h" | 10 #include "content/shell/common/test_runner/test_preferences.h" |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 112 | 112 |
| 113 private: | 113 private: |
| 114 explicit TestRunnerBindings( | 114 explicit TestRunnerBindings( |
| 115 base::WeakPtr<TestRunner> controller); | 115 base::WeakPtr<TestRunner> controller); |
| 116 virtual ~TestRunnerBindings(); | 116 virtual ~TestRunnerBindings(); |
| 117 | 117 |
| 118 // gin::Wrappable: | 118 // gin::Wrappable: |
| 119 virtual gin::ObjectTemplateBuilder GetObjectTemplateBuilder( | 119 virtual gin::ObjectTemplateBuilder GetObjectTemplateBuilder( |
| 120 v8::Isolate* isolate) OVERRIDE; | 120 v8::Isolate* isolate) OVERRIDE; |
| 121 | 121 |
| 122 void LogToStderr(const std::string& output); | |
| 122 void NotifyDone(); | 123 void NotifyDone(); |
| 123 void WaitUntilDone(); | 124 void WaitUntilDone(); |
| 124 void QueueBackNavigation(int how_far_back); | 125 void QueueBackNavigation(int how_far_back); |
| 125 void QueueForwardNavigation(int how_far_forward); | 126 void QueueForwardNavigation(int how_far_forward); |
| 126 void QueueReload(); | 127 void QueueReload(); |
| 127 void QueueLoadingScript(const std::string& script); | 128 void QueueLoadingScript(const std::string& script); |
| 128 void QueueNonLoadingScript(const std::string& script); | 129 void QueueNonLoadingScript(const std::string& script); |
| 129 void QueueLoad(gin::Arguments* args); | 130 void QueueLoad(gin::Arguments* args); |
| 130 void QueueLoadHTMLString(gin::Arguments* args); | 131 void QueueLoadHTMLString(gin::Arguments* args); |
| 131 void SetCustomPolicyDelegate(gin::Arguments* args); | 132 void SetCustomPolicyDelegate(gin::Arguments* args); |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 288 | 289 |
| 289 TestRunnerBindings::TestRunnerBindings(base::WeakPtr<TestRunner> runner) | 290 TestRunnerBindings::TestRunnerBindings(base::WeakPtr<TestRunner> runner) |
| 290 : runner_(runner) {} | 291 : runner_(runner) {} |
| 291 | 292 |
| 292 TestRunnerBindings::~TestRunnerBindings() {} | 293 TestRunnerBindings::~TestRunnerBindings() {} |
| 293 | 294 |
| 294 gin::ObjectTemplateBuilder TestRunnerBindings::GetObjectTemplateBuilder( | 295 gin::ObjectTemplateBuilder TestRunnerBindings::GetObjectTemplateBuilder( |
| 295 v8::Isolate* isolate) { | 296 v8::Isolate* isolate) { |
| 296 return gin::Wrappable<TestRunnerBindings>::GetObjectTemplateBuilder(isolate) | 297 return gin::Wrappable<TestRunnerBindings>::GetObjectTemplateBuilder(isolate) |
| 297 // Methods controlling test execution. | 298 // Methods controlling test execution. |
| 299 .SetMethod("logToStderr", &TestRunnerBindings::LogToStderr) | |
| 298 .SetMethod("notifyDone", &TestRunnerBindings::NotifyDone) | 300 .SetMethod("notifyDone", &TestRunnerBindings::NotifyDone) |
| 299 .SetMethod("waitUntilDone", &TestRunnerBindings::WaitUntilDone) | 301 .SetMethod("waitUntilDone", &TestRunnerBindings::WaitUntilDone) |
| 300 .SetMethod("queueBackNavigation", | 302 .SetMethod("queueBackNavigation", |
| 301 &TestRunnerBindings::QueueBackNavigation) | 303 &TestRunnerBindings::QueueBackNavigation) |
| 302 .SetMethod("queueForwardNavigation", | 304 .SetMethod("queueForwardNavigation", |
| 303 &TestRunnerBindings::QueueForwardNavigation) | 305 &TestRunnerBindings::QueueForwardNavigation) |
| 304 .SetMethod("queueReload", &TestRunnerBindings::QueueReload) | 306 .SetMethod("queueReload", &TestRunnerBindings::QueueReload) |
| 305 .SetMethod("queueLoadingScript", &TestRunnerBindings::QueueLoadingScript) | 307 .SetMethod("queueLoadingScript", &TestRunnerBindings::QueueLoadingScript) |
| 306 .SetMethod("queueNonLoadingScript", | 308 .SetMethod("queueNonLoadingScript", |
| 307 &TestRunnerBindings::QueueNonLoadingScript) | 309 &TestRunnerBindings::QueueNonLoadingScript) |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 521 .SetMethod("applicationCacheDiskUsageForOrigin", | 523 .SetMethod("applicationCacheDiskUsageForOrigin", |
| 522 &TestRunnerBindings::NotImplemented) | 524 &TestRunnerBindings::NotImplemented) |
| 523 .SetMethod("abortModal", &TestRunnerBindings::NotImplemented) | 525 .SetMethod("abortModal", &TestRunnerBindings::NotImplemented) |
| 524 | 526 |
| 525 // Aliases. | 527 // Aliases. |
| 526 // Used at fast/dom/assign-to-window-status.html | 528 // Used at fast/dom/assign-to-window-status.html |
| 527 .SetMethod("dumpStatusCallbacks", | 529 .SetMethod("dumpStatusCallbacks", |
| 528 &TestRunnerBindings::DumpWindowStatusChanges); | 530 &TestRunnerBindings::DumpWindowStatusChanges); |
| 529 } | 531 } |
| 530 | 532 |
| 533 void TestRunnerBindings::LogToStderr(const std::string& output) { | |
| 534 if (runner_) | |
|
pfeldman
2014/05/15 14:59:12
Is there a reason to not LOG(ERROR) here?
| |
| 535 runner_->LogToStderr(output); | |
| 536 } | |
| 537 | |
| 531 void TestRunnerBindings::NotifyDone() { | 538 void TestRunnerBindings::NotifyDone() { |
| 532 if (runner_) | 539 if (runner_) |
| 533 runner_->NotifyDone(); | 540 runner_->NotifyDone(); |
| 534 } | 541 } |
| 535 | 542 |
| 536 void TestRunnerBindings::WaitUntilDone() { | 543 void TestRunnerBindings::WaitUntilDone() { |
| 537 if (runner_) | 544 if (runner_) |
| 538 runner_->WaitUntilDone(); | 545 runner_->WaitUntilDone(); |
| 539 } | 546 } |
| 540 | 547 |
| (...skipping 1204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1745 | 1752 |
| 1746 virtual bool Run(WebTestDelegate* delegate, WebView*) OVERRIDE { | 1753 virtual bool Run(WebTestDelegate* delegate, WebView*) OVERRIDE { |
| 1747 delegate->goToOffset(distance_); | 1754 delegate->goToOffset(distance_); |
| 1748 return true; // FIXME: Did it really start a navigation? | 1755 return true; // FIXME: Did it really start a navigation? |
| 1749 } | 1756 } |
| 1750 | 1757 |
| 1751 private: | 1758 private: |
| 1752 int distance_; | 1759 int distance_; |
| 1753 }; | 1760 }; |
| 1754 | 1761 |
| 1762 void TestRunner::LogToStderr(const std::string& output) { | |
| 1763 LOG(ERROR) << output; | |
| 1764 } | |
| 1765 | |
| 1755 void TestRunner::NotifyDone() { | 1766 void TestRunner::NotifyDone() { |
| 1756 if (disable_notify_done_) | 1767 if (disable_notify_done_) |
| 1757 return; | 1768 return; |
| 1758 | 1769 |
| 1759 // Test didn't timeout. Kill the timeout timer. | 1770 // Test didn't timeout. Kill the timeout timer. |
| 1760 taskList()->revokeAll(); | 1771 taskList()->revokeAll(); |
| 1761 | 1772 |
| 1762 CompleteNotifyDone(); | 1773 CompleteNotifyDone(); |
| 1763 } | 1774 } |
| 1764 | 1775 |
| (...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2627 } | 2638 } |
| 2628 | 2639 |
| 2629 void TestRunner::DidLosePointerLockInternal() { | 2640 void TestRunner::DidLosePointerLockInternal() { |
| 2630 bool was_locked = pointer_locked_; | 2641 bool was_locked = pointer_locked_; |
| 2631 pointer_locked_ = false; | 2642 pointer_locked_ = false; |
| 2632 if (was_locked) | 2643 if (was_locked) |
| 2633 web_view_->didLosePointerLock(); | 2644 web_view_->didLosePointerLock(); |
| 2634 } | 2645 } |
| 2635 | 2646 |
| 2636 } // namespace content | 2647 } // namespace content |
| OLD | NEW |