OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 16 matching lines...) Expand all Loading... |
27 #include "grit/webkit_strings.h" | 27 #include "grit/webkit_strings.h" |
28 #include "net/base/mime_util.h" | 28 #include "net/base/mime_util.h" |
29 #include "net/base/net_util.h" | 29 #include "net/base/net_util.h" |
30 #include "net/url_request/url_request_file_job.h" | 30 #include "net/url_request/url_request_file_job.h" |
31 #include "net/url_request/url_request_filter.h" | 31 #include "net/url_request/url_request_filter.h" |
32 #include "skia/ext/bitmap_platform_device.h" | 32 #include "skia/ext/bitmap_platform_device.h" |
33 #include "testing/gtest/include/gtest/gtest.h" | 33 #include "testing/gtest/include/gtest/gtest.h" |
34 #include "third_party/skia/include/core/SkBitmap.h" | 34 #include "third_party/skia/include/core/SkBitmap.h" |
35 #include "third_party/WebKit/WebKit/chromium/public/WebAccessibilityObject.h" | 35 #include "third_party/WebKit/WebKit/chromium/public/WebAccessibilityObject.h" |
36 #include "third_party/WebKit/WebKit/chromium/public/WebDeviceOrientationClientMo
ck.h" | 36 #include "third_party/WebKit/WebKit/chromium/public/WebDeviceOrientationClientMo
ck.h" |
| 37 #if defined(ENABLE_CLIENT_BASED_GEOLOCATION) |
| 38 #include "third_party/WebKit/WebKit/chromium/public/WebGeolocationClientMock.h" |
| 39 #endif |
37 #include "third_party/WebKit/WebKit/chromium/public/WebSpeechInputControllerMock
.h" | 40 #include "third_party/WebKit/WebKit/chromium/public/WebSpeechInputControllerMock
.h" |
38 #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" | 41 #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" |
39 #include "third_party/WebKit/WebKit/chromium/public/WebKit.h" | 42 #include "third_party/WebKit/WebKit/chromium/public/WebKit.h" |
40 #include "third_party/WebKit/WebKit/chromium/public/WebScriptController.h" | 43 #include "third_party/WebKit/WebKit/chromium/public/WebScriptController.h" |
41 #include "third_party/WebKit/WebKit/chromium/public/WebRect.h" | 44 #include "third_party/WebKit/WebKit/chromium/public/WebRect.h" |
42 #include "third_party/WebKit/WebKit/chromium/public/WebSize.h" | 45 #include "third_party/WebKit/WebKit/chromium/public/WebSize.h" |
43 #include "third_party/WebKit/WebKit/chromium/public/WebString.h" | 46 #include "third_party/WebKit/WebKit/chromium/public/WebString.h" |
44 #include "third_party/WebKit/WebKit/chromium/public/WebURL.h" | 47 #include "third_party/WebKit/WebKit/chromium/public/WebURL.h" |
45 #include "third_party/WebKit/WebKit/chromium/public/WebURLRequest.h" | 48 #include "third_party/WebKit/WebKit/chromium/public/WebURLRequest.h" |
46 #include "third_party/WebKit/WebKit/chromium/public/WebURLResponse.h" | 49 #include "third_party/WebKit/WebKit/chromium/public/WebURLResponse.h" |
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
640 void TestShell::SizeToDefault() { | 643 void TestShell::SizeToDefault() { |
641 SizeTo(kTestWindowWidth, kTestWindowHeight); | 644 SizeTo(kTestWindowWidth, kTestWindowHeight); |
642 } | 645 } |
643 | 646 |
644 void TestShell::ResetTestController() { | 647 void TestShell::ResetTestController() { |
645 accessibility_controller_->Reset(); | 648 accessibility_controller_->Reset(); |
646 layout_test_controller_->Reset(); | 649 layout_test_controller_->Reset(); |
647 event_sending_controller_->Reset(); | 650 event_sending_controller_->Reset(); |
648 notification_presenter_->Reset(); | 651 notification_presenter_->Reset(); |
649 delegate_->Reset(); | 652 delegate_->Reset(); |
| 653 #if defined(ENABLE_CLIENT_BASED_GEOLOCATION) |
| 654 if (geolocation_client_mock_.get()) |
| 655 geolocation_client_mock_->resetMock(); |
| 656 #endif |
650 } | 657 } |
651 | 658 |
652 void TestShell::LoadFile(const FilePath& file) { | 659 void TestShell::LoadFile(const FilePath& file) { |
653 LoadURLForFrame(net::FilePathToFileURL(file), std::wstring()); | 660 LoadURLForFrame(net::FilePathToFileURL(file), std::wstring()); |
654 } | 661 } |
655 | 662 |
656 void TestShell::LoadURL(const GURL& url) { | 663 void TestShell::LoadURL(const GURL& url) { |
657 // Used as a sentinal for run_webkit_tests.py to know when to start reading | 664 // Used as a sentinal for run_webkit_tests.py to know when to start reading |
658 // test output for this test and so we know we're not getting out of sync. | 665 // test output for this test and so we know we're not getting out of sync. |
659 if (layout_test_mode_ && dump_when_finished_ && test_params()) | 666 if (layout_test_mode_ && dump_when_finished_ && test_params()) |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
779 speech_input_controller_mock_.reset( | 786 speech_input_controller_mock_.reset( |
780 WebKit::WebSpeechInputControllerMock::create(listener)); | 787 WebKit::WebSpeechInputControllerMock::create(listener)); |
781 return speech_input_controller_mock_.get(); | 788 return speech_input_controller_mock_.get(); |
782 } | 789 } |
783 | 790 |
784 WebKit::WebSpeechInputControllerMock* | 791 WebKit::WebSpeechInputControllerMock* |
785 TestShell::speech_input_controller_mock() { | 792 TestShell::speech_input_controller_mock() { |
786 return speech_input_controller_mock_.get(); | 793 return speech_input_controller_mock_.get(); |
787 } | 794 } |
788 | 795 |
| 796 #if defined(ENABLE_CLIENT_BASED_GEOLOCATION) |
| 797 WebKit::WebGeolocationClientMock* TestShell::geolocation_client_mock() { |
| 798 if (!geolocation_client_mock_.get()) { |
| 799 geolocation_client_mock_.reset( |
| 800 WebKit::WebGeolocationClientMock::create()); |
| 801 } |
| 802 return geolocation_client_mock_.get(); |
| 803 } |
| 804 #endif |
| 805 |
789 //----------------------------------------------------------------------------- | 806 //----------------------------------------------------------------------------- |
790 | 807 |
791 namespace webkit_glue { | 808 namespace webkit_glue { |
792 | 809 |
793 void PrecacheUrl(const char16* url, int url_length) {} | 810 void PrecacheUrl(const char16* url, int url_length) {} |
794 | 811 |
795 void AppendToLog(const char* file, int line, const char* msg) { | 812 void AppendToLog(const char* file, int line, const char* msg) { |
796 logging::LogMessage(file, line).stream() << msg; | 813 logging::LogMessage(file, line).stream() << msg; |
797 } | 814 } |
798 | 815 |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
889 for (size_t j = 0; j < arraysize(kPluginBlackList); ++j) { | 906 for (size_t j = 0; j < arraysize(kPluginBlackList); ++j) { |
890 if (plugin_info.path.BaseName() == FilePath(kPluginBlackList[j])) { | 907 if (plugin_info.path.BaseName() == FilePath(kPluginBlackList[j])) { |
891 NPAPI::PluginList::Singleton()->DisablePlugin(plugin_info.path); | 908 NPAPI::PluginList::Singleton()->DisablePlugin(plugin_info.path); |
892 plugins->erase(plugins->begin() + i); | 909 plugins->erase(plugins->begin() + i); |
893 } | 910 } |
894 } | 911 } |
895 } | 912 } |
896 } | 913 } |
897 | 914 |
898 } // namespace webkit_glue | 915 } // namespace webkit_glue |
OLD | NEW |