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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 delegate_.reset(new TestWebViewDelegate(this)); | 139 delegate_.reset(new TestWebViewDelegate(this)); |
140 popup_delegate_.reset(new TestWebViewDelegate(this)); | 140 popup_delegate_.reset(new TestWebViewDelegate(this)); |
141 layout_test_controller_.reset(new LayoutTestController(this)); | 141 layout_test_controller_.reset(new LayoutTestController(this)); |
142 navigation_controller_.reset(new TestNavigationController(this)); | 142 navigation_controller_.reset(new TestNavigationController(this)); |
143 notification_presenter_.reset(new TestNotificationPresenter(this)); | 143 notification_presenter_.reset(new TestNotificationPresenter(this)); |
144 | 144 |
145 net::URLRequestFilter* filter = net::URLRequestFilter::GetInstance(); | 145 net::URLRequestFilter* filter = net::URLRequestFilter::GetInstance(); |
146 filter->AddHostnameHandler("test-shell-resource", "inspector", | 146 filter->AddHostnameHandler("test-shell-resource", "inspector", |
147 &URLRequestTestShellFileJob::InspectorFactory); | 147 &URLRequestTestShellFileJob::InspectorFactory); |
148 url_util::AddStandardScheme("test-shell-resource"); | 148 url_util::AddStandardScheme("test-shell-resource"); |
| 149 webkit_glue::SetUserAgent("TestShell", false); |
149 } | 150 } |
150 | 151 |
151 TestShell::~TestShell() { | 152 TestShell::~TestShell() { |
152 delegate_->RevokeDragDrop(); | 153 delegate_->RevokeDragDrop(); |
153 | 154 |
154 // DevTools frontend page is supposed to be navigated only once and | 155 // DevTools frontend page is supposed to be navigated only once and |
155 // loading another URL in that Page is an error. | 156 // loading another URL in that Page is an error. |
156 if (!dev_tools_client_.get()) { | 157 if (!dev_tools_client_.get()) { |
157 // Navigate to an empty page to fire all the destruction logic for the | 158 // Navigate to an empty page to fire all the destruction logic for the |
158 // current page. | 159 // current page. |
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
628 | 629 |
629 bool IsProtocolSupportedForMedia(const GURL& url) { | 630 bool IsProtocolSupportedForMedia(const GURL& url) { |
630 if (url.SchemeIsFile() || | 631 if (url.SchemeIsFile() || |
631 url.SchemeIs("http") || | 632 url.SchemeIs("http") || |
632 url.SchemeIs("https") || | 633 url.SchemeIs("https") || |
633 url.SchemeIs("data")) | 634 url.SchemeIs("data")) |
634 return true; | 635 return true; |
635 return false; | 636 return false; |
636 } | 637 } |
637 | 638 |
638 std::string BuildUserAgent(bool mimic_windows) { | |
639 return webkit_glue::BuildUserAgentHelper(mimic_windows, "Chrome/0.0.0.0"); | |
640 } | |
641 | |
642 #if defined(OS_LINUX) | 639 #if defined(OS_LINUX) |
643 int MatchFontWithFallback(const std::string& face, bool bold, | 640 int MatchFontWithFallback(const std::string& face, bool bold, |
644 bool italic, int charset) { | 641 bool italic, int charset) { |
645 return -1; | 642 return -1; |
646 } | 643 } |
647 | 644 |
648 bool GetFontTable(int fd, uint32_t table, uint8_t* output, | 645 bool GetFontTable(int fd, uint32_t table, uint8_t* output, |
649 size_t* output_length) { | 646 size_t* output_length) { |
650 return false; | 647 return false; |
651 } | 648 } |
(...skipping 15 matching lines...) Expand all Loading... |
667 webkit::WebPluginInfo plugin_info = plugins->at(i); | 664 webkit::WebPluginInfo plugin_info = plugins->at(i); |
668 for (size_t j = 0; j < arraysize(kPluginBlackList); ++j) { | 665 for (size_t j = 0; j < arraysize(kPluginBlackList); ++j) { |
669 if (plugin_info.path.BaseName() == FilePath(kPluginBlackList[j])) { | 666 if (plugin_info.path.BaseName() == FilePath(kPluginBlackList[j])) { |
670 plugins->erase(plugins->begin() + i); | 667 plugins->erase(plugins->begin() + i); |
671 } | 668 } |
672 } | 669 } |
673 } | 670 } |
674 } | 671 } |
675 | 672 |
676 } // namespace webkit_glue | 673 } // namespace webkit_glue |
OLD | NEW |