| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 | 47 |
| 48 virtual ~CannedResponseInterceptor() { | 48 virtual ~CannedResponseInterceptor() { |
| 49 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | 49 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
| 50 base::Bind(&Delegate::Unregister)); | 50 base::Bind(&Delegate::Unregister)); |
| 51 } | 51 } |
| 52 | 52 |
| 53 private: | 53 private: |
| 54 class Delegate : public net::URLRequestJobFactory::ProtocolHandler { | 54 class Delegate : public net::URLRequestJobFactory::ProtocolHandler { |
| 55 public: | 55 public: |
| 56 explicit Delegate(const GURL& service_url) : service_url_(service_url) {} | 56 explicit Delegate(const GURL& service_url) : service_url_(service_url) {} |
| 57 ~Delegate() {} | 57 virtual ~Delegate() {} |
| 58 | 58 |
| 59 void Register() { | 59 void Register() { |
| 60 net::URLRequestFilter::GetInstance()->AddHostnameProtocolHandler( | 60 net::URLRequestFilter::GetInstance()->AddHostnameProtocolHandler( |
| 61 "http", "example.com", | 61 "http", "example.com", |
| 62 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>(this)); | 62 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>(this)); |
| 63 } | 63 } |
| 64 | 64 |
| 65 static void Unregister() { | 65 static void Unregister() { |
| 66 net::URLRequestFilter::GetInstance()->RemoveHostnameHandler( | 66 net::URLRequestFilter::GetInstance()->RemoveHostnameHandler( |
| 67 "http", "example.com"); | 67 "http", "example.com"); |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 MessageLoop::current()->Run(); | 243 MessageLoop::current()->Run(); |
| 244 } | 244 } |
| 245 | 245 |
| 246 INSTANTIATE_TEST_CASE_P( | 246 INSTANTIATE_TEST_CASE_P( |
| 247 DeviceManagementServiceIntegrationTestInstance, | 247 DeviceManagementServiceIntegrationTestInstance, |
| 248 DeviceManagementServiceIntegrationTest, | 248 DeviceManagementServiceIntegrationTest, |
| 249 testing::Values(&DeviceManagementServiceIntegrationTest::InitCannedResponse, | 249 testing::Values(&DeviceManagementServiceIntegrationTest::InitCannedResponse, |
| 250 &DeviceManagementServiceIntegrationTest::InitTestServer)); | 250 &DeviceManagementServiceIntegrationTest::InitTestServer)); |
| 251 | 251 |
| 252 } // namespace policy | 252 } // namespace policy |
| OLD | NEW |