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

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

Issue 2105173004: Remove calls to MessageLoop::current() in content. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 bool started; 149 bool started;
150 provider_->task_runner()->PostTaskAndReply( 150 provider_->task_runner()->PostTaskAndReply(
151 FROM_HERE, base::Bind(&GeolocationProviderTest::GetProvidersStarted, 151 FROM_HERE, base::Bind(&GeolocationProviderTest::GetProvidersStarted,
152 base::Unretained(this), &started), 152 base::Unretained(this), &started),
153 base::MessageLoop::QuitWhenIdleClosure()); 153 base::MessageLoop::QuitWhenIdleClosure());
154 message_loop_.Run(); 154 message_loop_.Run();
155 return started; 155 return started;
156 } 156 }
157 157
158 void GeolocationProviderTest::GetProvidersStarted(bool* started) { 158 void GeolocationProviderTest::GetProvidersStarted(bool* started) {
159 DCHECK(base::MessageLoop::current() == provider_->message_loop()); 159 DCHECK(provider_->task_runner()->BelongsToCurrentThread());
160 *started = provider_->mock_arbitrator()->providers_started(); 160 *started = provider_->mock_arbitrator()->providers_started();
161 } 161 }
162 162
163 void GeolocationProviderTest::SendMockLocation(const Geoposition& position) { 163 void GeolocationProviderTest::SendMockLocation(const Geoposition& position) {
164 DCHECK(provider_->IsRunning()); 164 DCHECK(provider_->IsRunning());
165 DCHECK(base::MessageLoop::current() == &message_loop_); 165 DCHECK(base::MessageLoop::current() == &message_loop_);
166 provider_->task_runner()->PostTask( 166 provider_->task_runner()->PostTask(
167 FROM_HERE, base::Bind(&GeolocationProviderImpl::OnLocationUpdate, 167 FROM_HERE, base::Bind(&GeolocationProviderImpl::OnLocationUpdate,
168 base::Unretained(provider_.get()), position)); 168 base::Unretained(provider_.get()), position));
169 } 169 }
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 &MockGeolocationObserver::OnLocationUpdate, 252 &MockGeolocationObserver::OnLocationUpdate,
253 base::Unretained(&mock_observer)); 253 base::Unretained(&mock_observer));
254 std::unique_ptr<content::GeolocationProvider::Subscription> subscription = 254 std::unique_ptr<content::GeolocationProvider::Subscription> subscription =
255 provider()->AddLocationUpdateCallback(callback, false); 255 provider()->AddLocationUpdateCallback(callback, false);
256 subscription.reset(); 256 subscription.reset();
257 // Wait for the providers to be stopped now that all clients are gone. 257 // Wait for the providers to be stopped now that all clients are gone.
258 EXPECT_FALSE(ProvidersStarted()); 258 EXPECT_FALSE(ProvidersStarted());
259 } 259 }
260 260
261 } // namespace content 261 } // 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