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

Side by Side Diff: sync/test/accounts_client/test_accounts_client.cc

Issue 16092013: Use base::MessageLoop in more files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase again, sigh 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
« no previous file with comments | « sync/test/accounts_client/test_accounts_client.h ('k') | ui/aura/dispatcher_win.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "sync/test/accounts_client/test_accounts_client.h" 5 #include "sync/test/accounts_client/test_accounts_client.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 string response; 128 string response;
129 SendRequest(url, &response); 129 SendRequest(url, &response);
130 } 130 }
131 131
132 GURL TestAccountsClient::CreateGURLWithPath(const string& path) { 132 GURL TestAccountsClient::CreateGURLWithPath(const string& path) {
133 return GURL(base::StringPrintf("%s/%s", server_.c_str(), path.c_str())); 133 return GURL(base::StringPrintf("%s/%s", server_.c_str(), path.c_str()));
134 } 134 }
135 135
136 136
137 bool TestAccountsClient::SendRequest(const GURL& url, string* response) { 137 bool TestAccountsClient::SendRequest(const GURL& url, string* response) {
138 MessageLoop* loop = MessageLoop::current(); 138 base::MessageLoop* loop = base::MessageLoop::current();
139 scoped_refptr<URLRequestContextGetter> context_getter( 139 scoped_refptr<URLRequestContextGetter> context_getter(
140 new URLRequestContextGetter(loop->message_loop_proxy())); 140 new URLRequestContextGetter(loop->message_loop_proxy()));
141 141
142 base::RunLoop run_loop; 142 base::RunLoop run_loop;
143 143
144 AccountsRequestDelegate delegate(&run_loop); 144 AccountsRequestDelegate delegate(&run_loop);
145 scoped_ptr<net::URLFetcher> fetcher(net::URLFetcher::Create( 145 scoped_ptr<net::URLFetcher> fetcher(net::URLFetcher::Create(
146 url, net::URLFetcher::POST, &delegate)); 146 url, net::URLFetcher::POST, &delegate));
147 fetcher->SetRequestContext(context_getter.get()); 147 fetcher->SetRequestContext(context_getter.get());
148 fetcher->SetUploadData("application/json", ""); 148 fetcher->SetUploadData("application/json", "");
149 fetcher->Start(); 149 fetcher->Start();
150 150
151 MessageLoop::current()->PostDelayedTask(FROM_HERE, 151 base::MessageLoop::current()->PostDelayedTask(FROM_HERE,
152 run_loop.QuitClosure(), 152 run_loop.QuitClosure(),
153 kRequestTimeout); 153 kRequestTimeout);
154 run_loop.Run(); 154 run_loop.Run();
155 155
156 if (delegate.success()) { 156 if (delegate.success()) {
157 *response = delegate.response(); 157 *response = delegate.response();
158 } 158 }
159 159
160 return delegate.success(); 160 return delegate.success();
161 } 161 }
OLDNEW
« no previous file with comments | « sync/test/accounts_client/test_accounts_client.h ('k') | ui/aura/dispatcher_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698