| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "chrome/browser/net/connection_tester.h" | 5 #include "chrome/browser/net/connection_tester.h" |
| 6 | 6 |
| 7 #include "chrome/browser/io_thread.h" | 7 #include "chrome/browser/io_thread.h" |
| 8 #include "chrome/test/testing_pref_service.h" | 8 #include "chrome/test/testing_pref_service.h" |
| 9 #include "net/base/mock_host_resolver.h" | 9 #include "net/base/mock_host_resolver.h" |
| 10 #include "net/test/test_server.h" | 10 #include "net/test/test_server.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 // - Making sure each test has an IO loop running | 71 // - Making sure each test has an IO loop running |
| 72 // - Catching any host resolve requests and mapping them to localhost | 72 // - Catching any host resolve requests and mapping them to localhost |
| 73 // (so the test doesn't use any external network dependencies). | 73 // (so the test doesn't use any external network dependencies). |
| 74 class ConnectionTesterTest : public PlatformTest { | 74 class ConnectionTesterTest : public PlatformTest { |
| 75 public: | 75 public: |
| 76 ConnectionTesterTest() | 76 ConnectionTesterTest() |
| 77 : test_server_(net::TestServer::TYPE_HTTP, | 77 : test_server_(net::TestServer::TYPE_HTTP, |
| 78 FilePath(FILE_PATH_LITERAL("net/data/url_request_unittest"))), | 78 FilePath(FILE_PATH_LITERAL("net/data/url_request_unittest"))), |
| 79 message_loop_(MessageLoop::TYPE_IO), | 79 message_loop_(MessageLoop::TYPE_IO), |
| 80 pref_service(new TestingPrefService()), | 80 pref_service(new TestingPrefService()), |
| 81 io_thread_(pref_service.get()) { | 81 io_thread_(pref_service.get(), NULL) { |
| 82 scoped_refptr<net::RuleBasedHostResolverProc> catchall_resolver( | 82 scoped_refptr<net::RuleBasedHostResolverProc> catchall_resolver( |
| 83 new net::RuleBasedHostResolverProc(NULL)); | 83 new net::RuleBasedHostResolverProc(NULL)); |
| 84 | 84 |
| 85 catchall_resolver->AddRule("*", "127.0.0.1"); | 85 catchall_resolver->AddRule("*", "127.0.0.1"); |
| 86 | 86 |
| 87 scoped_host_resolver_proc_.Init(catchall_resolver); | 87 scoped_host_resolver_proc_.Init(catchall_resolver); |
| 88 } | 88 } |
| 89 | 89 |
| 90 protected: | 90 protected: |
| 91 net::ScopedDefaultHostResolverProc scoped_host_resolver_proc_; | 91 net::ScopedDefaultHostResolverProc scoped_host_resolver_proc_; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 // net::ClientSocketPoolBaseHelper, since the "Group" holds a pointer | 147 // net::ClientSocketPoolBaseHelper, since the "Group" holds a pointer |
| 148 // |backup_task| that it will try to deref during the destructor, but | 148 // |backup_task| that it will try to deref during the destructor, but |
| 149 // depending on the order that pending tasks were deleted in, it might | 149 // depending on the order that pending tasks were deleted in, it might |
| 150 // already be invalid! See http://crbug.com/43291. | 150 // already be invalid! See http://crbug.com/43291. |
| 151 MessageLoop::current()->PostTask(FROM_HERE, new MessageLoop::QuitTask()); | 151 MessageLoop::current()->PostTask(FROM_HERE, new MessageLoop::QuitTask()); |
| 152 MessageLoop::current()->Run(); | 152 MessageLoop::current()->Run(); |
| 153 } | 153 } |
| 154 | 154 |
| 155 } // namespace | 155 } // namespace |
| 156 | 156 |
| OLD | NEW |