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

Side by Side Diff: content/browser/service_worker/embedded_worker_instance_unittest.cc

Issue 1223193009: WIP attempt to replace StartWorker/StopWorker IPCs with a new mojo EmbeddedWorker service. Base URL: https://chromium.googlesource.com/chromium/src.git@mojo-event-dispatching-option2
Patch Set: Created 5 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/run_loop.h" 6 #include "base/run_loop.h"
7 #include "base/stl_util.h" 7 #include "base/stl_util.h"
8 #include "content/browser/service_worker/embedded_worker_instance.h" 8 #include "content/browser/service_worker/embedded_worker_instance.h"
9 #include "content/browser/service_worker/embedded_worker_registry.h" 9 #include "content/browser/service_worker/embedded_worker_registry.h"
10 #include "content/browser/service_worker/embedded_worker_test_helper.h" 10 #include "content/browser/service_worker/embedded_worker_test_helper.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 // Stop the worker. 101 // Stop the worker.
102 EXPECT_EQ(SERVICE_WORKER_OK, worker->Stop()); 102 EXPECT_EQ(SERVICE_WORKER_OK, worker->Stop());
103 EXPECT_EQ(EmbeddedWorkerInstance::STOPPING, worker->status()); 103 EXPECT_EQ(EmbeddedWorkerInstance::STOPPING, worker->status());
104 base::RunLoop().RunUntilIdle(); 104 base::RunLoop().RunUntilIdle();
105 105
106 // The 'WorkerStopped' message should have been sent by 106 // The 'WorkerStopped' message should have been sent by
107 // EmbeddedWorkerTestHelper. 107 // EmbeddedWorkerTestHelper.
108 EXPECT_EQ(EmbeddedWorkerInstance::STOPPED, worker->status()); 108 EXPECT_EQ(EmbeddedWorkerInstance::STOPPED, worker->status());
109 109
110 // Verify that we've sent two messages to start and terminate the worker. 110 // Verify that we've sent two messages to start and terminate the worker.
111 ASSERT_TRUE(ipc_sink()->GetUniqueMessageMatching( 111 // ASSERT_TRUE(ipc_sink()->GetUniqueMessageMatching(
112 EmbeddedWorkerMsg_StartWorker::ID)); 112 // EmbeddedWorkerMsg_StartWorker::ID));
113 ASSERT_TRUE(ipc_sink()->GetUniqueMessageMatching( 113 // ASSERT_TRUE(ipc_sink()->GetUniqueMessageMatching(
114 EmbeddedWorkerMsg_StopWorker::ID)); 114 // EmbeddedWorkerMsg_StopWorker::ID));
115 } 115 }
116 116
117 TEST_F(EmbeddedWorkerInstanceTest, StopWhenDevToolsAttached) { 117 TEST_F(EmbeddedWorkerInstanceTest, StopWhenDevToolsAttached) {
118 scoped_ptr<EmbeddedWorkerInstance> worker = 118 scoped_ptr<EmbeddedWorkerInstance> worker =
119 embedded_worker_registry()->CreateWorker(); 119 embedded_worker_registry()->CreateWorker();
120 EXPECT_EQ(EmbeddedWorkerInstance::STOPPED, worker->status()); 120 EXPECT_EQ(EmbeddedWorkerInstance::STOPPED, worker->status());
121 121
122 const int64 service_worker_version_id = 55L; 122 const int64 service_worker_version_id = 55L;
123 const GURL pattern("http://example.com/"); 123 const GURL pattern("http://example.com/");
124 const GURL url("http://example.com/worker.js"); 124 const GURL url("http://example.com/worker.js");
(...skipping 27 matching lines...) Expand all
152 EXPECT_EQ(EmbeddedWorkerInstance::RUNNING, worker->status()); 152 EXPECT_EQ(EmbeddedWorkerInstance::RUNNING, worker->status());
153 153
154 // Calling Stop() actually stops the worker regardless of whether devtools 154 // Calling Stop() actually stops the worker regardless of whether devtools
155 // is attached or not. 155 // is attached or not.
156 EXPECT_EQ(SERVICE_WORKER_OK, worker->Stop()); 156 EXPECT_EQ(SERVICE_WORKER_OK, worker->Stop());
157 base::RunLoop().RunUntilIdle(); 157 base::RunLoop().RunUntilIdle();
158 EXPECT_EQ(EmbeddedWorkerInstance::STOPPED, worker->status()); 158 EXPECT_EQ(EmbeddedWorkerInstance::STOPPED, worker->status());
159 } 159 }
160 160
161 } // namespace content 161 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/service_worker/embedded_worker_instance.cc ('k') | content/browser/service_worker/embedded_worker_registry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698