| Index: content/browser/background_sync/background_sync_service_impl_unittest.cc
|
| diff --git a/content/browser/background_sync/background_sync_service_impl_unittest.cc b/content/browser/background_sync/background_sync_service_impl_unittest.cc
|
| index dbea4ba337cf10079b885a41565253ae7f34ac78..a62277467ee1dd44141f8a470de852ac8175b426 100644
|
| --- a/content/browser/background_sync/background_sync_service_impl_unittest.cc
|
| +++ b/content/browser/background_sync/background_sync_service_impl_unittest.cc
|
| @@ -15,6 +15,7 @@
|
| #include "content/browser/service_worker/service_worker_context_wrapper.h"
|
| #include "content/public/browser/browser_thread.h"
|
| #include "content/public/test/test_browser_thread_bundle.h"
|
| +#include "content/public/test/test_utils.h"
|
| #include "mojo/public/cpp/bindings/interface_ptr.h"
|
| #include "net/base/network_change_notifier.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
| @@ -25,18 +26,18 @@ namespace {
|
|
|
| const char kServiceWorkerPattern[] = "https://example.com/a";
|
| const char kServiceWorkerScript[] = "https://example.com/a/script.js";
|
| -const int kRenderProcessId = 99;
|
|
|
| // Callbacks from SetUp methods
|
|
|
| -void RegisterServiceWorkerCallback(bool* called,
|
| - int64* store_registration_id,
|
| - ServiceWorkerStatusCode status,
|
| - const std::string& status_message,
|
| - int64 registration_id) {
|
| +void RegisterServiceWorkerCallback(
|
| + const scoped_refptr<MessageLoopRunner>& runner,
|
| + int64* store_registration_id,
|
| + 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();
|
| }
|
|
|
| void FindServiceWorkerRegistrationCallback(
|
| @@ -112,7 +113,7 @@ class BackgroundSyncServiceImplTest : public testing::Test {
|
| // SetUp helper methods
|
| void CreateTestHelper() {
|
| embedded_worker_helper_.reset(
|
| - new EmbeddedWorkerTestHelper(base::FilePath(), kRenderProcessId));
|
| + new EmbeddedWorkerTestHelper(base::FilePath()));
|
| }
|
|
|
| void CreateBackgroundSyncContext() {
|
| @@ -135,13 +136,12 @@ class BackgroundSyncServiceImplTest : public testing::Test {
|
| }
|
|
|
| void CreateServiceWorkerRegistration() {
|
| - bool called = false;
|
| + scoped_refptr<MessageLoopRunner> runner(new MessageLoopRunner);
|
| embedded_worker_helper_->context()->RegisterServiceWorker(
|
| GURL(kServiceWorkerPattern), GURL(kServiceWorkerScript), NULL,
|
| - base::Bind(&RegisterServiceWorkerCallback, &called,
|
| + base::Bind(&RegisterServiceWorkerCallback, runner,
|
| &sw_registration_id_));
|
| - base::RunLoop().RunUntilIdle();
|
| - EXPECT_TRUE(called);
|
| + runner->Run();
|
| embedded_worker_helper_->context_wrapper()->FindRegistrationForId(
|
| sw_registration_id_, GURL(kServiceWorkerPattern).GetOrigin(),
|
| base::Bind(FindServiceWorkerRegistrationCallback, &sw_registration_));
|
|
|