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
3 // found in the LICENSE file.
5 #ifndef NET_TEST_NET_TEST_SUITE_H_
6 #define NET_TEST_NET_TEST_SUITE_H_
8 #include "base/memory/ref_counted.h"
9 #include "base/test/test_suite.h"
10 #include "build/build_config.h"
11 #include "net/dns/mock_host_resolver.h"
18 class NetworkChangeNotifier
;
21 class NetTestSuite
: public base::TestSuite
{
23 NetTestSuite(int argc
, char** argv
);
24 virtual ~NetTestSuite();
26 virtual void Initialize() OVERRIDE
;
28 virtual void Shutdown() OVERRIDE
;
31 // This constructor is only accessible to specialized net test
32 // implementations which need to control the creation of an AtExitManager
33 // instance for the duration of the test.
34 NetTestSuite(int argc
, char** argv
, bool create_at_exit_manager
);
36 // Called from within Initialize(), but separate so that derived classes
37 // can initialize the NetTestSuite instance only and not
38 // TestSuite::Initialize(). TestSuite::Initialize() performs some global
39 // initialization that can only be done once.
40 void InitializeTestThread();
42 // Same as above, except it does not create a mock
43 // NetworkChangeNotifier. Use this if your test needs to create and
44 // manage its own mock NetworkChangeNotifier, or if your test uses
45 // the production NetworkChangeNotifier.
46 void InitializeTestThreadNoNetworkChangeNotifier();
49 scoped_ptr
<net::NetworkChangeNotifier
> network_change_notifier_
;
50 scoped_ptr
<base::MessageLoop
> message_loop_
;
51 scoped_refptr
<net::RuleBasedHostResolverProc
> host_resolver_proc_
;
52 net::ScopedDefaultHostResolverProc scoped_host_resolver_proc_
;
55 #endif // NET_TEST_NET_TEST_SUITE_H_