| 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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 std::vector<policy::PolicyHeaderIOHelper*> helpers = | 127 std::vector<policy::PolicyHeaderIOHelper*> helpers = |
| 128 policy_header_service->GetHelpersForTest(); | 128 policy_header_service->GetHelpersForTest(); |
| 129 for (std::vector<policy::PolicyHeaderIOHelper*>::const_iterator it = | 129 for (std::vector<policy::PolicyHeaderIOHelper*>::const_iterator it = |
| 130 helpers.begin(); | 130 helpers.begin(); |
| 131 it != helpers.end(); ++it) { | 131 it != helpers.end(); ++it) { |
| 132 (*it)->SetServerURLForTest(dm_url_.spec()); | 132 (*it)->SetServerURLForTest(dm_url_.spec()); |
| 133 (*it)->UpdateHeader(kTestPolicyHeader); | 133 (*it)->UpdateHeader(kTestPolicyHeader); |
| 134 } | 134 } |
| 135 } | 135 } |
| 136 | 136 |
| 137 virtual void CleanUpOnMainThread() OVERRIDE { | 137 virtual void TearDownOnMainThread() OVERRIDE { |
| 138 content::ResourceDispatcherHost::Get()->SetDelegate(NULL); | 138 content::ResourceDispatcherHost::Get()->SetDelegate(NULL); |
| 139 dispatcher_host_delegate_.reset(); | 139 dispatcher_host_delegate_.reset(); |
| 140 InProcessBrowserTest::CleanUpOnMainThread(); | |
| 141 } | 140 } |
| 142 | 141 |
| 143 protected: | 142 protected: |
| 144 // The fake URL for DMServer we are using. | 143 // The fake URL for DMServer we are using. |
| 145 GURL dm_url_; | 144 GURL dm_url_; |
| 146 scoped_ptr<TestDispatcherHostDelegate> dispatcher_host_delegate_; | 145 scoped_ptr<TestDispatcherHostDelegate> dispatcher_host_delegate_; |
| 147 | 146 |
| 148 private: | 147 private: |
| 149 DISALLOW_COPY_AND_ASSIGN(ChromeResourceDispatcherHostDelegateBrowserTest); | 148 DISALLOW_COPY_AND_ASSIGN(ChromeResourceDispatcherHostDelegateBrowserTest); |
| 150 }; | 149 }; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 180 redirect_url += kServerRedirectUrl; | 179 redirect_url += kServerRedirectUrl; |
| 181 redirect_url += "?"; | 180 redirect_url += "?"; |
| 182 redirect_url += dm_url_.spec(); | 181 redirect_url += dm_url_.spec(); |
| 183 ui_test_utils::NavigateToURL(browser(), embedded_test_server()->GetURL( | 182 ui_test_utils::NavigateToURL(browser(), embedded_test_server()->GetURL( |
| 184 redirect_url)); | 183 redirect_url)); |
| 185 std::string value; | 184 std::string value; |
| 186 ASSERT_TRUE(dispatcher_host_delegate_->request_headers_.GetHeader( | 185 ASSERT_TRUE(dispatcher_host_delegate_->request_headers_.GetHeader( |
| 187 policy::kChromePolicyHeader, &value)); | 186 policy::kChromePolicyHeader, &value)); |
| 188 ASSERT_EQ(kTestPolicyHeader, value); | 187 ASSERT_EQ(kTestPolicyHeader, value); |
| 189 } | 188 } |
| OLD | NEW |