Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1202)

Side by Side Diff: net/url_request/test_url_fetcher_factory.h

Issue 2487073005: Remove direct usage of BrowserThreadImpl in tests (Closed)
Patch Set: The RDHImpl is actually not even necessary in ResourceSchedulerTest, removed. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/browser/resolve_proxy_msg_helper_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 NET_URL_REQUEST_TEST_URL_FETCHER_FACTORY_H_ 5 #ifndef NET_URL_REQUEST_TEST_URL_FETCHER_FACTORY_H_
6 #define NET_URL_REQUEST_TEST_URL_FETCHER_FACTORY_H_ 6 #define NET_URL_REQUEST_TEST_URL_FETCHER_FACTORY_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <list> 10 #include <list>
(...skipping 27 matching lines...) Expand all
38 DISALLOW_COPY_AND_ASSIGN(ScopedURLFetcherFactory); 38 DISALLOW_COPY_AND_ASSIGN(ScopedURLFetcherFactory);
39 }; 39 };
40 40
41 // TestURLFetcher and TestURLFetcherFactory are used for testing consumers of 41 // TestURLFetcher and TestURLFetcherFactory are used for testing consumers of
42 // URLFetcher. TestURLFetcherFactory is a URLFetcherFactory that creates 42 // URLFetcher. TestURLFetcherFactory is a URLFetcherFactory that creates
43 // TestURLFetchers. TestURLFetcher::Start is overriden to do nothing. It is 43 // TestURLFetchers. TestURLFetcher::Start is overriden to do nothing. It is
44 // expected that you'll grab the delegate from the TestURLFetcher and invoke 44 // expected that you'll grab the delegate from the TestURLFetcher and invoke
45 // the callback method when appropriate. In this way it's easy to mock a 45 // the callback method when appropriate. In this way it's easy to mock a
46 // URLFetcher. 46 // URLFetcher.
47 // Typical usage: 47 // Typical usage:
48 // // TestURLFetcher requires a MessageLoop. 48 // // TestURLFetcher requires a MessageLoop and an IO thread to release
49 // MessageLoop message_loop; 49 // // URLRequestContextGetter in URLFetcher::Core.
50 // // And an IO thread to release URLRequestContextGetter in URLFetcher::Core. 50 // TestBrowserThreadBundle thread_bundle_;
51 // BrowserThreadImpl io_thread(BrowserThread::IO, &message_loop);
52 // // Create factory (it automatically sets itself as URLFetcher's factory). 51 // // Create factory (it automatically sets itself as URLFetcher's factory).
53 // TestURLFetcherFactory factory; 52 // TestURLFetcherFactory factory;
54 // // Do something that triggers creation of a URLFetcher. 53 // // Do something that triggers creation of a URLFetcher.
55 // ... 54 // ...
56 // TestURLFetcher* fetcher = factory.GetFetcherByID(expected_id); 55 // TestURLFetcher* fetcher = factory.GetFetcherByID(expected_id);
57 // DCHECK(fetcher); 56 // DCHECK(fetcher);
58 // // Notify delegate with whatever data you want. 57 // // Notify delegate with whatever data you want.
59 // fetcher->delegate()->OnURLFetchComplete(...); 58 // fetcher->delegate()->OnURLFetchComplete(...);
60 // // Make sure consumer of URLFetcher does the right thing. 59 // // Make sure consumer of URLFetcher does the right thing.
61 // ... 60 // ...
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 std::unique_ptr<URLFetcher> CreateURLFetcher( 468 std::unique_ptr<URLFetcher> CreateURLFetcher(
470 int id, 469 int id,
471 const GURL& url, 470 const GURL& url,
472 URLFetcher::RequestType request_type, 471 URLFetcher::RequestType request_type,
473 URLFetcherDelegate* d) override; 472 URLFetcherDelegate* d) override;
474 }; 473 };
475 474
476 } // namespace net 475 } // namespace net
477 476
478 #endif // NET_URL_REQUEST_TEST_URL_FETCHER_FACTORY_H_ 477 #endif // NET_URL_REQUEST_TEST_URL_FETCHER_FACTORY_H_
OLDNEW
« no previous file with comments | « content/browser/resolve_proxy_msg_helper_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698