| 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/test/test_browser_thread.h" | 8 #include "content/test/test_browser_thread.h" |
| 9 #include "net/base/cert_verifier.h" | 9 #include "net/base/cert_verifier.h" |
| 10 #include "net/base/cookie_monster.h" | 10 #include "net/base/cookie_monster.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 // The test fixture is responsible for: | 83 // The test fixture is responsible for: |
| 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 FilePath(FILE_PATH_LITERAL("net/data/url_request_unittest"))), | 93 net::TestServer::kLocalhost, |
| 94 FilePath( |
| 95 FILE_PATH_LITERAL("net/data/url_request_unittest"))), |
| 94 proxy_script_fetcher_context_(new net::URLRequestContext) { | 96 proxy_script_fetcher_context_(new net::URLRequestContext) { |
| 95 InitializeRequestContext(); | 97 InitializeRequestContext(); |
| 96 } | 98 } |
| 97 | 99 |
| 98 protected: | 100 protected: |
| 99 // 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 |
| 100 // ObserverListThreadSave to shut down properly. For example, | 102 // ObserverListThreadSave to shut down properly. For example, |
| 101 // SSLClientAuthCache calls RemoveObserver when destroyed, but if the | 103 // SSLClientAuthCache calls RemoveObserver when destroyed, but if the |
| 102 // MessageLoop is already destroyed, then the RemoveObserver will be a | 104 // MessageLoop is already destroyed, then the RemoveObserver will be a |
| 103 // no-op, and the ObserverList will contain invalid entries. | 105 // no-op, and the ObserverList will contain invalid entries. |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 // any pending tasks instead of running them. This causes a problem with | 196 // any pending tasks instead of running them. This causes a problem with |
| 195 // net::ClientSocketPoolBaseHelper, since the "Group" holds a pointer | 197 // net::ClientSocketPoolBaseHelper, since the "Group" holds a pointer |
| 196 // |backup_task| that it will try to deref during the destructor, but | 198 // |backup_task| that it will try to deref during the destructor, but |
| 197 // depending on the order that pending tasks were deleted in, it might | 199 // depending on the order that pending tasks were deleted in, it might |
| 198 // already be invalid! See http://crbug.com/43291. | 200 // already be invalid! See http://crbug.com/43291. |
| 199 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); | 201 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); |
| 200 MessageLoop::current()->Run(); | 202 MessageLoop::current()->Run(); |
| 201 } | 203 } |
| 202 | 204 |
| 203 } // namespace | 205 } // namespace |
| OLD | NEW |