OLD | NEW |
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 26 matching lines...) Expand all Loading... |
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) OVERRIDE { |
46 em::DeviceManagementRequest dm_request; | 46 em::DeviceManagementRequest dm_request; |
47 net::UploadData* upload = request->get_upload(); | 47 net::UploadData* upload = request->get_upload_mutable(); |
48 if (request->url().GetOrigin() == service_url_.GetOrigin() && | 48 if (request->url().GetOrigin() == service_url_.GetOrigin() && |
49 request->url().path() == service_url_.path() && | 49 request->url().path() == service_url_.path() && |
50 upload != NULL && | 50 upload != NULL && |
51 upload->elements()->size() == 1) { | 51 upload->elements()->size() == 1) { |
52 std::string response_data; | 52 std::string response_data; |
53 ConstructResponse(upload->elements()->at(0).bytes(), &response_data); | 53 ConstructResponse(upload->elements()->at(0).bytes(), &response_data); |
54 return new net::URLRequestTestJob(request, | 54 return new net::URLRequestTestJob(request, |
55 net::URLRequestTestJob::test_headers(), | 55 net::URLRequestTestJob::test_headers(), |
56 response_data, | 56 response_data, |
57 true); | 57 true); |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 MessageLoop::current()->Run(); | 206 MessageLoop::current()->Run(); |
207 } | 207 } |
208 | 208 |
209 INSTANTIATE_TEST_CASE_P( | 209 INSTANTIATE_TEST_CASE_P( |
210 DeviceManagementServiceIntegrationTestInstance, | 210 DeviceManagementServiceIntegrationTestInstance, |
211 DeviceManagementServiceIntegrationTest, | 211 DeviceManagementServiceIntegrationTest, |
212 testing::Values(&DeviceManagementServiceIntegrationTest::InitCannedResponse, | 212 testing::Values(&DeviceManagementServiceIntegrationTest::InitCannedResponse, |
213 &DeviceManagementServiceIntegrationTest::InitTestServer)); | 213 &DeviceManagementServiceIntegrationTest::InitTestServer)); |
214 | 214 |
215 } // namespace policy | 215 } // namespace policy |
OLD | NEW |