| OLD | NEW |
| 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 | 135 |
| 136 | 136 |
| 137 bool TestAccountsClient::SendRequest(const GURL& url, string* response) { | 137 bool TestAccountsClient::SendRequest(const GURL& url, string* response) { |
| 138 base::MessageLoop* loop = base::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 = |
| 146 url, net::URLFetcher::POST, &delegate)); | 146 net::URLFetcher::Create(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 base::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 } |
| OLD | NEW |