| 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 "net/base/mock_host_resolver.h" | 8 #include "net/base/mock_host_resolver.h" |
| 9 #include "net/test/test_server.h" | 9 #include "net/test/test_server.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 // The test fixture is responsible for: | 69 // The test fixture is responsible for: |
| 70 // - Making sure each test has an IO loop running | 70 // - Making sure each test has an IO loop running |
| 71 // - Catching any host resolve requests and mapping them to localhost | 71 // - Catching any host resolve requests and mapping them to localhost |
| 72 // (so the test doesn't use any external network dependencies). | 72 // (so the test doesn't use any external network dependencies). |
| 73 class ConnectionTesterTest : public PlatformTest { | 73 class ConnectionTesterTest : public PlatformTest { |
| 74 public: | 74 public: |
| 75 ConnectionTesterTest() | 75 ConnectionTesterTest() |
| 76 : test_server_(net::TestServer::TYPE_HTTP, | 76 : test_server_(net::TestServer::TYPE_HTTP, |
| 77 FilePath(FILE_PATH_LITERAL("net/data/url_request_unittest"))), | 77 FilePath(FILE_PATH_LITERAL("net/data/url_request_unittest"))), |
| 78 message_loop_(MessageLoop::TYPE_IO) { | 78 message_loop_(MessageLoop::TYPE_IO) { |
| 79 scoped_refptr<net::RuleBasedHostResolverProc> catchall_resolver = | 79 scoped_refptr<net::RuleBasedHostResolverProc> catchall_resolver( |
| 80 new net::RuleBasedHostResolverProc(NULL); | 80 new net::RuleBasedHostResolverProc(NULL)); |
| 81 | 81 |
| 82 catchall_resolver->AddRule("*", "127.0.0.1"); | 82 catchall_resolver->AddRule("*", "127.0.0.1"); |
| 83 | 83 |
| 84 scoped_host_resolver_proc_.Init(catchall_resolver); | 84 scoped_host_resolver_proc_.Init(catchall_resolver); |
| 85 } | 85 } |
| 86 | 86 |
| 87 protected: | 87 protected: |
| 88 net::ScopedDefaultHostResolverProc scoped_host_resolver_proc_; | 88 net::ScopedDefaultHostResolverProc scoped_host_resolver_proc_; |
| 89 net::TestServer test_server_; | 89 net::TestServer test_server_; |
| 90 ConnectionTesterDelegate test_delegate_; | 90 ConnectionTesterDelegate test_delegate_; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 // net::ClientSocketPoolBaseHelper, since the "Group" holds a pointer | 143 // net::ClientSocketPoolBaseHelper, since the "Group" holds a pointer |
| 144 // |backup_task| that it will try to deref during the destructor, but | 144 // |backup_task| that it will try to deref during the destructor, but |
| 145 // depending on the order that pending tasks were deleted in, it might | 145 // depending on the order that pending tasks were deleted in, it might |
| 146 // already be invalid! See http://crbug.com/43291. | 146 // already be invalid! See http://crbug.com/43291. |
| 147 MessageLoop::current()->PostTask(FROM_HERE, new MessageLoop::QuitTask()); | 147 MessageLoop::current()->PostTask(FROM_HERE, new MessageLoop::QuitTask()); |
| 148 MessageLoop::current()->Run(); | 148 MessageLoop::current()->Run(); |
| 149 } | 149 } |
| 150 | 150 |
| 151 } // namespace | 151 } // namespace |
| 152 | 152 |
| OLD | NEW |