Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(111)

Side by Side Diff: chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate_browsertest.cc

Issue 1409163006: Migrating tests to use EmbeddedTestServer (/chrome/browser misc) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698