OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/message_loop.h" | 5 #include "base/message_loop.h" |
6 #include "chrome/browser/policy/device_management_backend_mock.h" | 6 #include "chrome/browser/policy/device_management_backend_mock.h" |
7 #include "chrome/browser/policy/device_management_service.h" | 7 #include "chrome/browser/policy/device_management_service.h" |
8 #include "chrome/browser/policy/proto/device_management_constants.h" | 8 #include "chrome/browser/policy/proto/device_management_constants.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
11 #include "chrome/test/base/in_process_browser_test.h" | 11 #include "chrome/test/base/in_process_browser_test.h" |
12 #include "content/common/net/url_fetcher.h" | 12 #include "content/public/common/url_fetcher.h" |
13 #include "net/test/test_server.h" | 13 #include "net/test/test_server.h" |
14 #include "net/url_request/url_request.h" | 14 #include "net/url_request/url_request.h" |
15 #include "net/url_request/url_request_test_job.h" | 15 #include "net/url_request/url_request_test_job.h" |
16 #include "testing/gmock/include/gmock/gmock.h" | 16 #include "testing/gmock/include/gmock/gmock.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
18 | 18 |
19 using testing::DoAll; | 19 using testing::DoAll; |
20 using testing::Invoke; | 20 using testing::Invoke; |
21 using testing::InvokeWithoutArgs; | 21 using testing::InvokeWithoutArgs; |
22 using testing::_; | 22 using testing::_; |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 protected: | 83 protected: |
84 std::string token_; | 84 std::string token_; |
85 }; | 85 }; |
86 | 86 |
87 static void QuitMessageLoop() { | 87 static void QuitMessageLoop() { |
88 MessageLoop::current()->Quit(); | 88 MessageLoop::current()->Quit(); |
89 } | 89 } |
90 | 90 |
91 IN_PROC_BROWSER_TEST_F(DeviceManagementServiceIntegrationTest, | 91 IN_PROC_BROWSER_TEST_F(DeviceManagementServiceIntegrationTest, |
92 CannedResponses) { | 92 CannedResponses) { |
93 URLFetcher::SetEnableInterceptionForTests(true); | 93 content::URLFetcher::SetEnableInterceptionForTests(true); |
94 DeviceManagementService service(kServiceUrl); | 94 DeviceManagementService service(kServiceUrl); |
95 service.ScheduleInitialization(0); | 95 service.ScheduleInitialization(0); |
96 scoped_ptr<DeviceManagementBackend> backend(service.CreateBackend()); | 96 scoped_ptr<DeviceManagementBackend> backend(service.CreateBackend()); |
97 | 97 |
98 { | 98 { |
99 CannedResponseInterceptor interceptor( | 99 CannedResponseInterceptor interceptor( |
100 GURL(kServiceUrl), PROTO_STRING(kServiceResponseRegister)); | 100 GURL(kServiceUrl), PROTO_STRING(kServiceResponseRegister)); |
101 DeviceRegisterResponseDelegateMock delegate; | 101 DeviceRegisterResponseDelegateMock delegate; |
102 EXPECT_CALL(delegate, HandleRegisterResponse(_)) | 102 EXPECT_CALL(delegate, HandleRegisterResponse(_)) |
103 .WillOnce(DoAll(Invoke(this, &DeviceManagementServiceIntegrationTest | 103 .WillOnce(DoAll(Invoke(this, &DeviceManagementServiceIntegrationTest |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 EXPECT_CALL(delegate, HandleUnregisterResponse(_)) | 185 EXPECT_CALL(delegate, HandleUnregisterResponse(_)) |
186 .WillOnce(InvokeWithoutArgs(QuitMessageLoop)); | 186 .WillOnce(InvokeWithoutArgs(QuitMessageLoop)); |
187 em::DeviceUnregisterRequest request; | 187 em::DeviceUnregisterRequest request; |
188 backend->ProcessUnregisterRequest(token_, "testid", request, &delegate); | 188 backend->ProcessUnregisterRequest(token_, "testid", request, &delegate); |
189 | 189 |
190 MessageLoop::current()->Run(); | 190 MessageLoop::current()->Run(); |
191 } | 191 } |
192 } | 192 } |
193 | 193 |
194 } // namespace policy | 194 } // namespace policy |
OLD | NEW |