OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_MOCK_URL_FETCHERS_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_MOCK_URL_FETCHERS_H_ |
| 7 #pragma once |
| 8 |
| 9 #include "base/message_loop.h" |
| 10 #include "chrome/browser/chrome_thread.h" |
| 11 #include "chrome/common/net/url_fetcher.h" |
| 12 #include "googleurl/src/gurl.h" |
| 13 #include "net/url_request/url_request_status.h" |
| 14 |
| 15 namespace chromeos { |
| 16 |
| 17 // Simulates a URL fetch by posting a delayed task. This fetch expects to be |
| 18 // canceled, and fails the test if it is not |
| 19 class ExpectCanceledFetcher : public URLFetcher { |
| 20 public: |
| 21 ExpectCanceledFetcher(bool success, |
| 22 const GURL& url, |
| 23 const std::string& results, |
| 24 URLFetcher::RequestType request_type, |
| 25 URLFetcher::Delegate* d); |
| 26 virtual ~ExpectCanceledFetcher(); |
| 27 |
| 28 void Start(); |
| 29 |
| 30 static void CompleteFetch(); |
| 31 |
| 32 private: |
| 33 CancelableTask* task_; |
| 34 |
| 35 DISALLOW_COPY_AND_ASSIGN(ExpectCanceledFetcher); |
| 36 }; |
| 37 |
| 38 class GotCanceledFetcher : public URLFetcher { |
| 39 public: |
| 40 GotCanceledFetcher(bool success, |
| 41 const GURL& url, |
| 42 const std::string& results, |
| 43 URLFetcher::RequestType request_type, |
| 44 URLFetcher::Delegate* d); |
| 45 virtual ~GotCanceledFetcher(); |
| 46 |
| 47 void Start(); |
| 48 |
| 49 private: |
| 50 GURL url_; |
| 51 |
| 52 DISALLOW_COPY_AND_ASSIGN(GotCanceledFetcher); |
| 53 }; |
| 54 |
| 55 } // namespace chromeos |
| 56 |
| 57 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_MOCK_URL_FETCHERS_H_ |
OLD | NEW |