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

Unified Diff: net/base/net_test_suite.h

Issue 6264013: Clean up net unit testing code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Re-virtualize TestDelegate::OnResponseCompleted Created 9 years, 11 months 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 side-by-side diff with in-line comments
Download patch
Index: net/base/net_test_suite.h
diff --git a/net/base/net_test_suite.h b/net/base/net_test_suite.h
index 8ebc4e79beb71de22713c1ad74b7e982e74b7b28..274d0670c9fe5226eb8c2e97983b497973b34d2e 100644
--- a/net/base/net_test_suite.h
+++ b/net/base/net_test_suite.h
@@ -6,53 +6,33 @@
#define NET_BASE_NET_TEST_SUITE_H_
#pragma once
-#include "base/message_loop.h"
#include "base/ref_counted.h"
#include "base/test/test_suite.h"
#include "build/build_config.h"
#include "net/base/mock_host_resolver.h"
-#if defined(USE_NSS)
-#include "net/ocsp/nss_ocsp.h"
-#endif
+
+class MessageLoop;
+
+namespace net {
+class NetworkChangeNotifier;
+}
class NetTestSuite : public base::TestSuite {
public:
- NetTestSuite(int argc, char** argv) : TestSuite(argc, argv) {
- }
+ NetTestSuite(int argc, char** argv);
+ virtual ~NetTestSuite();
+
+ virtual void Initialize();
- virtual void Initialize() {
- TestSuite::Initialize();
- InitializeTestThread();
- }
+ virtual void Shutdown();
+
+ protected:
// Called from within Initialize(), but separate so that derived classes
// can initialize the NetTestSuite instance only and not
// TestSuite::Initialize(). TestSuite::Initialize() performs some global
// initialization that can only be done once.
- void InitializeTestThread() {
- network_change_notifier_.reset(net::NetworkChangeNotifier::CreateMock());
-
- host_resolver_proc_ = new net::RuleBasedHostResolverProc(NULL);
- scoped_host_resolver_proc_.Init(host_resolver_proc_.get());
- // In case any attempts are made to resolve host names, force them all to
- // be mapped to localhost. This prevents DNS queries from being sent in
- // the process of running these unit tests.
- host_resolver_proc_->AddRule("*", "127.0.0.1");
-
- message_loop_.reset(new MessageLoopForIO());
- }
-
- virtual void Shutdown() {
-#if defined(USE_NSS)
- net::ShutdownOCSP();
-#endif
-
- // We want to destroy this here before the TestSuite continues to tear down
- // the environment.
- message_loop_.reset();
-
- TestSuite::Shutdown();
- }
+ void InitializeTestThread();
private:
scoped_ptr<net::NetworkChangeNotifier> network_change_notifier_;

Powered by Google App Engine
This is Rietveld 408576698