OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/test/base/testing_pref_service.h" | 7 #include "chrome/test/base/testing_pref_service.h" |
8 #include "content/public/test/test_browser_thread.h" | 8 #include "content/public/test/test_browser_thread.h" |
9 #include "net/base/mock_cert_verifier.h" | 9 #include "net/base/mock_cert_verifier.h" |
10 #include "net/base/mock_host_resolver.h" | 10 #include "net/base/mock_host_resolver.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 // - Making sure each test has an IO loop running | 84 // - Making sure each test has an IO loop running |
85 // - Catching any host resolve requests and mapping them to localhost | 85 // - Catching any host resolve requests and mapping them to localhost |
86 // (so the test doesn't use any external network dependencies). | 86 // (so the test doesn't use any external network dependencies). |
87 class ConnectionTesterTest : public PlatformTest { | 87 class ConnectionTesterTest : public PlatformTest { |
88 public: | 88 public: |
89 ConnectionTesterTest() | 89 ConnectionTesterTest() |
90 : message_loop_(MessageLoop::TYPE_IO), | 90 : message_loop_(MessageLoop::TYPE_IO), |
91 io_thread_(BrowserThread::IO, &message_loop_), | 91 io_thread_(BrowserThread::IO, &message_loop_), |
92 test_server_(net::TestServer::TYPE_HTTP, | 92 test_server_(net::TestServer::TYPE_HTTP, |
93 net::TestServer::kLocalhost, | 93 net::TestServer::kLocalhost, |
94 FilePath( | 94 // Nothing is read in this directory. |
95 FILE_PATH_LITERAL("net/data/url_request_unittest"))), | 95 FilePath(FILE_PATH_LITERAL("chrome"))), |
96 proxy_script_fetcher_context_(new net::URLRequestContext) { | 96 proxy_script_fetcher_context_(new net::URLRequestContext) { |
97 InitializeRequestContext(); | 97 InitializeRequestContext(); |
98 } | 98 } |
99 | 99 |
100 protected: | 100 protected: |
101 // Destroy last the MessageLoop last to give a chance for objects like | 101 // Destroy last the MessageLoop last to give a chance for objects like |
102 // ObserverListThreadSave to shut down properly. For example, | 102 // ObserverListThreadSave to shut down properly. For example, |
103 // SSLClientAuthCache calls RemoveObserver when destroyed, but if the | 103 // SSLClientAuthCache calls RemoveObserver when destroyed, but if the |
104 // MessageLoop is already destroyed, then the RemoveObserver will be a | 104 // MessageLoop is already destroyed, then the RemoveObserver will be a |
105 // no-op, and the ObserverList will contain invalid entries. | 105 // no-op, and the ObserverList will contain invalid entries. |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 // any pending tasks instead of running them. This causes a problem with | 201 // any pending tasks instead of running them. This causes a problem with |
202 // net::ClientSocketPoolBaseHelper, since the "Group" holds a pointer | 202 // net::ClientSocketPoolBaseHelper, since the "Group" holds a pointer |
203 // |backup_task| that it will try to deref during the destructor, but | 203 // |backup_task| that it will try to deref during the destructor, but |
204 // depending on the order that pending tasks were deleted in, it might | 204 // depending on the order that pending tasks were deleted in, it might |
205 // already be invalid! See http://crbug.com/43291. | 205 // already be invalid! See http://crbug.com/43291. |
206 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); | 206 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); |
207 MessageLoop::current()->Run(); | 207 MessageLoop::current()->Run(); |
208 } | 208 } |
209 | 209 |
210 } // namespace | 210 } // namespace |
OLD | NEW |