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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 216 void DumpSpellCheckCallbacks(); | 216 void DumpSpellCheckCallbacks(); |
| 217 void DumpBackForwardList(); | 217 void DumpBackForwardList(); |
| 218 void DumpSelectionRect(); | 218 void DumpSelectionRect(); |
| 219 void TestRepaint(); | 219 void TestRepaint(); |
| 220 void RepaintSweepHorizontally(); | 220 void RepaintSweepHorizontally(); |
| 221 void SetPrinting(); | 221 void SetPrinting(); |
| 222 void SetShouldStayOnPageAfterHandlingBeforeUnload(bool value); | 222 void SetShouldStayOnPageAfterHandlingBeforeUnload(bool value); |
| 223 void SetWillSendRequestClearHeader(const std::string& header); | 223 void SetWillSendRequestClearHeader(const std::string& header); |
| 224 void DumpResourceRequestPriorities(); | 224 void DumpResourceRequestPriorities(); |
| 225 void SetUseMockTheme(bool use); | 225 void SetUseMockTheme(bool use); |
| 226 void WaitUntilExternalURLLoad(); | |
| 226 void ShowWebInspector(gin::Arguments* args); | 227 void ShowWebInspector(gin::Arguments* args); |
| 227 void CloseWebInspector(); | 228 void CloseWebInspector(); |
| 228 bool IsChooserShown(); | 229 bool IsChooserShown(); |
| 229 void EvaluateInWebInspector(int call_id, const std::string& script); | 230 void EvaluateInWebInspector(int call_id, const std::string& script); |
| 230 void ClearAllDatabases(); | 231 void ClearAllDatabases(); |
| 231 void SetDatabaseQuota(int quota); | 232 void SetDatabaseQuota(int quota); |
| 232 void SetAlwaysAcceptCookies(bool accept); | 233 void SetAlwaysAcceptCookies(bool accept); |
| 233 void SetWindowIsKey(bool value); | 234 void SetWindowIsKey(bool value); |
| 234 std::string PathToLocalResource(const std::string& path); | 235 std::string PathToLocalResource(const std::string& path); |
| 235 void SetBackingScaleFactor(double value, v8::Handle<v8::Function> callback); | 236 void SetBackingScaleFactor(double value, v8::Handle<v8::Function> callback); |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 437 &TestRunnerBindings::RepaintSweepHorizontally) | 438 &TestRunnerBindings::RepaintSweepHorizontally) |
| 438 .SetMethod("setPrinting", &TestRunnerBindings::SetPrinting) | 439 .SetMethod("setPrinting", &TestRunnerBindings::SetPrinting) |
| 439 .SetMethod("setShouldStayOnPageAfterHandlingBeforeUnload", | 440 .SetMethod("setShouldStayOnPageAfterHandlingBeforeUnload", |
| 440 &TestRunnerBindings:: | 441 &TestRunnerBindings:: |
| 441 SetShouldStayOnPageAfterHandlingBeforeUnload) | 442 SetShouldStayOnPageAfterHandlingBeforeUnload) |
| 442 .SetMethod("setWillSendRequestClearHeader", | 443 .SetMethod("setWillSendRequestClearHeader", |
| 443 &TestRunnerBindings::SetWillSendRequestClearHeader) | 444 &TestRunnerBindings::SetWillSendRequestClearHeader) |
| 444 .SetMethod("dumpResourceRequestPriorities", | 445 .SetMethod("dumpResourceRequestPriorities", |
| 445 &TestRunnerBindings::DumpResourceRequestPriorities) | 446 &TestRunnerBindings::DumpResourceRequestPriorities) |
| 446 .SetMethod("setUseMockTheme", &TestRunnerBindings::SetUseMockTheme) | 447 .SetMethod("setUseMockTheme", &TestRunnerBindings::SetUseMockTheme) |
| 448 .SetMethod("waitUntilExternalURLLoad", | |
| 449 &TestRunnerBindings::WaitUntilExternalURLLoad) | |
| 447 .SetMethod("showWebInspector", &TestRunnerBindings::ShowWebInspector) | 450 .SetMethod("showWebInspector", &TestRunnerBindings::ShowWebInspector) |
| 448 .SetMethod("closeWebInspector", &TestRunnerBindings::CloseWebInspector) | 451 .SetMethod("closeWebInspector", &TestRunnerBindings::CloseWebInspector) |
| 449 .SetMethod("isChooserShown", &TestRunnerBindings::IsChooserShown) | 452 .SetMethod("isChooserShown", &TestRunnerBindings::IsChooserShown) |
| 450 .SetMethod("evaluateInWebInspector", | 453 .SetMethod("evaluateInWebInspector", |
| 451 &TestRunnerBindings::EvaluateInWebInspector) | 454 &TestRunnerBindings::EvaluateInWebInspector) |
| 452 .SetMethod("clearAllDatabases", &TestRunnerBindings::ClearAllDatabases) | 455 .SetMethod("clearAllDatabases", &TestRunnerBindings::ClearAllDatabases) |
| 453 .SetMethod("setDatabaseQuota", &TestRunnerBindings::SetDatabaseQuota) | 456 .SetMethod("setDatabaseQuota", &TestRunnerBindings::SetDatabaseQuota) |
| 454 .SetMethod("setAlwaysAcceptCookies", | 457 .SetMethod("setAlwaysAcceptCookies", |
| 455 &TestRunnerBindings::SetAlwaysAcceptCookies) | 458 &TestRunnerBindings::SetAlwaysAcceptCookies) |
| 456 .SetMethod("setWindowIsKey", &TestRunnerBindings::SetWindowIsKey) | 459 .SetMethod("setWindowIsKey", &TestRunnerBindings::SetWindowIsKey) |
| (...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1095 void TestRunnerBindings::DumpResourceRequestPriorities() { | 1098 void TestRunnerBindings::DumpResourceRequestPriorities() { |
| 1096 if (runner_) | 1099 if (runner_) |
| 1097 runner_->DumpResourceRequestPriorities(); | 1100 runner_->DumpResourceRequestPriorities(); |
| 1098 } | 1101 } |
| 1099 | 1102 |
| 1100 void TestRunnerBindings::SetUseMockTheme(bool use) { | 1103 void TestRunnerBindings::SetUseMockTheme(bool use) { |
| 1101 if (runner_) | 1104 if (runner_) |
| 1102 runner_->SetUseMockTheme(use); | 1105 runner_->SetUseMockTheme(use); |
| 1103 } | 1106 } |
| 1104 | 1107 |
| 1108 void TestRunnerBindings::WaitUntilExternalURLLoad() { | |
| 1109 if (runner_) | |
| 1110 runner_->WaitUntilExternalURLLoad(); | |
| 1111 } | |
| 1112 | |
| 1105 void TestRunnerBindings::ShowWebInspector(gin::Arguments* args) { | 1113 void TestRunnerBindings::ShowWebInspector(gin::Arguments* args) { |
| 1106 if (runner_) { | 1114 if (runner_) { |
| 1107 std::string settings; | 1115 std::string settings; |
| 1108 args->GetNext(&settings); | 1116 args->GetNext(&settings); |
| 1109 std::string frontend_url; | 1117 std::string frontend_url; |
| 1110 args->GetNext(&frontend_url); | 1118 args->GetNext(&frontend_url); |
| 1111 runner_->ShowWebInspector(settings, frontend_url); | 1119 runner_->ShowWebInspector(settings, frontend_url); |
| 1112 } | 1120 } |
| 1113 } | 1121 } |
| 1114 | 1122 |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1416 | 1424 |
| 1417 if (page_overlay_) { | 1425 if (page_overlay_) { |
| 1418 web_view_->removePageOverlay(page_overlay_); | 1426 web_view_->removePageOverlay(page_overlay_); |
| 1419 delete page_overlay_; | 1427 delete page_overlay_; |
| 1420 page_overlay_ = NULL; | 1428 page_overlay_ = NULL; |
| 1421 } | 1429 } |
| 1422 } | 1430 } |
| 1423 | 1431 |
| 1424 top_loading_frame_ = NULL; | 1432 top_loading_frame_ = NULL; |
| 1425 wait_until_done_ = false; | 1433 wait_until_done_ = false; |
| 1434 wait_until_external_url_load_ = false; | |
| 1426 policy_delegate_enabled_ = false; | 1435 policy_delegate_enabled_ = false; |
| 1427 policy_delegate_is_permissive_ = false; | 1436 policy_delegate_is_permissive_ = false; |
| 1428 policy_delegate_should_notify_done_ = false; | 1437 policy_delegate_should_notify_done_ = false; |
| 1429 | 1438 |
| 1430 WebSecurityPolicy::resetOriginAccessWhitelists(); | 1439 WebSecurityPolicy::resetOriginAccessWhitelists(); |
| 1431 #if defined(__linux__) || defined(ANDROID) | 1440 #if defined(__linux__) || defined(ANDROID) |
| 1432 WebFontRendering::setSubpixelPositioning(false); | 1441 WebFontRendering::setSubpixelPositioning(false); |
| 1433 #endif | 1442 #endif |
| 1434 | 1443 |
| 1435 if (delegate_) { | 1444 if (delegate_) { |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1636 } | 1645 } |
| 1637 | 1646 |
| 1638 bool TestRunner::isPrinting() const { | 1647 bool TestRunner::isPrinting() const { |
| 1639 return is_printing_; | 1648 return is_printing_; |
| 1640 } | 1649 } |
| 1641 | 1650 |
| 1642 bool TestRunner::shouldStayOnPageAfterHandlingBeforeUnload() const { | 1651 bool TestRunner::shouldStayOnPageAfterHandlingBeforeUnload() const { |
| 1643 return should_stay_on_page_after_handling_before_unload_; | 1652 return should_stay_on_page_after_handling_before_unload_; |
| 1644 } | 1653 } |
| 1645 | 1654 |
| 1655 bool TestRunner::shouldWaitUntilExternalURLLoad() const { | |
| 1656 return wait_until_external_url_load_; | |
| 1657 } | |
| 1658 | |
| 1646 const std::set<std::string>* TestRunner::httpHeadersToClear() const { | 1659 const std::set<std::string>* TestRunner::httpHeadersToClear() const { |
| 1647 return &http_headers_to_clear_; | 1660 return &http_headers_to_clear_; |
| 1648 } | 1661 } |
| 1649 | 1662 |
| 1650 void TestRunner::setTopLoadingFrame(WebFrame* frame, bool clear) { | 1663 void TestRunner::setTopLoadingFrame(WebFrame* frame, bool clear) { |
| 1651 if (frame->top()->view() != web_view_) | 1664 if (frame->top()->view() != web_view_) |
| 1652 return; | 1665 return; |
| 1653 if (!test_is_running_) | 1666 if (!test_is_running_) |
| 1654 return; | 1667 return; |
| 1655 if (clear) { | 1668 if (clear) { |
| (...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2464 | 2477 |
| 2465 void TestRunner::SetUseMockTheme(bool use) { | 2478 void TestRunner::SetUseMockTheme(bool use) { |
| 2466 use_mock_theme_ = use; | 2479 use_mock_theme_ = use; |
| 2467 } | 2480 } |
| 2468 | 2481 |
| 2469 void TestRunner::ShowWebInspector(const std::string& str, | 2482 void TestRunner::ShowWebInspector(const std::string& str, |
| 2470 const std::string& frontend_url) { | 2483 const std::string& frontend_url) { |
| 2471 showDevTools(str, frontend_url); | 2484 showDevTools(str, frontend_url); |
| 2472 } | 2485 } |
| 2473 | 2486 |
| 2487 void TestRunner::WaitUntilExternalURLLoad() { | |
| 2488 wait_until_external_url_load_ = true; | |
| 2489 } | |
| 2490 | |
| 2491 | |
|
jochen (gone - plz use gerrit)
2014/04/24 12:52:49
only one empty line
asanka
2014/04/24 18:23:36
Done.
| |
| 2474 void TestRunner::CloseWebInspector() { | 2492 void TestRunner::CloseWebInspector() { |
| 2475 delegate_->closeDevTools(); | 2493 delegate_->closeDevTools(); |
| 2476 } | 2494 } |
| 2477 | 2495 |
| 2478 bool TestRunner::IsChooserShown() { | 2496 bool TestRunner::IsChooserShown() { |
| 2479 return proxy_->isChooserShown(); | 2497 return proxy_->isChooserShown(); |
| 2480 } | 2498 } |
| 2481 | 2499 |
| 2482 void TestRunner::EvaluateInWebInspector(int call_id, | 2500 void TestRunner::EvaluateInWebInspector(int call_id, |
| 2483 const std::string& script) { | 2501 const std::string& script) { |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2640 } | 2658 } |
| 2641 | 2659 |
| 2642 void TestRunner::DidLosePointerLockInternal() { | 2660 void TestRunner::DidLosePointerLockInternal() { |
| 2643 bool was_locked = pointer_locked_; | 2661 bool was_locked = pointer_locked_; |
| 2644 pointer_locked_ = false; | 2662 pointer_locked_ = false; |
| 2645 if (was_locked) | 2663 if (was_locked) |
| 2646 web_view_->didLosePointerLock(); | 2664 web_view_->didLosePointerLock(); |
| 2647 } | 2665 } |
| 2648 | 2666 |
| 2649 } // namespace content | 2667 } // namespace content |
| OLD | NEW |