| 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 "chrome/browser/policy/testing_policy_url_fetcher_factory.h" | 5 #include "chrome/browser/policy/testing_policy_url_fetcher_factory.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "chrome/browser/policy/logging_work_scheduler.h" | 8 #include "chrome/browser/policy/logging_work_scheduler.h" |
| 9 #include "googleurl/src/gurl.h" | 9 #include "googleurl/src/gurl.h" |
| 10 #include "googleurl/src/url_parse.h" | 10 #include "googleurl/src/url_parse.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 public: | 38 public: |
| 39 TestingPolicyURLFetcher( | 39 TestingPolicyURLFetcher( |
| 40 const base::WeakPtr<TestingPolicyURLFetcherFactory>& parent, | 40 const base::WeakPtr<TestingPolicyURLFetcherFactory>& parent, |
| 41 const GURL& url, | 41 const GURL& url, |
| 42 URLFetcher::RequestType request_type, | 42 URLFetcher::RequestType request_type, |
| 43 content::URLFetcherDelegate* delegate); | 43 content::URLFetcherDelegate* delegate); |
| 44 | 44 |
| 45 virtual void Start() OVERRIDE; | 45 virtual void Start() OVERRIDE; |
| 46 void Respond(); | 46 void Respond(); |
| 47 | 47 |
| 48 virtual const GURL& url() const { | 48 virtual const GURL& GetUrl() const OVERRIDE { |
| 49 return url_; | 49 return url_; |
| 50 } | 50 } |
| 51 | 51 |
| 52 virtual const net::URLRequestStatus& status() const { | 52 virtual const net::URLRequestStatus& GetStatus() const OVERRIDE { |
| 53 return status_; | 53 return status_; |
| 54 } | 54 } |
| 55 | 55 |
| 56 virtual int response_code() const { | 56 virtual int GetResponseCode() const OVERRIDE { |
| 57 return response_.response_code; | 57 return response_.response_code; |
| 58 } | 58 } |
| 59 | 59 |
| 60 virtual bool GetResponseAsString(std::string* out_response_string) const { | 60 virtual bool GetResponseAsString( |
| 61 std::string* out_response_string) const OVERRIDE { |
| 61 *out_response_string = response_.response_data; | 62 *out_response_string = response_.response_data; |
| 62 return true; | 63 return true; |
| 63 } | 64 } |
| 64 | 65 |
| 65 private: | 66 private: |
| 66 GURL url_; | 67 GURL url_; |
| 67 net::URLRequestStatus status_; | 68 net::URLRequestStatus status_; |
| 68 TestURLResponse response_; | 69 TestURLResponse response_; |
| 69 base::WeakPtr<TestingPolicyURLFetcherFactory> parent_; | 70 base::WeakPtr<TestingPolicyURLFetcherFactory> parent_; |
| 70 | 71 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 URLFetcher* TestingPolicyURLFetcherFactory::CreateURLFetcher( | 131 URLFetcher* TestingPolicyURLFetcherFactory::CreateURLFetcher( |
| 131 int id, | 132 int id, |
| 132 const GURL& url, | 133 const GURL& url, |
| 133 URLFetcher::RequestType request_type, | 134 URLFetcher::RequestType request_type, |
| 134 content::URLFetcherDelegate* delegate) { | 135 content::URLFetcherDelegate* delegate) { |
| 135 return new TestingPolicyURLFetcher( | 136 return new TestingPolicyURLFetcher( |
| 136 weak_ptr_factory_.GetWeakPtr(), url, request_type, delegate); | 137 weak_ptr_factory_.GetWeakPtr(), url, request_type, delegate); |
| 137 } | 138 } |
| 138 | 139 |
| 139 } // namespace policy | 140 } // namespace policy |
| OLD | NEW |