OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #undef LOG | 5 #undef LOG |
6 | 6 |
7 #include "webkit/tools/test_shell/test_shell.h" | 7 #include "webkit/tools/test_shell/test_shell.h" |
8 | 8 |
9 #include "base/base_paths.h" | 9 #include "base/base_paths.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" | 41 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" |
42 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURL.h" | 42 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURL.h" |
43 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLRequest.h" | 43 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLRequest.h" |
44 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLResponse.h" | 44 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLResponse.h" |
45 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 45 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
46 #include "webkit/glue/glue_serialize.h" | 46 #include "webkit/glue/glue_serialize.h" |
47 #include "webkit/glue/webkit_glue.h" | 47 #include "webkit/glue/webkit_glue.h" |
48 #include "webkit/glue/webpreferences.h" | 48 #include "webkit/glue/webpreferences.h" |
49 #include "webkit/plugins/npapi/plugin_list.h" | 49 #include "webkit/plugins/npapi/plugin_list.h" |
50 #include "webkit/plugins/npapi/webplugininfo.h" | 50 #include "webkit/plugins/npapi/webplugininfo.h" |
51 #include "webkit/tools/test_shell/accessibility_controller.h" | |
52 #include "webkit/tools/test_shell/notification_presenter.h" | 51 #include "webkit/tools/test_shell/notification_presenter.h" |
53 #include "webkit/tools/test_shell/simple_resource_loader_bridge.h" | 52 #include "webkit/tools/test_shell/simple_resource_loader_bridge.h" |
54 #include "webkit/tools/test_shell/test_navigation_controller.h" | 53 #include "webkit/tools/test_shell/test_navigation_controller.h" |
55 #include "webkit/tools/test_shell/test_shell_devtools_agent.h" | 54 #include "webkit/tools/test_shell/test_shell_devtools_agent.h" |
56 #include "webkit/tools/test_shell/test_shell_devtools_client.h" | 55 #include "webkit/tools/test_shell/test_shell_devtools_client.h" |
57 #include "webkit/tools/test_shell/test_shell_request_context.h" | 56 #include "webkit/tools/test_shell/test_shell_request_context.h" |
58 #include "webkit/tools/test_shell/test_shell_switches.h" | 57 #include "webkit/tools/test_shell/test_shell_switches.h" |
59 #include "webkit/tools/test_shell/test_webview_delegate.h" | 58 #include "webkit/tools/test_shell/test_webview_delegate.h" |
60 | 59 |
61 using WebKit::WebCanvas; | 60 using WebKit::WebCanvas; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 #if defined(OS_WIN) | 129 #if defined(OS_WIN) |
131 default_edit_wnd_proc_(0), | 130 default_edit_wnd_proc_(0), |
132 #endif | 131 #endif |
133 test_params_(NULL), | 132 test_params_(NULL), |
134 is_modal_(false), | 133 is_modal_(false), |
135 is_loading_(false), | 134 is_loading_(false), |
136 allow_images_(true), | 135 allow_images_(true), |
137 allow_plugins_(true), | 136 allow_plugins_(true), |
138 allow_scripts_(true), | 137 allow_scripts_(true), |
139 dump_stats_table_on_exit_(false) { | 138 dump_stats_table_on_exit_(false) { |
140 accessibility_controller_.reset(new AccessibilityController(this)); | |
141 delegate_.reset(new TestWebViewDelegate(this)); | 139 delegate_.reset(new TestWebViewDelegate(this)); |
142 popup_delegate_.reset(new TestWebViewDelegate(this)); | 140 popup_delegate_.reset(new TestWebViewDelegate(this)); |
143 layout_test_controller_.reset(new LayoutTestController(this)); | 141 layout_test_controller_.reset(new LayoutTestController(this)); |
144 event_sending_controller_.reset(new EventSendingController(this)); | |
145 plain_text_controller_.reset(new PlainTextController(this)); | |
146 text_input_controller_.reset(new TextInputController(this)); | |
147 navigation_controller_.reset(new TestNavigationController(this)); | 142 navigation_controller_.reset(new TestNavigationController(this)); |
148 notification_presenter_.reset(new TestNotificationPresenter(this)); | 143 notification_presenter_.reset(new TestNotificationPresenter(this)); |
149 | 144 |
150 net::URLRequestFilter* filter = net::URLRequestFilter::GetInstance(); | 145 net::URLRequestFilter* filter = net::URLRequestFilter::GetInstance(); |
151 filter->AddHostnameHandler("test-shell-resource", "inspector", | 146 filter->AddHostnameHandler("test-shell-resource", "inspector", |
152 &URLRequestTestShellFileJob::InspectorFactory); | 147 &URLRequestTestShellFileJob::InspectorFactory); |
153 url_util::AddStandardScheme("test-shell-resource"); | 148 url_util::AddStandardScheme("test-shell-resource"); |
154 } | 149 } |
155 | 150 |
156 TestShell::~TestShell() { | 151 TestShell::~TestShell() { |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
547 TestFinished(); | 542 TestFinished(); |
548 } | 543 } |
549 | 544 |
550 void TestShell::Show(WebNavigationPolicy policy) { | 545 void TestShell::Show(WebNavigationPolicy policy) { |
551 delegate_->show(policy); | 546 delegate_->show(policy); |
552 } | 547 } |
553 | 548 |
554 void TestShell::BindJSObjectsToWindow(WebFrame* frame) { | 549 void TestShell::BindJSObjectsToWindow(WebFrame* frame) { |
555 // Only bind the test classes if we're running tests. | 550 // Only bind the test classes if we're running tests. |
556 if (layout_test_mode_) { | 551 if (layout_test_mode_) { |
557 accessibility_controller_->BindToJavascript( | |
558 frame, "accessibilityController"); | |
559 layout_test_controller_->BindToJavascript(frame, "layoutTestController"); | 552 layout_test_controller_->BindToJavascript(frame, "layoutTestController"); |
560 event_sending_controller_->BindToJavascript(frame, "eventSender"); | |
561 plain_text_controller_->BindToJavascript(frame, "plainText"); | |
562 text_input_controller_->BindToJavascript(frame, "textInputController"); | |
563 } | 553 } |
564 } | 554 } |
565 | 555 |
566 void TestShell::DumpBackForwardEntry(int index, string16* result) { | 556 void TestShell::DumpBackForwardEntry(int index, string16* result) { |
567 int current_index = navigation_controller_->GetLastCommittedEntryIndex(); | 557 int current_index = navigation_controller_->GetLastCommittedEntryIndex(); |
568 | 558 |
569 std::string content_state = | 559 std::string content_state = |
570 navigation_controller_->GetEntryAtIndex(index)->GetContentState(); | 560 navigation_controller_->GetEntryAtIndex(index)->GetContentState(); |
571 if (content_state.empty()) { | 561 if (content_state.empty()) { |
572 content_state = webkit_glue::CreateHistoryStateForURL( | 562 content_state = webkit_glue::CreateHistoryStateForURL( |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
637 | 627 |
638 void TestShell::SizeToSVG() { | 628 void TestShell::SizeToSVG() { |
639 SizeTo(kSVGTestWindowWidth, kSVGTestWindowHeight); | 629 SizeTo(kSVGTestWindowWidth, kSVGTestWindowHeight); |
640 } | 630 } |
641 | 631 |
642 void TestShell::SizeToDefault() { | 632 void TestShell::SizeToDefault() { |
643 SizeTo(kTestWindowWidth, kTestWindowHeight); | 633 SizeTo(kTestWindowWidth, kTestWindowHeight); |
644 } | 634 } |
645 | 635 |
646 void TestShell::ResetTestController() { | 636 void TestShell::ResetTestController() { |
647 accessibility_controller_->Reset(); | |
648 layout_test_controller_->Reset(); | 637 layout_test_controller_->Reset(); |
649 event_sending_controller_->Reset(); | |
650 notification_presenter_->Reset(); | 638 notification_presenter_->Reset(); |
651 delegate_->Reset(); | 639 delegate_->Reset(); |
652 if (geolocation_client_mock_.get()) | 640 if (geolocation_client_mock_.get()) |
653 geolocation_client_mock_->resetMock(); | 641 geolocation_client_mock_->resetMock(); |
654 } | 642 } |
655 | 643 |
656 void TestShell::LoadFile(const FilePath& file) { | 644 void TestShell::LoadFile(const FilePath& file) { |
657 LoadURLForFrame(net::FilePathToFileURL(file), std::wstring()); | 645 LoadURLForFrame(net::FilePathToFileURL(file), std::wstring()); |
658 } | 646 } |
659 | 647 |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
907 for (size_t j = 0; j < arraysize(kPluginBlackList); ++j) { | 895 for (size_t j = 0; j < arraysize(kPluginBlackList); ++j) { |
908 if (plugin_info.path.BaseName() == FilePath(kPluginBlackList[j])) { | 896 if (plugin_info.path.BaseName() == FilePath(kPluginBlackList[j])) { |
909 webkit::npapi::PluginList::Singleton()->DisablePlugin(plugin_info.path); | 897 webkit::npapi::PluginList::Singleton()->DisablePlugin(plugin_info.path); |
910 plugins->erase(plugins->begin() + i); | 898 plugins->erase(plugins->begin() + i); |
911 } | 899 } |
912 } | 900 } |
913 } | 901 } |
914 } | 902 } |
915 | 903 |
916 } // namespace webkit_glue | 904 } // namespace webkit_glue |
OLD | NEW |