diff options
Diffstat (limited to 'chrome/common/net/test_url_fetcher_factory.h')
-rw-r--r-- | chrome/common/net/test_url_fetcher_factory.h | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/chrome/common/net/test_url_fetcher_factory.h b/chrome/common/net/test_url_fetcher_factory.h index a831e3a..3afa19e 100644 --- a/chrome/common/net/test_url_fetcher_factory.h +++ b/chrome/common/net/test_url_fetcher_factory.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -39,14 +39,17 @@ class TestURLFetcher : public URLFetcher { public: - TestURLFetcher(const GURL& url, RequestType request_type, Delegate* d); - - // Returns the delegate installed on the URLFetcher. - Delegate* delegate() const { return URLFetcher::delegate(); } + TestURLFetcher(int id, + const GURL& url, + RequestType request_type, + Delegate* d); // Overriden to do nothing. It is assumed the caller will notify the delegate. virtual void Start() {} + // Unique ID in our factory. + int id() const { return id_; } + // URL we were created with. Because of how we're using URLFetcher url() // always returns an empty URL. Chances are you'll want to use original_url() // in your tests. @@ -55,7 +58,11 @@ class TestURLFetcher : public URLFetcher { // Returns the data uploaded on this URLFetcher. const std::string& upload_data() const { return URLFetcher::upload_data(); } + // Returns the delegate installed on the URLFetcher. + Delegate* delegate() const { return URLFetcher::delegate(); } + private: + const int id_; const GURL original_url_; DISALLOW_COPY_AND_ASSIGN(TestURLFetcher); @@ -71,8 +78,8 @@ class TestURLFetcherFactory : public URLFetcher::Factory { const GURL& url, URLFetcher::RequestType request_type, URLFetcher::Delegate* d); - TestURLFetcher* GetFetcherByID(int id) const; + void RemoveFetcherFromMap(int id); private: // Maps from id passed to create to the returned URLFetcher. |