blob: 006b921d5c1771a0f9b5eeee70eef05e70fbf987 [file] [log] [blame]
[email protected]3b63f8f42011-03-28 01:54:151// Copyright (c) 2011 The Chromium Authors. All rights reserved.
[email protected]cd370332009-08-26 00:17:222// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
[email protected]8efa4ba42013-03-18 21:14:145#ifndef NET_TEST_NET_TEST_SUITE_H_
6#define NET_TEST_NET_TEST_SUITE_H_
[email protected]cd370332009-08-26 00:17:227
danakj22f90e72016-04-16 01:55:408#include <memory>
9
[email protected]3b63f8f42011-03-28 01:54:1510#include "base/memory/ref_counted.h"
[email protected]fb895c62009-10-09 18:20:3011#include "base/test/test_suite.h"
[email protected]f9610ab2010-11-09 02:51:3412#include "build/build_config.h"
[email protected]f2cb3cf2013-03-21 01:40:5313#include "net/dns/mock_host_resolver.h"
[email protected]d2db0292011-01-26 20:23:4414
[email protected]d2db0292011-01-26 20:23:4415namespace net {
16class NetworkChangeNotifier;
17}
[email protected]cd370332009-08-26 00:17:2218
[email protected]20e14912010-08-17 19:40:1119class NetTestSuite : public base::TestSuite {
[email protected]cd370332009-08-26 00:17:2220 public:
[email protected]d2db0292011-01-26 20:23:4421 NetTestSuite(int argc, char** argv);
dchengb03027d2014-10-21 12:00:2022 ~NetTestSuite() override;
[email protected]cd370332009-08-26 00:17:2223
dchengb03027d2014-10-21 12:00:2024 void Initialize() override;
[email protected]d2db0292011-01-26 20:23:4425
dchengb03027d2014-10-21 12:00:2026 void Shutdown() override;
[email protected]d2db0292011-01-26 20:23:4427
28 protected:
[email protected]cd370332009-08-26 00:17:2229 // 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]d2db0292011-01-26 20:23:4433 void InitializeTestThread();
[email protected]cd370332009-08-26 00:17:2234
[email protected]f9b85d82011-12-12 21:34:2435 // 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]cd370332009-08-26 00:17:2241 private:
danakj22f90e72016-04-16 01:55:4042 std::unique_ptr<net::NetworkChangeNotifier> network_change_notifier_;
[email protected]cd370332009-08-26 00:17:2243 scoped_refptr<net::RuleBasedHostResolverProc> host_resolver_proc_;
44 net::ScopedDefaultHostResolverProc scoped_host_resolver_proc_;
45};
46
[email protected]8efa4ba42013-03-18 21:14:1447#endif // NET_TEST_NET_TEST_SUITE_H_