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

Side by Side Diff: chrome/browser/net/connection_tester_unittest.cc

Issue 10796112: Use a NetLog for test requests sent by about:net-internals (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Last CL removed wrong line break. :( Created 8 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 http_transaction_factory_.get()); 141 http_transaction_factory_.get());
142 // In-memory cookie store. 142 // In-memory cookie store.
143 proxy_script_fetcher_context_->set_cookie_store( 143 proxy_script_fetcher_context_->set_cookie_store(
144 new net::CookieMonster(NULL, NULL)); 144 new net::CookieMonster(NULL, NULL));
145 } 145 }
146 }; 146 };
147 147
148 TEST_F(ConnectionTesterTest, RunAllTests) { 148 TEST_F(ConnectionTesterTest, RunAllTests) {
149 ASSERT_TRUE(test_server_.Start()); 149 ASSERT_TRUE(test_server_.Start());
150 150
151 ConnectionTester tester(&test_delegate_, proxy_script_fetcher_context_.get()); 151 ConnectionTester tester(&test_delegate_,
152 proxy_script_fetcher_context_.get(),
153 NULL);
152 154
153 // Start the test suite on URL "echoall". 155 // Start the test suite on URL "echoall".
154 // TODO(eroman): Is this URL right? 156 // TODO(eroman): Is this URL right?
155 tester.RunAllTests(test_server_.GetURL("echoall")); 157 tester.RunAllTests(test_server_.GetURL("echoall"));
156 158
157 // Wait for all the tests to complete. 159 // Wait for all the tests to complete.
158 MessageLoop::current()->Run(); 160 MessageLoop::current()->Run();
159 161
160 const int kNumExperiments = 162 const int kNumExperiments =
161 ConnectionTester::PROXY_EXPERIMENT_COUNT * 163 ConnectionTester::PROXY_EXPERIMENT_COUNT *
162 ConnectionTester::HOST_RESOLVER_EXPERIMENT_COUNT; 164 ConnectionTester::HOST_RESOLVER_EXPERIMENT_COUNT;
163 165
164 EXPECT_EQ(1, test_delegate_.start_connection_test_suite_count()); 166 EXPECT_EQ(1, test_delegate_.start_connection_test_suite_count());
165 EXPECT_EQ(kNumExperiments, 167 EXPECT_EQ(kNumExperiments,
166 test_delegate_.start_connection_test_experiment_count()); 168 test_delegate_.start_connection_test_experiment_count());
167 EXPECT_EQ(kNumExperiments, 169 EXPECT_EQ(kNumExperiments,
168 test_delegate_.completed_connection_test_experiment_count()); 170 test_delegate_.completed_connection_test_experiment_count());
169 EXPECT_EQ(1, test_delegate_.completed_connection_test_suite_count()); 171 EXPECT_EQ(1, test_delegate_.completed_connection_test_suite_count());
170 } 172 }
171 173
172 TEST_F(ConnectionTesterTest, DeleteWhileInProgress) { 174 TEST_F(ConnectionTesterTest, DeleteWhileInProgress) {
173 ASSERT_TRUE(test_server_.Start()); 175 ASSERT_TRUE(test_server_.Start());
174 176
175 scoped_ptr<ConnectionTester> tester( 177 scoped_ptr<ConnectionTester> tester(
176 new ConnectionTester(&test_delegate_, 178 new ConnectionTester(&test_delegate_,
177 proxy_script_fetcher_context_.get())); 179 proxy_script_fetcher_context_.get(),
180 NULL));
178 181
179 // Start the test suite on URL "echoall". 182 // Start the test suite on URL "echoall".
180 // TODO(eroman): Is this URL right? 183 // TODO(eroman): Is this URL right?
181 tester->RunAllTests(test_server_.GetURL("echoall")); 184 tester->RunAllTests(test_server_.GetURL("echoall"));
182 185
183 // Don't run the message loop at all. Otherwise the experiment's request may 186 // Don't run the message loop at all. Otherwise the experiment's request may
184 // complete and post a task to run the next experiment before we quit the 187 // complete and post a task to run the next experiment before we quit the
185 // message loop. 188 // message loop.
186 189
187 EXPECT_EQ(1, test_delegate_.start_connection_test_suite_count()); 190 EXPECT_EQ(1, test_delegate_.start_connection_test_suite_count());
(...skipping 10 matching lines...) Expand all
198 // 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
199 // net::ClientSocketPoolBaseHelper, since the "Group" holds a pointer 202 // net::ClientSocketPoolBaseHelper, since the "Group" holds a pointer
200 // |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
201 // 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
202 // already be invalid! See http://crbug.com/43291. 205 // already be invalid! See http://crbug.com/43291.
203 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); 206 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure());
204 MessageLoop::current()->Run(); 207 MessageLoop::current()->Run();
205 } 208 }
206 209
207 } // namespace 210 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/net/connection_tester.cc ('k') | chrome/browser/ui/webui/net_internals/net_internals_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698