[email protected] | 3b63f8f4 | 2011-03-28 01:54:15 | [diff] [blame] | 1 | // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
[email protected] | cd37033 | 2009-08-26 00:17:22 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
3 | // found in the LICENSE file. | ||||
4 | |||||
[email protected] | 8efa4ba4 | 2013-03-18 21:14:14 | [diff] [blame] | 5 | #ifndef NET_TEST_NET_TEST_SUITE_H_ |
6 | #define NET_TEST_NET_TEST_SUITE_H_ | ||||
[email protected] | cd37033 | 2009-08-26 00:17:22 | [diff] [blame] | 7 | |
danakj | 22f90e7 | 2016-04-16 01:55:40 | [diff] [blame] | 8 | #include <memory> |
9 | |||||
[email protected] | 3b63f8f4 | 2011-03-28 01:54:15 | [diff] [blame] | 10 | #include "base/memory/ref_counted.h" |
[email protected] | fb895c6 | 2009-10-09 18:20:30 | [diff] [blame] | 11 | #include "base/test/test_suite.h" |
[email protected] | f9610ab | 2010-11-09 02:51:34 | [diff] [blame] | 12 | #include "build/build_config.h" |
[email protected] | f2cb3cf | 2013-03-21 01:40:53 | [diff] [blame] | 13 | #include "net/dns/mock_host_resolver.h" |
[email protected] | d2db029 | 2011-01-26 20:23:44 | [diff] [blame] | 14 | |
[email protected] | d2db029 | 2011-01-26 20:23:44 | [diff] [blame] | 15 | namespace net { |
16 | class NetworkChangeNotifier; | ||||
17 | } | ||||
[email protected] | cd37033 | 2009-08-26 00:17:22 | [diff] [blame] | 18 | |
[email protected] | 20e1491 | 2010-08-17 19:40:11 | [diff] [blame] | 19 | class NetTestSuite : public base::TestSuite { |
[email protected] | cd37033 | 2009-08-26 00:17:22 | [diff] [blame] | 20 | public: |
[email protected] | d2db029 | 2011-01-26 20:23:44 | [diff] [blame] | 21 | NetTestSuite(int argc, char** argv); |
dcheng | b03027d | 2014-10-21 12:00:20 | [diff] [blame] | 22 | ~NetTestSuite() override; |
[email protected] | cd37033 | 2009-08-26 00:17:22 | [diff] [blame] | 23 | |
dcheng | b03027d | 2014-10-21 12:00:20 | [diff] [blame] | 24 | void Initialize() override; |
[email protected] | d2db029 | 2011-01-26 20:23:44 | [diff] [blame] | 25 | |
dcheng | b03027d | 2014-10-21 12:00:20 | [diff] [blame] | 26 | void Shutdown() override; |
[email protected] | d2db029 | 2011-01-26 20:23:44 | [diff] [blame] | 27 | |
28 | protected: | ||||
[email protected] | cd37033 | 2009-08-26 00:17:22 | [diff] [blame] | 29 | // Called from within Initialize(), but separate so that derived classes |
30 | // can initialize the NetTestSuite instance only and not | ||||
31 | // TestSuite::Initialize(). TestSuite::Initialize() performs some global | ||||
32 | // initialization that can only be done once. | ||||
[email protected] | d2db029 | 2011-01-26 20:23:44 | [diff] [blame] | 33 | void InitializeTestThread(); |
[email protected] | cd37033 | 2009-08-26 00:17:22 | [diff] [blame] | 34 | |
[email protected] | f9b85d8 | 2011-12-12 21:34:24 | [diff] [blame] | 35 | // Same as above, except it does not create a mock |
36 | // NetworkChangeNotifier. Use this if your test needs to create and | ||||
37 | // manage its own mock NetworkChangeNotifier, or if your test uses | ||||
38 | // the production NetworkChangeNotifier. | ||||
39 | void InitializeTestThreadNoNetworkChangeNotifier(); | ||||
40 | |||||
[email protected] | cd37033 | 2009-08-26 00:17:22 | [diff] [blame] | 41 | private: |
danakj | 22f90e7 | 2016-04-16 01:55:40 | [diff] [blame] | 42 | std::unique_ptr<net::NetworkChangeNotifier> network_change_notifier_; |
[email protected] | cd37033 | 2009-08-26 00:17:22 | [diff] [blame] | 43 | scoped_refptr<net::RuleBasedHostResolverProc> host_resolver_proc_; |
44 | net::ScopedDefaultHostResolverProc scoped_host_resolver_proc_; | ||||
45 | }; | ||||
46 | |||||
[email protected] | 8efa4ba4 | 2013-03-18 21:14:14 | [diff] [blame] | 47 | #endif // NET_TEST_NET_TEST_SUITE_H_ |