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...) 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...) 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 ENABLE_CLIENT_BASED_GEOLOCATION | |
joth
2010/12/07 10:24:51
if defined() ?
John Knottenbelt
2010/12/07 12:30:04
Good spot!
| |
654 // Ensure a fresh (unset) state for next test run | |
bulach
2010/12/07 11:18:42
comment seems a bit unnecessary.
John Knottenbelt
2010/12/07 12:30:04
Removed.
| |
655 if (geolocation_client_mock_.get()) | |
656 geolocation_client_mock_->resetMock(); | |
657 #endif | |
650 } | 658 } |
651 | 659 |
652 void TestShell::LoadFile(const FilePath& file) { | 660 void TestShell::LoadFile(const FilePath& file) { |
653 LoadURLForFrame(net::FilePathToFileURL(file), std::wstring()); | 661 LoadURLForFrame(net::FilePathToFileURL(file), std::wstring()); |
654 } | 662 } |
655 | 663 |
656 void TestShell::LoadURL(const GURL& url) { | 664 void TestShell::LoadURL(const GURL& url) { |
657 // Used as a sentinal for run_webkit_tests.py to know when to start reading | 665 // 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. | 666 // 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()) | 667 if (layout_test_mode_ && dump_when_finished_ && test_params()) |
(...skipping 119 matching lines...) Loading... | |
779 speech_input_controller_mock_.reset( | 787 speech_input_controller_mock_.reset( |
780 WebKit::WebSpeechInputControllerMock::create(listener)); | 788 WebKit::WebSpeechInputControllerMock::create(listener)); |
781 return speech_input_controller_mock_.get(); | 789 return speech_input_controller_mock_.get(); |
782 } | 790 } |
783 | 791 |
784 WebKit::WebSpeechInputControllerMock* | 792 WebKit::WebSpeechInputControllerMock* |
785 TestShell::speech_input_controller_mock() { | 793 TestShell::speech_input_controller_mock() { |
786 return speech_input_controller_mock_.get(); | 794 return speech_input_controller_mock_.get(); |
787 } | 795 } |
788 | 796 |
797 #if defined(ENABLE_CLIENT_BASED_GEOLOCATION) | |
798 WebKit::WebGeolocationClientMock* TestShell::geolocation_client_mock() { | |
799 if (!geolocation_client_mock_.get()) { | |
800 geolocation_client_mock_.reset( | |
801 WebKit::WebGeolocationClientMock::create()); | |
802 } | |
803 return geolocation_client_mock_.get(); | |
804 } | |
805 #endif | |
806 | |
789 //----------------------------------------------------------------------------- | 807 //----------------------------------------------------------------------------- |
790 | 808 |
791 namespace webkit_glue { | 809 namespace webkit_glue { |
792 | 810 |
793 void PrecacheUrl(const char16* url, int url_length) {} | 811 void PrecacheUrl(const char16* url, int url_length) {} |
794 | 812 |
795 void AppendToLog(const char* file, int line, const char* msg) { | 813 void AppendToLog(const char* file, int line, const char* msg) { |
796 logging::LogMessage(file, line).stream() << msg; | 814 logging::LogMessage(file, line).stream() << msg; |
797 } | 815 } |
798 | 816 |
(...skipping 90 matching lines...) Loading... | |
889 for (size_t j = 0; j < arraysize(kPluginBlackList); ++j) { | 907 for (size_t j = 0; j < arraysize(kPluginBlackList); ++j) { |
890 if (plugin_info.path.BaseName() == FilePath(kPluginBlackList[j])) { | 908 if (plugin_info.path.BaseName() == FilePath(kPluginBlackList[j])) { |
891 NPAPI::PluginList::Singleton()->DisablePlugin(plugin_info.path); | 909 NPAPI::PluginList::Singleton()->DisablePlugin(plugin_info.path); |
892 plugins->erase(plugins->begin() + i); | 910 plugins->erase(plugins->begin() + i); |
893 } | 911 } |
894 } | 912 } |
895 } | 913 } |
896 } | 914 } |
897 | 915 |
898 } // namespace webkit_glue | 916 } // namespace webkit_glue |
OLD | NEW |