| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/loader/chrome_resource_dispatcher_host_delegate.h" | 5 #include "chrome/browser/loader/chrome_resource_dispatcher_host_delegate.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 #include "chrome/common/chrome_paths.h" | 33 #include "chrome/common/chrome_paths.h" |
| 34 #include "chrome/common/pref_names.h" | 34 #include "chrome/common/pref_names.h" |
| 35 #include "chrome/test/base/in_process_browser_test.h" | 35 #include "chrome/test/base/in_process_browser_test.h" |
| 36 #include "chrome/test/base/ui_test_utils.h" | 36 #include "chrome/test/base/ui_test_utils.h" |
| 37 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_data
.h" | 37 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_data
.h" |
| 38 #include "components/policy/core/common/cloud/cloud_policy_constants.h" | 38 #include "components/policy/core/common/cloud/cloud_policy_constants.h" |
| 39 #include "components/policy/core/common/cloud/policy_header_io_helper.h" | 39 #include "components/policy/core/common/cloud/policy_header_io_helper.h" |
| 40 #include "components/policy/core/common/cloud/policy_header_service.h" | 40 #include "components/policy/core/common/cloud/policy_header_service.h" |
| 41 #include "components/policy/core/common/policy_switches.h" | 41 #include "components/policy/core/common/policy_switches.h" |
| 42 #include "components/prefs/pref_service.h" | 42 #include "components/prefs/pref_service.h" |
| 43 #include "components/signin/core/browser/signin_header_helper.h" | 43 #include "components/signin/core/browser/chrome_connected_header_helper.h" |
| 44 #include "components/signin/core/common/profile_management_switches.h" | 44 #include "components/signin/core/common/profile_management_switches.h" |
| 45 #include "components/signin/core/common/signin_pref_names.h" | 45 #include "components/signin/core/common/signin_pref_names.h" |
| 46 #include "content/public/browser/browser_context.h" | 46 #include "content/public/browser/browser_context.h" |
| 47 #include "content/public/browser/browser_thread.h" | 47 #include "content/public/browser/browser_thread.h" |
| 48 #include "content/public/browser/navigation_data.h" | 48 #include "content/public/browser/navigation_data.h" |
| 49 #include "content/public/browser/navigation_handle.h" | 49 #include "content/public/browser/navigation_handle.h" |
| 50 #include "content/public/browser/resource_dispatcher_host.h" | 50 #include "content/public/browser/resource_dispatcher_host.h" |
| 51 #include "content/public/browser/resource_dispatcher_host_delegate.h" | 51 #include "content/public/browser/resource_dispatcher_host_delegate.h" |
| 52 #include "content/public/browser/web_contents_observer.h" | 52 #include "content/public/browser/web_contents_observer.h" |
| 53 #include "content/public/test/browser_test_utils.h" | 53 #include "content/public/test/browser_test_utils.h" |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 // request. | 295 // request. |
| 296 ui_test_utils::NavigateToURL(browser(), dm_url_); | 296 ui_test_utils::NavigateToURL(browser(), dm_url_); |
| 297 std::string value; | 297 std::string value; |
| 298 ASSERT_TRUE(dispatcher_host_delegate_->request_headers().GetHeader( | 298 ASSERT_TRUE(dispatcher_host_delegate_->request_headers().GetHeader( |
| 299 policy::kChromePolicyHeader, &value)); | 299 policy::kChromePolicyHeader, &value)); |
| 300 ASSERT_EQ(kTestPolicyHeader, value); | 300 ASSERT_EQ(kTestPolicyHeader, value); |
| 301 } | 301 } |
| 302 | 302 |
| 303 IN_PROC_BROWSER_TEST_F(ChromeResourceDispatcherHostDelegateBrowserTest, | 303 IN_PROC_BROWSER_TEST_F(ChromeResourceDispatcherHostDelegateBrowserTest, |
| 304 PolicyHeaderForRedirect) { | 304 PolicyHeaderForRedirect) { |
| 305 | |
| 306 // Build up a URL that results in a redirect to the DMServer URL to make | 305 // Build up a URL that results in a redirect to the DMServer URL to make |
| 307 // sure the policy header is still added. | 306 // sure the policy header is still added. |
| 308 std::string redirect_url; | 307 std::string redirect_url; |
| 309 redirect_url += kServerRedirectUrl; | 308 redirect_url += kServerRedirectUrl; |
| 310 redirect_url += "?"; | 309 redirect_url += "?"; |
| 311 redirect_url += dm_url_.spec(); | 310 redirect_url += dm_url_.spec(); |
| 312 ui_test_utils::NavigateToURL(browser(), embedded_test_server()->GetURL( | 311 ui_test_utils::NavigateToURL(browser(), embedded_test_server()->GetURL( |
| 313 redirect_url)); | 312 redirect_url)); |
| 314 std::string value; | 313 std::string value; |
| 315 ASSERT_TRUE(dispatcher_host_delegate_->request_headers().GetHeader( | 314 ASSERT_TRUE(dispatcher_host_delegate_->request_headers().GetHeader( |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 DownloadTestObserverNotInProgress download_observer( | 632 DownloadTestObserverNotInProgress download_observer( |
| 634 content::BrowserContext::GetDownloadManager(browser()->profile()), 1); | 633 content::BrowserContext::GetDownloadManager(browser()->profile()), 1); |
| 635 download_observer.StartObserving(); | 634 download_observer.StartObserving(); |
| 636 ui_test_utils::NavigateToURL(browser(), embedded_test_server()->GetURL( | 635 ui_test_utils::NavigateToURL(browser(), embedded_test_server()->GetURL( |
| 637 "/download-anchor-attrib.html")); | 636 "/download-anchor-attrib.html")); |
| 638 download_observer.WaitForFinished(); | 637 download_observer.WaitForFinished(); |
| 639 EXPECT_EQ(1, | 638 EXPECT_EQ(1, |
| 640 GetTimesStandardThrottlesAddedForURL( | 639 GetTimesStandardThrottlesAddedForURL( |
| 641 embedded_test_server()->GetURL("/anchor_download_test.png"))); | 640 embedded_test_server()->GetURL("/anchor_download_test.png"))); |
| 642 } | 641 } |
| OLD | NEW |