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

Side by Side Diff: chrome/browser/policy/cloud/device_management_service_browsertest.cc

Issue 25690003: Refactored the DeviceManagementService to get its parameters from a delegate. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 2 months 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 | Annotate | Revision Log
OLDNEW
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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/bind_helpers.h" 6 #include "base/bind_helpers.h"
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
11 #include "chrome/browser/policy/cloud/cloud_policy_constants.h" 11 #include "chrome/browser/policy/cloud/cloud_policy_constants.h"
12 #include "chrome/browser/policy/cloud/device_management_service.h" 12 #include "chrome/browser/policy/cloud/device_management_service.h"
13 #include "chrome/browser/policy/cloud/mock_device_management_service.h"
13 #include "chrome/browser/policy/cloud/test_request_interceptor.h" 14 #include "chrome/browser/policy/cloud/test_request_interceptor.h"
14 #include "chrome/browser/policy/test/local_policy_test_server.h" 15 #include "chrome/browser/policy/test/local_policy_test_server.h"
15 #include "chrome/test/base/in_process_browser_test.h" 16 #include "chrome/test/base/in_process_browser_test.h"
16 #include "content/public/browser/browser_thread.h" 17 #include "content/public/browser/browser_thread.h"
17 #include "net/base/upload_bytes_element_reader.h" 18 #include "net/base/upload_bytes_element_reader.h"
18 #include "net/base/upload_data_stream.h" 19 #include "net/base/upload_data_stream.h"
19 #include "net/url_request/url_fetcher.h" 20 #include "net/url_request/url_fetcher.h"
20 #include "net/url_request/url_request.h" 21 #include "net/url_request/url_request.h"
21 #include "net/url_request/url_request_context_getter.h" 22 #include "net/url_request/url_request_context_getter.h"
22 #include "net/url_request/url_request_test_job.h" 23 #include "net/url_request/url_request_test_job.h"
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 job->SetClientID("testid"); 134 job->SetClientID("testid");
134 job->GetRequest()->mutable_register_request(); 135 job->GetRequest()->mutable_register_request();
135 job->Start(base::Bind(&DeviceManagementServiceIntegrationTest::OnJobDone, 136 job->Start(base::Bind(&DeviceManagementServiceIntegrationTest::OnJobDone,
136 base::Unretained(this))); 137 base::Unretained(this)));
137 base::MessageLoop::current()->Run(); 138 base::MessageLoop::current()->Run();
138 } 139 }
139 140
140 virtual void SetUpOnMainThread() OVERRIDE { 141 virtual void SetUpOnMainThread() OVERRIDE {
141 std::string service_url((this->*(GetParam()))()); 142 std::string service_url((this->*(GetParam()))());
142 service_.reset(new DeviceManagementService( 143 service_.reset(new DeviceManagementService(
143 g_browser_process->system_request_context(), 144 scoped_ptr<DeviceManagementService::Configuration>(
144 service_url, 145 new MockDeviceManagementServiceConfiguration(service_url)),
145 "UserAgent", 146 g_browser_process->system_request_context()));
146 "UserAgentParam",
147 "PlatformParam"));
148 service_->ScheduleInitialization(0); 147 service_->ScheduleInitialization(0);
149 } 148 }
150 149
151 virtual void CleanUpOnMainThread() OVERRIDE { 150 virtual void CleanUpOnMainThread() OVERRIDE {
152 service_.reset(); 151 service_.reset();
153 test_server_.reset(); 152 test_server_.reset();
154 interceptor_.reset(); 153 interceptor_.reset();
155 } 154 }
156 155
157 void StartTestServer() { 156 void StartTestServer() {
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 base::MessageLoop::current()->Run(); 254 base::MessageLoop::current()->Run();
256 } 255 }
257 256
258 INSTANTIATE_TEST_CASE_P( 257 INSTANTIATE_TEST_CASE_P(
259 DeviceManagementServiceIntegrationTestInstance, 258 DeviceManagementServiceIntegrationTestInstance,
260 DeviceManagementServiceIntegrationTest, 259 DeviceManagementServiceIntegrationTest,
261 testing::Values(&DeviceManagementServiceIntegrationTest::InitCannedResponse, 260 testing::Values(&DeviceManagementServiceIntegrationTest::InitCannedResponse,
262 &DeviceManagementServiceIntegrationTest::InitTestServer)); 261 &DeviceManagementServiceIntegrationTest::InitTestServer));
263 262
264 } // namespace policy 263 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698