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

Side by Side Diff: content/browser/geolocation/geolocation_provider_impl_unittest.cc

Issue 2123653003: Remove calls to MessageLoop::current() in content. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 5 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "content/browser/geolocation/geolocation_provider_impl.h" 5 #include "content/browser/geolocation/geolocation_provider_impl.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 bool started; 150 bool started;
151 provider_->task_runner()->PostTaskAndReply( 151 provider_->task_runner()->PostTaskAndReply(
152 FROM_HERE, base::Bind(&GeolocationProviderTest::GetProvidersStarted, 152 FROM_HERE, base::Bind(&GeolocationProviderTest::GetProvidersStarted,
153 base::Unretained(this), &started), 153 base::Unretained(this), &started),
154 base::MessageLoop::QuitWhenIdleClosure()); 154 base::MessageLoop::QuitWhenIdleClosure());
155 base::RunLoop().Run(); 155 base::RunLoop().Run();
156 return started; 156 return started;
157 } 157 }
158 158
159 void GeolocationProviderTest::GetProvidersStarted(bool* started) { 159 void GeolocationProviderTest::GetProvidersStarted(bool* started) {
160 DCHECK(base::MessageLoop::current() == provider_->message_loop()); 160 DCHECK(provider_->task_runner()->BelongsToCurrentThread());
161 *started = provider_->mock_arbitrator()->providers_started(); 161 *started = provider_->mock_arbitrator()->providers_started();
162 } 162 }
163 163
164 void GeolocationProviderTest::SendMockLocation(const Geoposition& position) { 164 void GeolocationProviderTest::SendMockLocation(const Geoposition& position) {
165 DCHECK(provider_->IsRunning()); 165 DCHECK(provider_->IsRunning());
166 DCHECK(base::MessageLoop::current() == &message_loop_); 166 DCHECK(base::MessageLoop::current() == &message_loop_);
167 provider_->task_runner()->PostTask( 167 provider_->task_runner()->PostTask(
168 FROM_HERE, base::Bind(&GeolocationProviderImpl::OnLocationUpdate, 168 FROM_HERE, base::Bind(&GeolocationProviderImpl::OnLocationUpdate,
169 base::Unretained(provider_.get()), position)); 169 base::Unretained(provider_.get()), position));
170 } 170 }
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 &MockGeolocationObserver::OnLocationUpdate, 253 &MockGeolocationObserver::OnLocationUpdate,
254 base::Unretained(&mock_observer)); 254 base::Unretained(&mock_observer));
255 std::unique_ptr<content::GeolocationProvider::Subscription> subscription = 255 std::unique_ptr<content::GeolocationProvider::Subscription> subscription =
256 provider()->AddLocationUpdateCallback(callback, false); 256 provider()->AddLocationUpdateCallback(callback, false);
257 subscription.reset(); 257 subscription.reset();
258 // Wait for the providers to be stopped now that all clients are gone. 258 // Wait for the providers to be stopped now that all clients are gone.
259 EXPECT_FALSE(ProvidersStarted()); 259 EXPECT_FALSE(ProvidersStarted());
260 } 260 }
261 261
262 } // namespace content 262 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/geolocation/geolocation_provider_impl.cc ('k') | content/child/child_process.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698