| 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 "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/strings/string_util.h" | 6 #include "base/strings/string_util.h" |
| 7 #include "chrome/browser/browser_process.h" | 7 #include "chrome/browser/browser_process.h" |
| 8 #include "chrome/browser/policy/cloud/policy_header_service_factory.h" | 8 #include "chrome/browser/policy/cloud/policy_header_service_factory.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.
h" | 10 #include "chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.
h" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 | 98 |
| 99 void SetUpOnMainThread() override { | 99 void SetUpOnMainThread() override { |
| 100 InProcessBrowserTest::SetUpOnMainThread(); | 100 InProcessBrowserTest::SetUpOnMainThread(); |
| 101 // Hook navigations with our delegate. | 101 // Hook navigations with our delegate. |
| 102 dispatcher_host_delegate_.reset(new TestDispatcherHostDelegate); | 102 dispatcher_host_delegate_.reset(new TestDispatcherHostDelegate); |
| 103 content::ResourceDispatcherHost::Get()->SetDelegate( | 103 content::ResourceDispatcherHost::Get()->SetDelegate( |
| 104 dispatcher_host_delegate_.get()); | 104 dispatcher_host_delegate_.get()); |
| 105 | 105 |
| 106 embedded_test_server()->RegisterRequestHandler( | 106 embedded_test_server()->RegisterRequestHandler( |
| 107 base::Bind(&HandleTestRequest)); | 107 base::Bind(&HandleTestRequest)); |
| 108 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 108 ASSERT_TRUE(embedded_test_server()->Start()); |
| 109 // Tell chrome that this is our DM server. | 109 // Tell chrome that this is our DM server. |
| 110 dm_url_ = embedded_test_server()->GetURL("/DeviceManagement"); | 110 dm_url_ = embedded_test_server()->GetURL("/DeviceManagement"); |
| 111 | 111 |
| 112 // At this point, the Profile is already initialized and it's too | 112 // At this point, the Profile is already initialized and it's too |
| 113 // late to set the DMServer URL via command line flags, so directly | 113 // late to set the DMServer URL via command line flags, so directly |
| 114 // inject it to the PolicyHeaderIOHelper. | 114 // inject it to the PolicyHeaderIOHelper. |
| 115 policy::PolicyHeaderService* policy_header_service = | 115 policy::PolicyHeaderService* policy_header_service = |
| 116 policy::PolicyHeaderServiceFactory::GetForBrowserContext( | 116 policy::PolicyHeaderServiceFactory::GetForBrowserContext( |
| 117 browser()->profile()); | 117 browser()->profile()); |
| 118 std::vector<policy::PolicyHeaderIOHelper*> helpers = | 118 std::vector<policy::PolicyHeaderIOHelper*> helpers = |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 redirect_url += kServerRedirectUrl; | 170 redirect_url += kServerRedirectUrl; |
| 171 redirect_url += "?"; | 171 redirect_url += "?"; |
| 172 redirect_url += dm_url_.spec(); | 172 redirect_url += dm_url_.spec(); |
| 173 ui_test_utils::NavigateToURL(browser(), embedded_test_server()->GetURL( | 173 ui_test_utils::NavigateToURL(browser(), embedded_test_server()->GetURL( |
| 174 redirect_url)); | 174 redirect_url)); |
| 175 std::string value; | 175 std::string value; |
| 176 ASSERT_TRUE(dispatcher_host_delegate_->request_headers_.GetHeader( | 176 ASSERT_TRUE(dispatcher_host_delegate_->request_headers_.GetHeader( |
| 177 policy::kChromePolicyHeader, &value)); | 177 policy::kChromePolicyHeader, &value)); |
| 178 ASSERT_EQ(kTestPolicyHeader, value); | 178 ASSERT_EQ(kTestPolicyHeader, value); |
| 179 } | 179 } |
| OLD | NEW |