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

Side by Side Diff: webkit/glue/resource_fetcher_unittest.cc

Issue 7812036: Update base/timer.h code to pass through Location from call sites. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 3 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
« no previous file with comments | « webkit/glue/resource_fetcher.cc ('k') | webkit/glue/webkitclient_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "webkit/glue/resource_fetcher.h" 5 #include "webkit/glue/resource_fetcher.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/timer.h" 9 #include "base/timer.h"
10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 63
64 // Wait for the request to complete or timeout. We use a loop here b/c the 64 // Wait for the request to complete or timeout. We use a loop here b/c the
65 // testing infrastructure (test_shell) can generate spurious calls to the 65 // testing infrastructure (test_shell) can generate spurious calls to the
66 // MessageLoop's Quit method. 66 // MessageLoop's Quit method.
67 void WaitForResponse() { 67 void WaitForResponse() {
68 while (!completed() && !timed_out()) 68 while (!completed() && !timed_out())
69 MessageLoop::current()->Run(); 69 MessageLoop::current()->Run();
70 } 70 }
71 71
72 void StartTimer() { 72 void StartTimer() {
73 timer_.Start(base::TimeDelta::FromMilliseconds(kMaxWaitTimeMs), 73 timer_.Start(FROM_HERE,
74 base::TimeDelta::FromMilliseconds(kMaxWaitTimeMs),
74 this, 75 this,
75 &FetcherDelegate::TimerFired); 76 &FetcherDelegate::TimerFired);
76 } 77 }
77 78
78 void TimerFired() { 79 void TimerFired() {
79 ASSERT_FALSE(completed_); 80 ASSERT_FALSE(completed_);
80 81
81 timed_out_ = true; 82 timed_out_ = true;
82 MessageLoop::current()->Quit(); 83 MessageLoop::current()->Quit();
83 FAIL() << "fetch timed out"; 84 FAIL() << "fetch timed out";
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 scoped_ptr<ResourceFetcher> fetcher(new ResourceFetcherWithTimeout( 206 scoped_ptr<ResourceFetcher> fetcher(new ResourceFetcherWithTimeout(
206 url, frame, WebURLRequest::TargetIsMainFrame, 207 url, frame, WebURLRequest::TargetIsMainFrame,
207 0, delegate->NewCallback())); 208 0, delegate->NewCallback()));
208 delegate->SetFetcher(fetcher.release()); 209 delegate->SetFetcher(fetcher.release());
209 210
210 delegate->WaitForResponse(); 211 delegate->WaitForResponse();
211 EXPECT_FALSE(delegate->timed_out()); 212 EXPECT_FALSE(delegate->timed_out());
212 } 213 }
213 214
214 } // namespace 215 } // namespace
OLDNEW
« no previous file with comments | « webkit/glue/resource_fetcher.cc ('k') | webkit/glue/webkitclient_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698