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

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

Issue 10855209: Refactoring: ProtocolHandler::MaybeCreateJob takes NetworkDelegate as argument (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Latest merge Created 8 years, 4 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/memory/scoped_ptr.h" 5 #include "base/memory/scoped_ptr.h"
6 #include "base/message_loop.h" 6 #include "base/message_loop.h"
7 #include "base/stl_util.h" 7 #include "base/stl_util.h"
8 #include "chrome/browser/policy/cloud_policy_constants.h" 8 #include "chrome/browser/policy/cloud_policy_constants.h"
9 #include "chrome/browser/policy/device_management_service.h" 9 #include "chrome/browser/policy/device_management_service.h"
10 #include "chrome/test/base/in_process_browser_test.h" 10 #include "chrome/test/base/in_process_browser_test.h"
(...skipping 24 matching lines...) Expand all
35 : service_url_(service_url) { 35 : service_url_(service_url) {
36 net::URLRequest::Deprecated::RegisterRequestInterceptor(this); 36 net::URLRequest::Deprecated::RegisterRequestInterceptor(this);
37 } 37 }
38 38
39 virtual ~CannedResponseInterceptor() { 39 virtual ~CannedResponseInterceptor() {
40 net::URLRequest::Deprecated::UnregisterRequestInterceptor(this); 40 net::URLRequest::Deprecated::UnregisterRequestInterceptor(this);
41 } 41 }
42 42
43 // net::URLRequest::Interceptor overrides. 43 // net::URLRequest::Interceptor overrides.
44 virtual net::URLRequestJob* MaybeIntercept( 44 virtual net::URLRequestJob* MaybeIntercept(
45 net::URLRequest* request) OVERRIDE { 45 net::URLRequest* request,
46 net::NetworkDelegate* network_delegate) OVERRIDE {
46 em::DeviceManagementRequest dm_request; 47 em::DeviceManagementRequest dm_request;
47 net::UploadData* upload = request->get_upload_mutable(); 48 net::UploadData* upload = request->get_upload_mutable();
48 if (request->url().GetOrigin() == service_url_.GetOrigin() && 49 if (request->url().GetOrigin() == service_url_.GetOrigin() &&
49 request->url().path() == service_url_.path() && 50 request->url().path() == service_url_.path() &&
50 upload != NULL && 51 upload != NULL &&
51 upload->elements()->size() == 1) { 52 upload->elements()->size() == 1) {
52 std::string response_data; 53 std::string response_data;
53 ConstructResponse(upload->elements()->at(0).bytes(), 54 ConstructResponse(upload->elements()->at(0).bytes(),
54 upload->elements()->at(0).bytes_length(), 55 upload->elements()->at(0).bytes_length(),
55 &response_data); 56 &response_data);
56 return new net::URLRequestTestJob(request, 57 return new net::URLRequestTestJob(request,
58 network_delegate,
57 net::URLRequestTestJob::test_headers(), 59 net::URLRequestTestJob::test_headers(),
58 response_data, 60 response_data,
59 true); 61 true);
60 } 62 }
61 63
62 return NULL; 64 return NULL;
63 } 65 }
64 66
65 private: 67 private:
66 void ConstructResponse(const char* request_data, 68 void ConstructResponse(const char* request_data,
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 MessageLoop::current()->Run(); 210 MessageLoop::current()->Run();
209 } 211 }
210 212
211 INSTANTIATE_TEST_CASE_P( 213 INSTANTIATE_TEST_CASE_P(
212 DeviceManagementServiceIntegrationTestInstance, 214 DeviceManagementServiceIntegrationTestInstance,
213 DeviceManagementServiceIntegrationTest, 215 DeviceManagementServiceIntegrationTest,
214 testing::Values(&DeviceManagementServiceIntegrationTest::InitCannedResponse, 216 testing::Values(&DeviceManagementServiceIntegrationTest::InitCannedResponse,
215 &DeviceManagementServiceIntegrationTest::InitTestServer)); 217 &DeviceManagementServiceIntegrationTest::InitTestServer));
216 218
217 } // namespace policy 219 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698