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

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

Issue 7825026: Revert "Currently, base/timer.cc calls PostTask with FROM_HERE as the Location, (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(FROM_HERE, 73 timer_.Start(base::TimeDelta::FromMilliseconds(kMaxWaitTimeMs),
74 base::TimeDelta::FromMilliseconds(kMaxWaitTimeMs),
75 this, 74 this,
76 &FetcherDelegate::TimerFired); 75 &FetcherDelegate::TimerFired);
77 } 76 }
78 77
79 void TimerFired() { 78 void TimerFired() {
80 ASSERT_FALSE(completed_); 79 ASSERT_FALSE(completed_);
81 80
82 timed_out_ = true; 81 timed_out_ = true;
83 MessageLoop::current()->Quit(); 82 MessageLoop::current()->Quit();
84 FAIL() << "fetch timed out"; 83 FAIL() << "fetch timed out";
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 scoped_ptr<ResourceFetcher> fetcher(new ResourceFetcherWithTimeout( 205 scoped_ptr<ResourceFetcher> fetcher(new ResourceFetcherWithTimeout(
207 url, frame, WebURLRequest::TargetIsMainFrame, 206 url, frame, WebURLRequest::TargetIsMainFrame,
208 0, delegate->NewCallback())); 207 0, delegate->NewCallback()));
209 delegate->SetFetcher(fetcher.release()); 208 delegate->SetFetcher(fetcher.release());
210 209
211 delegate->WaitForResponse(); 210 delegate->WaitForResponse();
212 EXPECT_FALSE(delegate->timed_out()); 211 EXPECT_FALSE(delegate->timed_out());
213 } 212 }
214 213
215 } // namespace 214 } // 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