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

Side by Side Diff: components/navigation_interception/intercept_navigation_resource_throttle_unittest.cc

Issue 14197014: Add TestBrowserThreadBundle into RenderViewHostTestHarness. Kill some unnecessary real threads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merged ToT Created 7 years, 6 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/bind_helpers.h" 6 #include "base/bind_helpers.h"
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/memory/scoped_vector.h" 8 #include "base/memory/scoped_vector.h"
9 #include "base/run_loop.h"
9 #include "base/synchronization/waitable_event.h" 10 #include "base/synchronization/waitable_event.h"
10 #include "components/navigation_interception/intercept_navigation_resource_throt tle.h" 11 #include "components/navigation_interception/intercept_navigation_resource_throt tle.h"
11 #include "components/navigation_interception/navigation_params.h" 12 #include "components/navigation_interception/navigation_params.h"
13 #include "content/public/browser/browser_thread.h"
12 #include "content/public/browser/render_process_host.h" 14 #include "content/public/browser/render_process_host.h"
13 #include "content/public/browser/resource_context.h" 15 #include "content/public/browser/resource_context.h"
14 #include "content/public/browser/resource_controller.h" 16 #include "content/public/browser/resource_controller.h"
15 #include "content/public/browser/resource_dispatcher_host.h" 17 #include "content/public/browser/resource_dispatcher_host.h"
16 #include "content/public/browser/resource_dispatcher_host_delegate.h" 18 #include "content/public/browser/resource_dispatcher_host_delegate.h"
17 #include "content/public/browser/resource_request_info.h" 19 #include "content/public/browser/resource_request_info.h"
18 #include "content/public/browser/resource_throttle.h" 20 #include "content/public/browser/resource_throttle.h"
19 #include "content/public/browser/web_contents.h" 21 #include "content/public/browser/web_contents.h"
20 #include "content/public/browser/web_contents_delegate.h" 22 #include "content/public/browser/web_contents_delegate.h"
21 #include "content/public/common/page_transition_types.h" 23 #include "content/public/common/page_transition_types.h"
22 #include "content/public/test/mock_resource_context.h" 24 #include "content/public/test/mock_resource_context.h"
23 #include "content/public/test/test_browser_thread.h"
24 #include "content/public/test/test_renderer_host.h" 25 #include "content/public/test/test_renderer_host.h"
25 #include "net/url_request/url_request.h" 26 #include "net/url_request/url_request.h"
26 #include "testing/gmock/include/gmock/gmock.h" 27 #include "testing/gmock/include/gmock/gmock.h"
27 #include "testing/gtest/include/gtest/gtest.h" 28 #include "testing/gtest/include/gtest/gtest.h"
28 29
29 using testing::_; 30 using testing::_;
30 using testing::Eq; 31 using testing::Eq;
31 using testing::Property; 32 using testing::Property;
32 using testing::Ne; 33 using testing::Ne;
33 using testing::Return; 34 using testing::Return;
34 35
35 namespace navigation_interception { 36 namespace navigation_interception {
36 37
37 namespace { 38 namespace {
38 39
39 const char kTestUrl[] = "http://www.test.com/"; 40 const char kTestUrl[] = "http://www.test.com/";
40 const char kUnsafeTestUrl[] = "about:crash"; 41 const char kUnsafeTestUrl[] = "about:crash";
41 42
42 void ContinueTestCase() {
43 content::BrowserThread::PostTask(
44 content::BrowserThread::UI, FROM_HERE, base::MessageLoop::QuitClosure());
45 }
46
47 // The MS C++ compiler complains about not being able to resolve which url() 43 // The MS C++ compiler complains about not being able to resolve which url()
48 // method (const or non-const) to use if we use the Property matcher to check 44 // method (const or non-const) to use if we use the Property matcher to check
49 // the return value of the NavigationParams::url() method. 45 // the return value of the NavigationParams::url() method.
50 // It is possible to suppress the error by specifying the types directly but 46 // It is possible to suppress the error by specifying the types directly but
51 // that results in very ugly syntax, which is why these custom matchers are 47 // that results in very ugly syntax, which is why these custom matchers are
52 // used instead. 48 // used instead.
53 MATCHER(NavigationParamsUrlIsTest, "") { 49 MATCHER(NavigationParamsUrlIsTest, "") {
54 return arg.url() == GURL(kTestUrl); 50 return arg.url() == GURL(kTestUrl);
55 } 51 }
56 52
(...skipping 27 matching lines...) Expand all
84 } 80 }
85 81
86 Status status() const { return status_; } 82 Status status() const { return status_; }
87 83
88 // ResourceController: 84 // ResourceController:
89 virtual void Cancel() OVERRIDE { 85 virtual void Cancel() OVERRIDE {
90 NOTREACHED(); 86 NOTREACHED();
91 } 87 }
92 virtual void CancelAndIgnore() OVERRIDE { 88 virtual void CancelAndIgnore() OVERRIDE {
93 status_ = CANCELLED; 89 status_ = CANCELLED;
94 ContinueTestCase();
95 } 90 }
96 virtual void CancelWithError(int error_code) OVERRIDE { 91 virtual void CancelWithError(int error_code) OVERRIDE {
97 NOTREACHED(); 92 NOTREACHED();
98 } 93 }
99 virtual void Resume() OVERRIDE { 94 virtual void Resume() OVERRIDE {
100 DCHECK(status_ == UNKNOWN); 95 DCHECK(status_ == UNKNOWN);
101 status_ = RESUMED; 96 status_ = RESUMED;
102 ContinueTestCase();
103 } 97 }
104 98
105 private: 99 private:
106 Status status_; 100 Status status_;
107 }; 101 };
108 102
109 // TestIOThreadState ---------------------------------------------------------- 103 // TestIOThreadState ----------------------------------------------------------
110 104
111 class TestIOThreadState { 105 class TestIOThreadState {
112 public: 106 public:
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 MockResourceController throttle_controller_; 149 MockResourceController throttle_controller_;
156 }; 150 };
157 151
158 // InterceptNavigationResourceThrottleTest ------------------------------------ 152 // InterceptNavigationResourceThrottleTest ------------------------------------
159 153
160 class InterceptNavigationResourceThrottleTest 154 class InterceptNavigationResourceThrottleTest
161 : public content::RenderViewHostTestHarness { 155 : public content::RenderViewHostTestHarness {
162 public: 156 public:
163 InterceptNavigationResourceThrottleTest() 157 InterceptNavigationResourceThrottleTest()
164 : mock_callback_receiver_(new MockInterceptCallbackReceiver()), 158 : mock_callback_receiver_(new MockInterceptCallbackReceiver()),
165 ui_thread_(content::BrowserThread::UI, &message_loop_),
166 io_thread_(content::BrowserThread::IO),
167 io_thread_state_(NULL) { 159 io_thread_state_(NULL) {
168 } 160 }
169 161
170 virtual void SetUp() OVERRIDE { 162 virtual void SetUp() OVERRIDE {
171 RenderViewHostTestHarness::SetUp(); 163 RenderViewHostTestHarness::SetUp();
172
173 io_thread_.StartIOThread();
174 } 164 }
175 165
176 virtual void TearDown() OVERRIDE { 166 virtual void TearDown() OVERRIDE {
177 if (web_contents()) 167 if (web_contents())
178 web_contents()->SetDelegate(NULL); 168 web_contents()->SetDelegate(NULL);
179 169
180 content::BrowserThread::PostTask( 170 content::BrowserThread::PostTask(
181 content::BrowserThread::IO, 171 content::BrowserThread::IO,
182 FROM_HERE, 172 FROM_HERE,
183 base::Bind(&base::DeletePointer<TestIOThreadState>, io_thread_state_)); 173 base::Bind(&base::DeletePointer<TestIOThreadState>, io_thread_state_));
(...skipping 11 matching lines...) Expand all
195 int render_process_id, 185 int render_process_id,
196 int render_view_id, 186 int render_view_id,
197 bool* defer) { 187 bool* defer) {
198 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); 188 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
199 TestIOThreadState* io_thread_state = 189 TestIOThreadState* io_thread_state =
200 new TestIOThreadState(url, render_process_id, render_view_id, 190 new TestIOThreadState(url, render_process_id, render_view_id,
201 request_method, mock_callback_receiver_.get()); 191 request_method, mock_callback_receiver_.get());
202 192
203 SetIOThreadState(io_thread_state); 193 SetIOThreadState(io_thread_state);
204 io_thread_state->ThrottleWillStartRequest(defer); 194 io_thread_state->ThrottleWillStartRequest(defer);
205
206 if (!*defer) {
207 ContinueTestCase();
208 }
209 } 195 }
210 196
211 protected: 197 protected:
212 enum ShouldIgnoreNavigationCallbackAction { 198 enum ShouldIgnoreNavigationCallbackAction {
213 IgnoreNavigation, 199 IgnoreNavigation,
214 DontIgnoreNavigation 200 DontIgnoreNavigation
215 }; 201 };
216 202
217 void SetUpWebContentsDelegateAndRunMessageLoop( 203 void SetUpWebContentsDelegateAndDrainRunLoop(
218 ShouldIgnoreNavigationCallbackAction callback_action, 204 ShouldIgnoreNavigationCallbackAction callback_action,
219 bool* defer) { 205 bool* defer) {
220 206
221 ON_CALL(*mock_callback_receiver_, ShouldIgnoreNavigation(_, _)) 207 ON_CALL(*mock_callback_receiver_, ShouldIgnoreNavigation(_, _))
222 .WillByDefault(Return(callback_action == IgnoreNavigation)); 208 .WillByDefault(Return(callback_action == IgnoreNavigation));
223 EXPECT_CALL(*mock_callback_receiver_, 209 EXPECT_CALL(*mock_callback_receiver_,
224 ShouldIgnoreNavigation(rvh(), NavigationParamsUrlIsTest())) 210 ShouldIgnoreNavigation(rvh(), NavigationParamsUrlIsTest()))
225 .Times(1); 211 .Times(1);
226 212
227 content::BrowserThread::PostTask( 213 content::BrowserThread::PostTask(
228 content::BrowserThread::IO, 214 content::BrowserThread::IO,
229 FROM_HERE, 215 FROM_HERE,
230 base::Bind( 216 base::Bind(
231 &InterceptNavigationResourceThrottleTest:: 217 &InterceptNavigationResourceThrottleTest::
232 RunThrottleWillStartRequestOnIOThread, 218 RunThrottleWillStartRequestOnIOThread,
233 base::Unretained(this), 219 base::Unretained(this),
234 GURL(kTestUrl), 220 GURL(kTestUrl),
235 "GET", 221 "GET",
236 web_contents()->GetRenderViewHost()->GetProcess()->GetID(), 222 web_contents()->GetRenderViewHost()->GetProcess()->GetID(),
237 web_contents()->GetRenderViewHost()->GetRoutingID(), 223 web_contents()->GetRenderViewHost()->GetRoutingID(),
238 base::Unretained(defer))); 224 base::Unretained(defer)));
239 225
240 // Wait for the request to finish processing. 226 // Wait for the request to finish processing.
241 message_loop_.Run(); 227 base::RunLoop().RunUntilIdle();
242 } 228 }
243 229
244 void WaitForPreviouslyScheduledIoThreadWork() { 230 void WaitForPreviouslyScheduledIoThreadWork() {
245 base::WaitableEvent io_thread_work_done(true, false); 231 base::WaitableEvent io_thread_work_done(true, false);
246 content::BrowserThread::PostTask( 232 content::BrowserThread::PostTask(
247 content::BrowserThread::IO, 233 content::BrowserThread::IO,
248 FROM_HERE, 234 FROM_HERE,
249 base::Bind( 235 base::Bind(
250 &base::WaitableEvent::Signal, 236 &base::WaitableEvent::Signal,
251 base::Unretained(&io_thread_work_done))); 237 base::Unretained(&io_thread_work_done)));
252 io_thread_work_done.Wait(); 238 io_thread_work_done.Wait();
253 } 239 }
254 240
255 scoped_ptr<MockInterceptCallbackReceiver> mock_callback_receiver_; 241 scoped_ptr<MockInterceptCallbackReceiver> mock_callback_receiver_;
256 content::TestBrowserThread ui_thread_;
257 content::TestBrowserThread io_thread_;
258 TestIOThreadState* io_thread_state_; 242 TestIOThreadState* io_thread_state_;
259 }; 243 };
260 244
261 TEST_F(InterceptNavigationResourceThrottleTest, 245 TEST_F(InterceptNavigationResourceThrottleTest,
262 RequestDeferredAndResumedIfNavigationNotIgnored) { 246 RequestDeferredAndResumedIfNavigationNotIgnored) {
263 bool defer = false; 247 bool defer = false;
264 SetUpWebContentsDelegateAndRunMessageLoop(DontIgnoreNavigation, &defer); 248 SetUpWebContentsDelegateAndDrainRunLoop(DontIgnoreNavigation, &defer);
265 249
266 EXPECT_TRUE(defer); 250 EXPECT_TRUE(defer);
267 EXPECT_TRUE(io_thread_state_); 251 EXPECT_TRUE(io_thread_state_);
268 EXPECT_TRUE(io_thread_state_->request_resumed()); 252 EXPECT_TRUE(io_thread_state_->request_resumed());
269 } 253 }
270 254
271 TEST_F(InterceptNavigationResourceThrottleTest, 255 TEST_F(InterceptNavigationResourceThrottleTest,
272 RequestDeferredAndCancelledIfNavigationIgnored) { 256 RequestDeferredAndCancelledIfNavigationIgnored) {
273 bool defer = false; 257 bool defer = false;
274 SetUpWebContentsDelegateAndRunMessageLoop(IgnoreNavigation, &defer); 258 SetUpWebContentsDelegateAndDrainRunLoop(IgnoreNavigation, &defer);
275 259
276 EXPECT_TRUE(defer); 260 EXPECT_TRUE(defer);
277 EXPECT_TRUE(io_thread_state_); 261 EXPECT_TRUE(io_thread_state_);
278 EXPECT_TRUE(io_thread_state_->request_cancelled()); 262 EXPECT_TRUE(io_thread_state_->request_cancelled());
279 } 263 }
280 264
281 TEST_F(InterceptNavigationResourceThrottleTest, 265 TEST_F(InterceptNavigationResourceThrottleTest,
282 NoCallbackMadeIfContentsDeletedWhileThrottleRunning) { 266 NoCallbackMadeIfContentsDeletedWhileThrottleRunning) {
283 bool defer = false; 267 bool defer = false;
284 268
285 // The tested scenario is when the WebContents is deleted after the 269 // The tested scenario is when the WebContents is deleted after the
286 // ResourceThrottle has finished processing on the IO thread but before the 270 // ResourceThrottle has finished processing on the IO thread but before the
287 // UI thread callback has been processed. 271 // UI thread callback has been processed. Since both threads in this test
288 content::BrowserThread::PostTask( 272 // are serviced by one message loop, the post order is the execution order.
289 content::BrowserThread::UI,
290 FROM_HERE,
291 base::Bind(
292 &RenderViewHostTestHarness::DeleteContents,
293 base::Unretained(this)));
294
295 EXPECT_CALL(*mock_callback_receiver_, 273 EXPECT_CALL(*mock_callback_receiver_,
296 ShouldIgnoreNavigation(_, _)) 274 ShouldIgnoreNavigation(_, _))
297 .Times(0); 275 .Times(0);
298 276
299 content::BrowserThread::PostTask( 277 content::BrowserThread::PostTask(
300 content::BrowserThread::IO, 278 content::BrowserThread::IO,
301 FROM_HERE, 279 FROM_HERE,
302 base::Bind( 280 base::Bind(
303 &InterceptNavigationResourceThrottleTest:: 281 &InterceptNavigationResourceThrottleTest::
304 RunThrottleWillStartRequestOnIOThread, 282 RunThrottleWillStartRequestOnIOThread,
305 base::Unretained(this), 283 base::Unretained(this),
306 GURL(kTestUrl), 284 GURL(kTestUrl),
307 "GET", 285 "GET",
308 web_contents()->GetRenderViewHost()->GetProcess()->GetID(), 286 web_contents()->GetRenderViewHost()->GetProcess()->GetID(),
309 web_contents()->GetRenderViewHost()->GetRoutingID(), 287 web_contents()->GetRenderViewHost()->GetRoutingID(),
310 base::Unretained(&defer))); 288 base::Unretained(&defer)));
311 289
312 WaitForPreviouslyScheduledIoThreadWork(); 290 content::BrowserThread::PostTask(
291 content::BrowserThread::UI,
292 FROM_HERE,
293 base::Bind(
294 &RenderViewHostTestHarness::DeleteContents,
295 base::Unretained(this)));
313 296
314 // The WebContents will now be deleted and only after that will the UI-thread 297 // The WebContents will now be deleted and only after that will the UI-thread
315 // callback posted by the ResourceThrottle be executed. 298 // callback posted by the ResourceThrottle be executed.
316 message_loop_.Run(); 299 base::RunLoop().RunUntilIdle();
317 300
318 EXPECT_TRUE(defer); 301 EXPECT_TRUE(defer);
319 EXPECT_TRUE(io_thread_state_); 302 EXPECT_TRUE(io_thread_state_);
320 EXPECT_TRUE(io_thread_state_->request_resumed()); 303 EXPECT_TRUE(io_thread_state_->request_resumed());
321 } 304 }
322 305
323 TEST_F(InterceptNavigationResourceThrottleTest, 306 TEST_F(InterceptNavigationResourceThrottleTest,
324 RequestNotDeferredForRequestNotAssociatedWithARenderView) { 307 RequestNotDeferredForRequestNotAssociatedWithARenderView) {
325 bool defer = false; 308 bool defer = false;
326 309
327 content::BrowserThread::PostTask( 310 content::BrowserThread::PostTask(
328 content::BrowserThread::IO, 311 content::BrowserThread::IO,
329 FROM_HERE, 312 FROM_HERE,
330 base::Bind( 313 base::Bind(
331 &InterceptNavigationResourceThrottleTest:: 314 &InterceptNavigationResourceThrottleTest::
332 RunThrottleWillStartRequestOnIOThread, 315 RunThrottleWillStartRequestOnIOThread,
333 base::Unretained(this), 316 base::Unretained(this),
334 GURL(kTestUrl), 317 GURL(kTestUrl),
335 "GET", 318 "GET",
336 MSG_ROUTING_NONE, 319 MSG_ROUTING_NONE,
337 MSG_ROUTING_NONE, 320 MSG_ROUTING_NONE,
338 base::Unretained(&defer))); 321 base::Unretained(&defer)));
339 322
340 // Wait for the request to finish processing. 323 // Wait for the request to finish processing.
341 message_loop_.Run(); 324 base::RunLoop().RunUntilIdle();
342 325
343 EXPECT_FALSE(defer); 326 EXPECT_FALSE(defer);
344 } 327 }
345 328
346 TEST_F(InterceptNavigationResourceThrottleTest, 329 TEST_F(InterceptNavigationResourceThrottleTest,
347 CallbackCalledWithFilteredUrl) { 330 CallbackCalledWithFilteredUrl) {
348 bool defer = false; 331 bool defer = false;
349 332
350 ON_CALL(*mock_callback_receiver_, 333 ON_CALL(*mock_callback_receiver_,
351 ShouldIgnoreNavigation(_, NavigationParamsUrlIsSafe())) 334 ShouldIgnoreNavigation(_, NavigationParamsUrlIsSafe()))
352 .WillByDefault(Return(false)); 335 .WillByDefault(Return(false));
353 EXPECT_CALL(*mock_callback_receiver_, 336 EXPECT_CALL(*mock_callback_receiver_,
354 ShouldIgnoreNavigation(_, NavigationParamsUrlIsSafe())) 337 ShouldIgnoreNavigation(_, NavigationParamsUrlIsSafe()))
355 .Times(1); 338 .Times(1);
356 339
357 content::BrowserThread::PostTask( 340 content::BrowserThread::PostTask(
358 content::BrowserThread::IO, 341 content::BrowserThread::IO,
359 FROM_HERE, 342 FROM_HERE,
360 base::Bind( 343 base::Bind(
361 &InterceptNavigationResourceThrottleTest:: 344 &InterceptNavigationResourceThrottleTest::
362 RunThrottleWillStartRequestOnIOThread, 345 RunThrottleWillStartRequestOnIOThread,
363 base::Unretained(this), 346 base::Unretained(this),
364 GURL(kUnsafeTestUrl), 347 GURL(kUnsafeTestUrl),
365 "GET", 348 "GET",
366 web_contents()->GetRenderViewHost()->GetProcess()->GetID(), 349 web_contents()->GetRenderViewHost()->GetProcess()->GetID(),
367 web_contents()->GetRenderViewHost()->GetRoutingID(), 350 web_contents()->GetRenderViewHost()->GetRoutingID(),
368 base::Unretained(&defer))); 351 base::Unretained(&defer)));
369 352
370 // Wait for the request to finish processing. 353 // Wait for the request to finish processing.
371 message_loop_.Run(); 354 base::RunLoop().RunUntilIdle();
372 } 355 }
373 356
374 TEST_F(InterceptNavigationResourceThrottleTest, 357 TEST_F(InterceptNavigationResourceThrottleTest,
375 CallbackIsPostFalseForGet) { 358 CallbackIsPostFalseForGet) {
376 bool defer = false; 359 bool defer = false;
377 360
378 EXPECT_CALL(*mock_callback_receiver_, 361 EXPECT_CALL(*mock_callback_receiver_,
379 ShouldIgnoreNavigation(_, AllOf( 362 ShouldIgnoreNavigation(_, AllOf(
380 NavigationParamsUrlIsSafe(), 363 NavigationParamsUrlIsSafe(),
381 Property(&NavigationParams::is_post, Eq(false))))) 364 Property(&NavigationParams::is_post, Eq(false)))))
382 .WillOnce(Return(false)); 365 .WillOnce(Return(false));
383 366
384 content::BrowserThread::PostTask( 367 content::BrowserThread::PostTask(
385 content::BrowserThread::IO, 368 content::BrowserThread::IO,
386 FROM_HERE, 369 FROM_HERE,
387 base::Bind( 370 base::Bind(
388 &InterceptNavigationResourceThrottleTest:: 371 &InterceptNavigationResourceThrottleTest::
389 RunThrottleWillStartRequestOnIOThread, 372 RunThrottleWillStartRequestOnIOThread,
390 base::Unretained(this), 373 base::Unretained(this),
391 GURL(kTestUrl), 374 GURL(kTestUrl),
392 "GET", 375 "GET",
393 web_contents()->GetRenderViewHost()->GetProcess()->GetID(), 376 web_contents()->GetRenderViewHost()->GetProcess()->GetID(),
394 web_contents()->GetRenderViewHost()->GetRoutingID(), 377 web_contents()->GetRenderViewHost()->GetRoutingID(),
395 base::Unretained(&defer))); 378 base::Unretained(&defer)));
396 379
397 // Wait for the request to finish processing. 380 // Wait for the request to finish processing.
398 message_loop_.Run(); 381 base::RunLoop().RunUntilIdle();
399 } 382 }
400 383
401 TEST_F(InterceptNavigationResourceThrottleTest, 384 TEST_F(InterceptNavigationResourceThrottleTest,
402 CallbackIsPostTrueForPost) { 385 CallbackIsPostTrueForPost) {
403 bool defer = false; 386 bool defer = false;
404 387
405 EXPECT_CALL(*mock_callback_receiver_, 388 EXPECT_CALL(*mock_callback_receiver_,
406 ShouldIgnoreNavigation(_, AllOf( 389 ShouldIgnoreNavigation(_, AllOf(
407 NavigationParamsUrlIsSafe(), 390 NavigationParamsUrlIsSafe(),
408 Property(&NavigationParams::is_post, Eq(true))))) 391 Property(&NavigationParams::is_post, Eq(true)))))
409 .WillOnce(Return(false)); 392 .WillOnce(Return(false));
410 393
411 content::BrowserThread::PostTask( 394 content::BrowserThread::PostTask(
412 content::BrowserThread::IO, 395 content::BrowserThread::IO,
413 FROM_HERE, 396 FROM_HERE,
414 base::Bind( 397 base::Bind(
415 &InterceptNavigationResourceThrottleTest:: 398 &InterceptNavigationResourceThrottleTest::
416 RunThrottleWillStartRequestOnIOThread, 399 RunThrottleWillStartRequestOnIOThread,
417 base::Unretained(this), 400 base::Unretained(this),
418 GURL(kTestUrl), 401 GURL(kTestUrl),
419 "POST", 402 "POST",
420 web_contents()->GetRenderViewHost()->GetProcess()->GetID(), 403 web_contents()->GetRenderViewHost()->GetProcess()->GetID(),
421 web_contents()->GetRenderViewHost()->GetRoutingID(), 404 web_contents()->GetRenderViewHost()->GetRoutingID(),
422 base::Unretained(&defer))); 405 base::Unretained(&defer)));
423 406
424 // Wait for the request to finish processing. 407 // Wait for the request to finish processing.
425 message_loop_.Run(); 408 base::RunLoop().RunUntilIdle();
426 } 409 }
427 410
428 } // namespace navigation_interception 411 } // namespace navigation_interception
OLDNEW
« no previous file with comments | « components/autofill/browser/autofill_metrics_unittest.cc ('k') | components/visitedlink/test/visitedlink_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698