| 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 #ifndef CHROME_BROWSER_POLICY_TESTING_POLICY_URL_FETCHER_FACTORY_H_ | 5 #ifndef CHROME_BROWSER_POLICY_TESTING_POLICY_URL_FETCHER_FACTORY_H_ |
| 6 #define CHROME_BROWSER_POLICY_TESTING_POLICY_URL_FETCHER_FACTORY_H_ | 6 #define CHROME_BROWSER_POLICY_TESTING_POLICY_URL_FETCHER_FACTORY_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 }; | 32 }; |
| 33 | 33 |
| 34 // Creates mock URLFetchers whose behavior can be controlled in tests. To do so | 34 // Creates mock URLFetchers whose behavior can be controlled in tests. To do so |
| 35 // set mock expectations on the method |Intercept|. | 35 // set mock expectations on the method |Intercept|. |
| 36 class TestingPolicyURLFetcherFactory : public content::URLFetcherFactory, | 36 class TestingPolicyURLFetcherFactory : public content::URLFetcherFactory, |
| 37 public ScopedURLFetcherFactory { | 37 public ScopedURLFetcherFactory { |
| 38 public: | 38 public: |
| 39 explicit TestingPolicyURLFetcherFactory(EventLogger* logger); | 39 explicit TestingPolicyURLFetcherFactory(EventLogger* logger); |
| 40 virtual ~TestingPolicyURLFetcherFactory(); | 40 virtual ~TestingPolicyURLFetcherFactory(); |
| 41 | 41 |
| 42 virtual content::URLFetcher* CreateURLFetcher( | 42 virtual net::URLFetcher* CreateURLFetcher( |
| 43 int id, | 43 int id, |
| 44 const GURL& url, | 44 const GURL& url, |
| 45 content::URLFetcher::RequestType request_type, | 45 net::URLFetcher::RequestType request_type, |
| 46 net::URLFetcherDelegate* delegate) OVERRIDE; | 46 net::URLFetcherDelegate* delegate) OVERRIDE; |
| 47 | 47 |
| 48 LoggingWorkScheduler* scheduler(); | 48 LoggingWorkScheduler* scheduler(); |
| 49 | 49 |
| 50 // Called back by TestingPolicyURLFetcher objects. Uses |Intercept| to get | 50 // Called back by TestingPolicyURLFetcher objects. Uses |Intercept| to get |
| 51 // the response and notifies |logger_| of a network request event. | 51 // the response and notifies |logger_| of a network request event. |
| 52 void GetResponse( | 52 void GetResponse( |
| 53 const std::string& auth_header, | 53 const std::string& auth_header, |
| 54 const std::string& request_type, | 54 const std::string& request_type, |
| 55 const enterprise_management::DeviceManagementRequest& request, | 55 const enterprise_management::DeviceManagementRequest& request, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 69 scoped_ptr<LoggingWorkScheduler> scheduler_; | 69 scoped_ptr<LoggingWorkScheduler> scheduler_; |
| 70 | 70 |
| 71 base::WeakPtrFactory<TestingPolicyURLFetcherFactory> weak_ptr_factory_; | 71 base::WeakPtrFactory<TestingPolicyURLFetcherFactory> weak_ptr_factory_; |
| 72 | 72 |
| 73 DISALLOW_COPY_AND_ASSIGN(TestingPolicyURLFetcherFactory); | 73 DISALLOW_COPY_AND_ASSIGN(TestingPolicyURLFetcherFactory); |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 } // namespace policy | 76 } // namespace policy |
| 77 | 77 |
| 78 #endif // CHROME_BROWSER_POLICY_TESTING_POLICY_URL_FETCHER_FACTORY_H_ | 78 #endif // CHROME_BROWSER_POLICY_TESTING_POLICY_URL_FETCHER_FACTORY_H_ |
| OLD | NEW |