| Index: content/browser/geofencing/geofencing_manager_unittest.cc
|
| diff --git a/content/browser/geofencing/geofencing_manager_unittest.cc b/content/browser/geofencing/geofencing_manager_unittest.cc
|
| index 16cf1bbe895ef89ce2f1d732090e9e3c778d5582..9246f0629358b8112e2bb236eac1282f8d5d4320 100644
|
| --- a/content/browser/geofencing/geofencing_manager_unittest.cc
|
| +++ b/content/browser/geofencing/geofencing_manager_unittest.cc
|
| @@ -19,7 +19,6 @@ typedef std::map<std::string, WebCircularGeofencingRegion> RegionMap;
|
|
|
| namespace {
|
|
|
| -static const int kRenderProcessId = 99;
|
| static const char* kTestRegionId = "region-id";
|
| static const int64 kTestGeofencingRegistrationId = 42;
|
| static const int64 kTestGeofencingRegistrationId2 = 43;
|
| @@ -88,20 +87,20 @@ class StatusCatcher {
|
| scoped_refptr<MessageLoopRunner> runner_;
|
| };
|
|
|
| -void SaveResponseCallback(bool* called,
|
| - int64* store_registration_id,
|
| +void SaveResponseCallback(int64* store_registration_id,
|
| + const scoped_refptr<MessageLoopRunner> runner,
|
| ServiceWorkerStatusCode status,
|
| const std::string& status_message,
|
| int64 registration_id) {
|
| EXPECT_EQ(SERVICE_WORKER_OK, status) << ServiceWorkerStatusToString(status);
|
| - *called = true;
|
| *store_registration_id = registration_id;
|
| + runner->Quit();
|
| }
|
|
|
| ServiceWorkerContextCore::RegistrationCallback MakeRegisteredCallback(
|
| - bool* called,
|
| - int64* store_registration_id) {
|
| - return base::Bind(&SaveResponseCallback, called, store_registration_id);
|
| + int64* store_registration_id,
|
| + const scoped_refptr<MessageLoopRunner>& runner) {
|
| + return base::Bind(&SaveResponseCallback, store_registration_id, runner);
|
| }
|
|
|
| void CallCompletedCallback(bool* called, ServiceWorkerStatusCode) {
|
| @@ -123,8 +122,7 @@ class GeofencingManagerTest : public testing::Test {
|
| }
|
|
|
| void SetUp() override {
|
| - helper_.reset(
|
| - new EmbeddedWorkerTestHelper(base::FilePath(), kRenderProcessId));
|
| + helper_.reset(new EmbeddedWorkerTestHelper(base::FilePath()));
|
| service_ = new TestGeofencingService();
|
| manager_ = new GeofencingManager(helper_->context_wrapper());
|
| manager_->SetServiceForTesting(service_);
|
| @@ -150,14 +148,12 @@ class GeofencingManagerTest : public testing::Test {
|
| GURL pattern("http://www.example.com/" + name);
|
| GURL script_url("http://www.example.com/service_worker.js");
|
| int64 registration_id = kInvalidServiceWorkerRegistrationId;
|
| - bool called = false;
|
| + scoped_refptr<MessageLoopRunner> runner(new MessageLoopRunner);
|
| helper_->context()->RegisterServiceWorker(
|
| pattern, script_url, nullptr,
|
| - MakeRegisteredCallback(&called, ®istration_id));
|
| + MakeRegisteredCallback(®istration_id, runner));
|
|
|
| - EXPECT_FALSE(called);
|
| - base::RunLoop().RunUntilIdle();
|
| - EXPECT_TRUE(called);
|
| + runner->Run();
|
| scoped_refptr<ServiceWorkerRegistration> worker(
|
| new ServiceWorkerRegistration(pattern, registration_id,
|
| helper_->context()->AsWeakPtr()));
|
|
|