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" |
11 #include "net/base/upload_data.h" | 11 #include "net/base/upload_data.h" |
12 #include "net/test/test_server.h" | 12 #include "net/test/test_server.h" |
13 #include "net/url_request/url_fetcher.h" | 13 #include "net/url_request/url_fetcher.h" |
14 #include "net/url_request/url_request.h" | 14 #include "net/url_request/url_request.h" |
| 15 #include "net/url_request/url_request_context.h" |
15 #include "net/url_request/url_request_test_job.h" | 16 #include "net/url_request/url_request_test_job.h" |
16 #include "testing/gmock/include/gmock/gmock.h" | 17 #include "testing/gmock/include/gmock/gmock.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
18 | 19 |
19 using testing::DoAll; | 20 using testing::DoAll; |
20 using testing::Invoke; | 21 using testing::Invoke; |
21 using testing::InvokeWithoutArgs; | 22 using testing::InvokeWithoutArgs; |
22 using testing::_; | 23 using testing::_; |
23 | 24 |
24 namespace em = enterprise_management; | 25 namespace em = enterprise_management; |
(...skipping 20 matching lines...) Expand all Loading... |
45 net::URLRequest* request) OVERRIDE { | 46 net::URLRequest* request) 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(), &response_data); | 54 ConstructResponse(upload->elements()->at(0).bytes(), &response_data); |
54 return new net::URLRequestTestJob(request, | 55 return new net::URLRequestTestJob(request, |
| 56 request->context()->network_delegate(), |
55 net::URLRequestTestJob::test_headers(), | 57 net::URLRequestTestJob::test_headers(), |
56 response_data, | 58 response_data, |
57 true); | 59 true); |
58 } | 60 } |
59 | 61 |
60 return NULL; | 62 return NULL; |
61 } | 63 } |
62 | 64 |
63 private: | 65 private: |
64 void ConstructResponse(const std::vector<char>& request_data, | 66 void ConstructResponse(const std::vector<char>& request_data, |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 MessageLoop::current()->Run(); | 208 MessageLoop::current()->Run(); |
207 } | 209 } |
208 | 210 |
209 INSTANTIATE_TEST_CASE_P( | 211 INSTANTIATE_TEST_CASE_P( |
210 DeviceManagementServiceIntegrationTestInstance, | 212 DeviceManagementServiceIntegrationTestInstance, |
211 DeviceManagementServiceIntegrationTest, | 213 DeviceManagementServiceIntegrationTest, |
212 testing::Values(&DeviceManagementServiceIntegrationTest::InitCannedResponse, | 214 testing::Values(&DeviceManagementServiceIntegrationTest::InitCannedResponse, |
213 &DeviceManagementServiceIntegrationTest::InitTestServer)); | 215 &DeviceManagementServiceIntegrationTest::InitTestServer)); |
214 | 216 |
215 } // namespace policy | 217 } // namespace policy |
OLD | NEW |