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

Unified Diff: content/browser/service_worker/service_worker_dispatcher_host_unittest.cc

Issue 2787883003: [ServiceWorker] Add EmbeddedWorkerInstanceHost Interface. (Closed)
Patch Set: Fix test: ServiceWorkerContextTest.UnregisterMultiple Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/service_worker/service_worker_dispatcher_host_unittest.cc
diff --git a/content/browser/service_worker/service_worker_dispatcher_host_unittest.cc b/content/browser/service_worker/service_worker_dispatcher_host_unittest.cc
index 0c3fdb678eea6b56ab493ca2eba85d61c9dd2b4d..44f58abcbe386fe4c686eb4ff1772eda855aa426 100644
--- a/content/browser/service_worker/service_worker_dispatcher_host_unittest.cc
+++ b/content/browser/service_worker/service_worker_dispatcher_host_unittest.cc
@@ -50,6 +50,12 @@ void SetUpDummyMessagePort(std::vector<MessagePort>* ports) {
ports->push_back(MessagePort(std::move(pipe.handle0)));
}
+void NestedLoopRunUntilIdle() {
+ base::MessageLoop::ScopedNestableTaskAllower nestable_allower(
+ base::MessageLoop::current());
+ base::RunLoop().RunUntilIdle();
+}
shimazu 2017/04/06 05:01:36 I still don't understand why we need nested loop h
leonhsl(Using Gerrit) 2017/04/06 09:58:55 Yeah actually we do not need nested loop here, I s
+
} // namespace
static const int kRenderFrameId = 1;
@@ -84,15 +90,18 @@ class FailToStartWorkerTestHelper : public EmbeddedWorkerTestHelper {
public:
FailToStartWorkerTestHelper() : EmbeddedWorkerTestHelper(base::FilePath()) {}
- void OnStartWorker(
- int embedded_worker_id,
- int64_t service_worker_version_id,
- const GURL& scope,
- const GURL& script_url,
- bool pause_after_download,
- mojom::ServiceWorkerEventDispatcherRequest request) override {
- EmbeddedWorkerInstance* worker = registry()->GetWorker(embedded_worker_id);
- registry()->OnWorkerStopped(worker->process_id(), embedded_worker_id);
+ void OnStartWorker(int embedded_worker_id,
+ int64_t service_worker_version_id,
+ const GURL& scope,
+ const GURL& script_url,
+ bool pause_after_download,
+ mojom::ServiceWorkerEventDispatcherRequest request,
+ mojom::EmbeddedWorkerInstanceHostAssociatedPtrInfo
+ instance_host) override {
+ mojom::EmbeddedWorkerInstanceHostAssociatedPtr instance_host_ptr;
+ instance_host_ptr.Bind(std::move(instance_host));
+ instance_host_ptr->OnStopped();
+ NestedLoopRunUntilIdle();
}
};

Powered by Google App Engine
This is Rietveld 408576698