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" |
11 #include "content/shell/renderer/test_runner/MockWebSpeechRecognizer.h" | 11 #include "content/shell/renderer/test_runner/MockWebSpeechRecognizer.h" |
12 #include "content/shell/renderer/test_runner/TestInterfaces.h" | 12 #include "content/shell/renderer/test_runner/TestInterfaces.h" |
13 #include "content/shell/renderer/test_runner/WebPermissions.h" | |
14 #include "content/shell/renderer/test_runner/WebTestDelegate.h" | 13 #include "content/shell/renderer/test_runner/WebTestDelegate.h" |
15 #include "content/shell/renderer/test_runner/mock_web_push_client.h" | 14 #include "content/shell/renderer/test_runner/mock_web_push_client.h" |
16 #include "content/shell/renderer/test_runner/notification_presenter.h" | 15 #include "content/shell/renderer/test_runner/notification_presenter.h" |
| 16 #include "content/shell/renderer/test_runner/web_permissions.h" |
17 #include "content/shell/renderer/test_runner/web_test_proxy.h" | 17 #include "content/shell/renderer/test_runner/web_test_proxy.h" |
18 #include "gin/arguments.h" | 18 #include "gin/arguments.h" |
19 #include "gin/array_buffer.h" | 19 #include "gin/array_buffer.h" |
20 #include "gin/handle.h" | 20 #include "gin/handle.h" |
21 #include "gin/object_template_builder.h" | 21 #include "gin/object_template_builder.h" |
22 #include "gin/wrappable.h" | 22 #include "gin/wrappable.h" |
23 #include "third_party/WebKit/public/platform/WebArrayBuffer.h" | 23 #include "third_party/WebKit/public/platform/WebArrayBuffer.h" |
24 #include "third_party/WebKit/public/platform/WebBatteryStatus.h" | 24 #include "third_party/WebKit/public/platform/WebBatteryStatus.h" |
25 #include "third_party/WebKit/public/platform/WebCanvas.h" | 25 #include "third_party/WebKit/public/platform/WebCanvas.h" |
26 #include "third_party/WebKit/public/platform/WebData.h" | 26 #include "third_party/WebKit/public/platform/WebData.h" |
(...skipping 1469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1496 weak_factory_(this) {} | 1496 weak_factory_(this) {} |
1497 | 1497 |
1498 TestRunner::~TestRunner() {} | 1498 TestRunner::~TestRunner() {} |
1499 | 1499 |
1500 void TestRunner::Install(WebFrame* frame) { | 1500 void TestRunner::Install(WebFrame* frame) { |
1501 TestRunnerBindings::Install(weak_factory_.GetWeakPtr(), frame); | 1501 TestRunnerBindings::Install(weak_factory_.GetWeakPtr(), frame); |
1502 } | 1502 } |
1503 | 1503 |
1504 void TestRunner::SetDelegate(WebTestDelegate* delegate) { | 1504 void TestRunner::SetDelegate(WebTestDelegate* delegate) { |
1505 delegate_ = delegate; | 1505 delegate_ = delegate; |
1506 web_permissions_->setDelegate(delegate); | 1506 web_permissions_->SetDelegate(delegate); |
1507 notification_presenter_->set_delegate(delegate); | 1507 notification_presenter_->set_delegate(delegate); |
1508 } | 1508 } |
1509 | 1509 |
1510 void TestRunner::SetWebView(WebView* webView, WebTestProxyBase* proxy) { | 1510 void TestRunner::SetWebView(WebView* webView, WebTestProxyBase* proxy) { |
1511 web_view_ = webView; | 1511 web_view_ = webView; |
1512 proxy_ = proxy; | 1512 proxy_ = proxy; |
1513 } | 1513 } |
1514 | 1514 |
1515 void TestRunner::Reset() { | 1515 void TestRunner::Reset() { |
1516 if (web_view_) { | 1516 if (web_view_) { |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1594 | 1594 |
1595 http_headers_to_clear_.clear(); | 1595 http_headers_to_clear_.clear(); |
1596 | 1596 |
1597 global_flag_ = false; | 1597 global_flag_ = false; |
1598 platform_name_ = "chromium"; | 1598 platform_name_ = "chromium"; |
1599 tooltip_text_ = std::string(); | 1599 tooltip_text_ = std::string(); |
1600 disable_notify_done_ = false; | 1600 disable_notify_done_ = false; |
1601 web_history_item_count_ = 0; | 1601 web_history_item_count_ = 0; |
1602 intercept_post_message_ = false; | 1602 intercept_post_message_ = false; |
1603 | 1603 |
1604 web_permissions_->reset(); | 1604 web_permissions_->Reset(); |
1605 | 1605 |
1606 notification_presenter_->Reset(); | 1606 notification_presenter_->Reset(); |
1607 use_mock_theme_ = true; | 1607 use_mock_theme_ = true; |
1608 pointer_locked_ = false; | 1608 pointer_locked_ = false; |
1609 pointer_lock_planned_result_ = PointerLockWillSucceed; | 1609 pointer_lock_planned_result_ = PointerLockWillSucceed; |
1610 | 1610 |
1611 task_list_.revokeAll(); | 1611 task_list_.revokeAll(); |
1612 work_queue_.Reset(); | 1612 work_queue_.Reset(); |
1613 | 1613 |
1614 if (close_remaining_windows_ && delegate_) | 1614 if (close_remaining_windows_ && delegate_) |
(...skipping 931 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2546 | 2546 |
2547 void TestRunner::DumpResourceRequestCallbacks() { | 2547 void TestRunner::DumpResourceRequestCallbacks() { |
2548 dump_resource_request_callbacks_ = true; | 2548 dump_resource_request_callbacks_ = true; |
2549 } | 2549 } |
2550 | 2550 |
2551 void TestRunner::DumpResourceResponseMIMETypes() { | 2551 void TestRunner::DumpResourceResponseMIMETypes() { |
2552 dump_resource_reqponse_mime_types_ = true; | 2552 dump_resource_reqponse_mime_types_ = true; |
2553 } | 2553 } |
2554 | 2554 |
2555 void TestRunner::SetImagesAllowed(bool allowed) { | 2555 void TestRunner::SetImagesAllowed(bool allowed) { |
2556 web_permissions_->setImagesAllowed(allowed); | 2556 web_permissions_->SetImagesAllowed(allowed); |
2557 } | 2557 } |
2558 | 2558 |
2559 void TestRunner::SetMediaAllowed(bool allowed) { | 2559 void TestRunner::SetMediaAllowed(bool allowed) { |
2560 web_permissions_->setMediaAllowed(allowed); | 2560 web_permissions_->SetMediaAllowed(allowed); |
2561 } | 2561 } |
2562 | 2562 |
2563 void TestRunner::SetScriptsAllowed(bool allowed) { | 2563 void TestRunner::SetScriptsAllowed(bool allowed) { |
2564 web_permissions_->setScriptsAllowed(allowed); | 2564 web_permissions_->SetScriptsAllowed(allowed); |
2565 } | 2565 } |
2566 | 2566 |
2567 void TestRunner::SetStorageAllowed(bool allowed) { | 2567 void TestRunner::SetStorageAllowed(bool allowed) { |
2568 web_permissions_->setStorageAllowed(allowed); | 2568 web_permissions_->SetStorageAllowed(allowed); |
2569 } | 2569 } |
2570 | 2570 |
2571 void TestRunner::SetPluginsAllowed(bool allowed) { | 2571 void TestRunner::SetPluginsAllowed(bool allowed) { |
2572 web_permissions_->setPluginsAllowed(allowed); | 2572 web_permissions_->SetPluginsAllowed(allowed); |
2573 } | 2573 } |
2574 | 2574 |
2575 void TestRunner::SetAllowDisplayOfInsecureContent(bool allowed) { | 2575 void TestRunner::SetAllowDisplayOfInsecureContent(bool allowed) { |
2576 web_permissions_->setDisplayingInsecureContentAllowed(allowed); | 2576 web_permissions_->SetDisplayingInsecureContentAllowed(allowed); |
2577 } | 2577 } |
2578 | 2578 |
2579 void TestRunner::SetAllowRunningOfInsecureContent(bool allowed) { | 2579 void TestRunner::SetAllowRunningOfInsecureContent(bool allowed) { |
2580 web_permissions_->setRunningInsecureContentAllowed(allowed); | 2580 web_permissions_->SetRunningInsecureContentAllowed(allowed); |
2581 } | 2581 } |
2582 | 2582 |
2583 void TestRunner::DumpPermissionClientCallbacks() { | 2583 void TestRunner::DumpPermissionClientCallbacks() { |
2584 web_permissions_->setDumpCallbacks(true); | 2584 web_permissions_->SetDumpCallbacks(true); |
2585 } | 2585 } |
2586 | 2586 |
2587 void TestRunner::DumpWindowStatusChanges() { | 2587 void TestRunner::DumpWindowStatusChanges() { |
2588 dump_window_status_changes_ = true; | 2588 dump_window_status_changes_ = true; |
2589 } | 2589 } |
2590 | 2590 |
2591 void TestRunner::DumpProgressFinishedCallback() { | 2591 void TestRunner::DumpProgressFinishedCallback() { |
2592 dump_progress_finished_callback_ = true; | 2592 dump_progress_finished_callback_ = true; |
2593 } | 2593 } |
2594 | 2594 |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2842 } | 2842 } |
2843 | 2843 |
2844 void TestRunner::DidLosePointerLockInternal() { | 2844 void TestRunner::DidLosePointerLockInternal() { |
2845 bool was_locked = pointer_locked_; | 2845 bool was_locked = pointer_locked_; |
2846 pointer_locked_ = false; | 2846 pointer_locked_ = false; |
2847 if (was_locked) | 2847 if (was_locked) |
2848 web_view_->didLosePointerLock(); | 2848 web_view_->didLosePointerLock(); |
2849 } | 2849 } |
2850 | 2850 |
2851 } // namespace content | 2851 } // namespace content |
OLD | NEW |