| OLD | NEW |
| 1 // Copyright (c) 2011 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 |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "content/public/common/url_fetcher_delegate.h" | |
| 14 #include "content/test/test_url_fetcher_factory.h" | 13 #include "content/test/test_url_fetcher_factory.h" |
| 14 #include "net/url_request/url_fetcher_delegate.h" |
| 15 #include "testing/gmock/include/gmock/gmock.h" | 15 #include "testing/gmock/include/gmock/gmock.h" |
| 16 | 16 |
| 17 class GURL; | 17 class GURL; |
| 18 | 18 |
| 19 namespace enterprise_management { | 19 namespace enterprise_management { |
| 20 class DeviceManagementRequest; | 20 class DeviceManagementRequest; |
| 21 } | 21 } |
| 22 | 22 |
| 23 namespace policy { | 23 namespace policy { |
| 24 | 24 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 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 content::URLFetcher* CreateURLFetcher( |
| 43 int id, | 43 int id, |
| 44 const GURL& url, | 44 const GURL& url, |
| 45 content::URLFetcher::RequestType request_type, | 45 content::URLFetcher::RequestType request_type, |
| 46 content::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, |
| 56 TestURLResponse* response); | 56 TestURLResponse* response); |
| (...skipping 12 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 |