| 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 <stdint.h> |
| 6 |
| 5 #include "base/bind.h" | 7 #include "base/bind.h" |
| 6 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 7 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| 9 #include "base/stl_util.h" | 11 #include "base/stl_util.h" |
| 10 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
| 11 #include "chrome/browser/policy/cloud/test_request_interceptor.h" | 13 #include "chrome/browser/policy/cloud/test_request_interceptor.h" |
| 12 #include "chrome/browser/policy/test/local_policy_test_server.h" | 14 #include "chrome/browser/policy/test/local_policy_test_server.h" |
| 13 #include "chrome/test/base/in_process_browser_test.h" | 15 #include "chrome/test/base/in_process_browser_test.h" |
| 14 #include "components/policy/core/common/cloud/cloud_policy_constants.h" | 16 #include "components/policy/core/common/cloud/cloud_policy_constants.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 32 | 34 |
| 33 namespace em = enterprise_management; | 35 namespace em = enterprise_management; |
| 34 | 36 |
| 35 namespace policy { | 37 namespace policy { |
| 36 | 38 |
| 37 namespace { | 39 namespace { |
| 38 | 40 |
| 39 // Parses the DeviceManagementRequest in |request_data| and writes a serialized | 41 // Parses the DeviceManagementRequest in |request_data| and writes a serialized |
| 40 // DeviceManagementResponse to |response_data|. | 42 // DeviceManagementResponse to |response_data|. |
| 41 void ConstructResponse(const char* request_data, | 43 void ConstructResponse(const char* request_data, |
| 42 uint64 request_data_length, | 44 uint64_t request_data_length, |
| 43 std::string* response_data) { | 45 std::string* response_data) { |
| 44 em::DeviceManagementRequest request; | 46 em::DeviceManagementRequest request; |
| 45 ASSERT_TRUE(request.ParseFromArray(request_data, request_data_length)); | 47 ASSERT_TRUE(request.ParseFromArray(request_data, request_data_length)); |
| 46 em::DeviceManagementResponse response; | 48 em::DeviceManagementResponse response; |
| 47 if (request.has_register_request()) { | 49 if (request.has_register_request()) { |
| 48 response.mutable_register_response()->set_device_management_token( | 50 response.mutable_register_response()->set_device_management_token( |
| 49 "fake_token"); | 51 "fake_token"); |
| 50 } else if (request.has_service_api_access_request()) { | 52 } else if (request.has_service_api_access_request()) { |
| 51 response.mutable_service_api_access_response()->set_auth_code( | 53 response.mutable_service_api_access_response()->set_auth_code( |
| 52 "fake_auth_code"); | 54 "fake_auth_code"); |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 base::MessageLoop::current()->Run(); | 260 base::MessageLoop::current()->Run(); |
| 259 } | 261 } |
| 260 | 262 |
| 261 INSTANTIATE_TEST_CASE_P( | 263 INSTANTIATE_TEST_CASE_P( |
| 262 DeviceManagementServiceIntegrationTestInstance, | 264 DeviceManagementServiceIntegrationTestInstance, |
| 263 DeviceManagementServiceIntegrationTest, | 265 DeviceManagementServiceIntegrationTest, |
| 264 testing::Values(&DeviceManagementServiceIntegrationTest::InitCannedResponse, | 266 testing::Values(&DeviceManagementServiceIntegrationTest::InitCannedResponse, |
| 265 &DeviceManagementServiceIntegrationTest::InitTestServer)); | 267 &DeviceManagementServiceIntegrationTest::InitTestServer)); |
| 266 | 268 |
| 267 } // namespace policy | 269 } // namespace policy |
| OLD | NEW |