OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <algorithm> | 5 #include <algorithm> |
6 #include <string> | 6 #include <string> |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 #include "content/public/common/page_transition_types.h" | 115 #include "content/public/common/page_transition_types.h" |
116 #include "content/public/common/process_type.h" | 116 #include "content/public/common/process_type.h" |
117 #include "content/public/common/result_codes.h" | 117 #include "content/public/common/result_codes.h" |
118 #include "content/public/common/url_constants.h" | 118 #include "content/public/common/url_constants.h" |
119 #include "content/public/common/webplugininfo.h" | 119 #include "content/public/common/webplugininfo.h" |
120 #include "content/public/test/browser_test_utils.h" | 120 #include "content/public/test/browser_test_utils.h" |
121 #include "content/public/test/download_test_observer.h" | 121 #include "content/public/test/download_test_observer.h" |
122 #include "content/public/test/mock_notification_observer.h" | 122 #include "content/public/test/mock_notification_observer.h" |
123 #include "content/public/test/test_navigation_observer.h" | 123 #include "content/public/test/test_navigation_observer.h" |
124 #include "content/public/test/test_utils.h" | 124 #include "content/public/test/test_utils.h" |
125 #include "content/test/net/url_request_failed_job.h" | |
126 #include "extensions/browser/extension_host.h" | 125 #include "extensions/browser/extension_host.h" |
127 #include "extensions/browser/extension_system.h" | 126 #include "extensions/browser/extension_system.h" |
128 #include "extensions/browser/process_manager.h" | 127 #include "extensions/browser/process_manager.h" |
129 #include "extensions/browser/uninstall_reason.h" | 128 #include "extensions/browser/uninstall_reason.h" |
130 #include "extensions/common/constants.h" | 129 #include "extensions/common/constants.h" |
131 #include "extensions/common/extension.h" | 130 #include "extensions/common/extension.h" |
132 #include "extensions/common/extension_set.h" | 131 #include "extensions/common/extension_set.h" |
133 #include "net/base/net_errors.h" | 132 #include "net/base/net_errors.h" |
134 #include "net/base/net_util.h" | 133 #include "net/base/net_util.h" |
135 #include "net/base/url_util.h" | 134 #include "net/base/url_util.h" |
136 #include "net/http/http_stream_factory.h" | 135 #include "net/http/http_stream_factory.h" |
| 136 #include "net/test/url_request/url_request_failed_job.h" |
137 #include "net/test/url_request/url_request_mock_http_job.h" | 137 #include "net/test/url_request/url_request_mock_http_job.h" |
138 #include "net/url_request/url_request.h" | 138 #include "net/url_request/url_request.h" |
139 #include "net/url_request/url_request_filter.h" | 139 #include "net/url_request/url_request_filter.h" |
140 #include "policy/policy_constants.h" | 140 #include "policy/policy_constants.h" |
141 #include "testing/gmock/include/gmock/gmock.h" | 141 #include "testing/gmock/include/gmock/gmock.h" |
142 #include "testing/gtest/include/gtest/gtest.h" | 142 #include "testing/gtest/include/gtest/gtest.h" |
143 #include "third_party/WebKit/public/web/WebInputEvent.h" | 143 #include "third_party/WebKit/public/web/WebInputEvent.h" |
144 #include "ui/base/l10n/l10n_util.h" | 144 #include "ui/base/l10n/l10n_util.h" |
145 #include "ui/base/resource/resource_bundle.h" | 145 #include "ui/base/resource/resource_bundle.h" |
146 #include "url/gurl.h" | 146 #include "url/gurl.h" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 EXPECT_TRUE(url.is_valid()); | 239 EXPECT_TRUE(url.is_valid()); |
240 filter->RemoveUrlHandler(url); | 240 filter->RemoveUrlHandler(url); |
241 } | 241 } |
242 } | 242 } |
243 | 243 |
244 // Fails requests using ERR_CONNECTION_RESET. | 244 // Fails requests using ERR_CONNECTION_RESET. |
245 net::URLRequestJob* FailedJobFactory( | 245 net::URLRequestJob* FailedJobFactory( |
246 net::URLRequest* request, | 246 net::URLRequest* request, |
247 net::NetworkDelegate* network_delegate, | 247 net::NetworkDelegate* network_delegate, |
248 const std::string& scheme) { | 248 const std::string& scheme) { |
249 return new content::URLRequestFailedJob( | 249 return new net::URLRequestFailedJob( |
250 request, network_delegate, net::ERR_CONNECTION_RESET); | 250 request, network_delegate, net::ERR_CONNECTION_RESET); |
251 } | 251 } |
252 | 252 |
253 // While |MakeRequestFail| is in scope URLRequests to |host| will fail. | 253 // While |MakeRequestFail| is in scope URLRequests to |host| will fail. |
254 class MakeRequestFail { | 254 class MakeRequestFail { |
255 public: | 255 public: |
256 // Sets up the filter on IO thread such that requests to |host| fail. | 256 // Sets up the filter on IO thread such that requests to |host| fail. |
257 explicit MakeRequestFail(const std::string& host) : host_(host) { | 257 explicit MakeRequestFail(const std::string& host) : host_(host) { |
258 BrowserThread::PostTaskAndReply( | 258 BrowserThread::PostTaskAndReply( |
259 BrowserThread::IO, FROM_HERE, | 259 BrowserThread::IO, FROM_HERE, |
(...skipping 2966 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3226 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( | 3226 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( |
3227 browser2->tab_strip_model()->GetActiveWebContents(), | 3227 browser2->tab_strip_model()->GetActiveWebContents(), |
3228 "domAutomationController.send(window.showModalDialog !== undefined);", | 3228 "domAutomationController.send(window.showModalDialog !== undefined);", |
3229 &result)); | 3229 &result)); |
3230 EXPECT_TRUE(result); | 3230 EXPECT_TRUE(result); |
3231 } | 3231 } |
3232 | 3232 |
3233 #endif // !defined(CHROME_OS) | 3233 #endif // !defined(CHROME_OS) |
3234 | 3234 |
3235 } // namespace policy | 3235 } // namespace policy |
OLD | NEW |