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 "components/policy/core/common/cloud/device_management_service.h" |
| 6 |
5 #include <ostream> | 7 #include <ostream> |
| 8 #include <utility> |
6 #include <vector> | 9 #include <vector> |
7 | 10 |
8 #include "base/bind.h" | 11 #include "base/bind.h" |
9 #include "base/macros.h" | 12 #include "base/macros.h" |
10 #include "base/run_loop.h" | 13 #include "base/run_loop.h" |
11 #include "base/strings/string_split.h" | 14 #include "base/strings/string_split.h" |
12 #include "components/policy/core/common/cloud/cloud_policy_constants.h" | 15 #include "components/policy/core/common/cloud/cloud_policy_constants.h" |
13 #include "components/policy/core/common/cloud/device_management_service.h" | |
14 #include "components/policy/core/common/cloud/mock_device_management_service.h" | 16 #include "components/policy/core/common/cloud/mock_device_management_service.h" |
15 #include "net/base/escape.h" | 17 #include "net/base/escape.h" |
16 #include "net/base/load_flags.h" | 18 #include "net/base/load_flags.h" |
17 #include "net/base/net_errors.h" | 19 #include "net/base/net_errors.h" |
18 #include "net/http/http_response_headers.h" | 20 #include "net/http/http_response_headers.h" |
19 #include "net/url_request/test_url_fetcher_factory.h" | 21 #include "net/url_request/test_url_fetcher_factory.h" |
20 #include "net/url_request/url_request_status.h" | 22 #include "net/url_request/url_request_status.h" |
21 #include "net/url_request/url_request_test_util.h" | 23 #include "net/url_request/url_request_test_util.h" |
22 #include "testing/gmock/include/gmock/gmock.h" | 24 #include "testing/gmock/include/gmock/gmock.h" |
23 #include "testing/gtest/include/gtest/gtest.h" | 25 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 } | 58 } |
57 | 59 |
58 ~DeviceManagementServiceTestBase() { | 60 ~DeviceManagementServiceTestBase() { |
59 service_.reset(); | 61 service_.reset(); |
60 base::RunLoop().RunUntilIdle(); | 62 base::RunLoop().RunUntilIdle(); |
61 } | 63 } |
62 | 64 |
63 void ResetService() { | 65 void ResetService() { |
64 scoped_ptr<DeviceManagementService::Configuration> configuration( | 66 scoped_ptr<DeviceManagementService::Configuration> configuration( |
65 new MockDeviceManagementServiceConfiguration(kServiceUrl)); | 67 new MockDeviceManagementServiceConfiguration(kServiceUrl)); |
66 service_.reset(new DeviceManagementService(configuration.Pass())); | 68 service_.reset(new DeviceManagementService(std::move(configuration))); |
67 } | 69 } |
68 | 70 |
69 void InitializeService() { | 71 void InitializeService() { |
70 service_->ScheduleInitialization(0); | 72 service_->ScheduleInitialization(0); |
71 base::RunLoop().RunUntilIdle(); | 73 base::RunLoop().RunUntilIdle(); |
72 } | 74 } |
73 | 75 |
74 net::TestURLFetcher* GetFetcher() { | 76 net::TestURLFetcher* GetFetcher() { |
75 return factory_.GetFetcherByID(DeviceManagementService::kURLFetcherID); | 77 return factory_.GetFetcherByID(DeviceManagementService::kURLFetcherID); |
76 } | 78 } |
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
684 EXPECT_CALL(*this, OnJobDone(DM_STATUS_REQUEST_FAILED, _, _)); | 686 EXPECT_CALL(*this, OnJobDone(DM_STATUS_REQUEST_FAILED, _, _)); |
685 EXPECT_CALL(*this, OnJobRetry(_)).Times(0); | 687 EXPECT_CALL(*this, OnJobRetry(_)).Times(0); |
686 fetcher->set_status(net::URLRequestStatus(net::URLRequestStatus::FAILED, | 688 fetcher->set_status(net::URLRequestStatus(net::URLRequestStatus::FAILED, |
687 net::ERR_NETWORK_CHANGED)); | 689 net::ERR_NETWORK_CHANGED)); |
688 fetcher->set_url(GURL(kServiceUrl)); | 690 fetcher->set_url(GURL(kServiceUrl)); |
689 fetcher->delegate()->OnURLFetchComplete(fetcher); | 691 fetcher->delegate()->OnURLFetchComplete(fetcher); |
690 Mock::VerifyAndClearExpectations(this); | 692 Mock::VerifyAndClearExpectations(this); |
691 } | 693 } |
692 | 694 |
693 } // namespace policy | 695 } // namespace policy |
OLD | NEW |