OLD | NEW |
---|---|
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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
67 | 67 |
68 // Start should succeed. | 68 // Start should succeed. |
69 ServiceWorkerStatusCode status; | 69 ServiceWorkerStatusCode status; |
70 base::RunLoop run_loop; | 70 base::RunLoop run_loop; |
71 worker->Start( | 71 worker->Start( |
72 service_worker_version_id, | 72 service_worker_version_id, |
73 pattern, | 73 pattern, |
74 url, | 74 url, |
75 false, | 75 false, |
76 base::Bind(&SaveStatusAndCall, &status, run_loop.QuitClosure())); | 76 base::Bind(&SaveStatusAndCall, &status, run_loop.QuitClosure())); |
77 EXPECT_EQ(EmbeddedWorkerInstance::STARTING, worker->status()); | |
77 run_loop.Run(); | 78 run_loop.Run(); |
79 base::RunLoop().RunUntilIdle(); | |
falken
2014/11/06 03:15:31
I'm not sure I understand base::RunLoop. Do you ne
nhiroki
2014/11/06 04:12:46
Yes, this is not necessary. Removed.
(I thought t
| |
80 | |
81 // Script evaluated message should be notified (by EmbeddedWorkerTestHelper). | |
falken
2014/11/06 03:15:31
I don't understand this comment, both the wording
nhiroki
2014/11/06 04:12:46
Fixed.
| |
78 EXPECT_EQ(SERVICE_WORKER_OK, status); | 82 EXPECT_EQ(SERVICE_WORKER_OK, status); |
79 EXPECT_EQ(EmbeddedWorkerInstance::STARTING, worker->status()); | |
80 base::RunLoop().RunUntilIdle(); | |
81 | 83 |
82 // Worker started message should be notified (by EmbeddedWorkerTestHelper). | 84 // Worker started message should be notified (by EmbeddedWorkerTestHelper). |
83 EXPECT_EQ(EmbeddedWorkerInstance::RUNNING, worker->status()); | 85 EXPECT_EQ(EmbeddedWorkerInstance::RUNNING, worker->status()); |
84 EXPECT_EQ(kRenderProcessId, worker->process_id()); | 86 EXPECT_EQ(kRenderProcessId, worker->process_id()); |
85 | 87 |
86 // Stop the worker. | 88 // Stop the worker. |
87 EXPECT_EQ(SERVICE_WORKER_OK, worker->Stop()); | 89 EXPECT_EQ(SERVICE_WORKER_OK, worker->Stop()); |
88 EXPECT_EQ(EmbeddedWorkerInstance::STOPPING, worker->status()); | 90 EXPECT_EQ(EmbeddedWorkerInstance::STOPPING, worker->status()); |
89 base::RunLoop().RunUntilIdle(); | 91 base::RunLoop().RunUntilIdle(); |
90 | 92 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
122 worker.reset(); | 124 worker.reset(); |
123 run_loop.Run(); | 125 run_loop.Run(); |
124 EXPECT_EQ(SERVICE_WORKER_ERROR_ABORT, status); | 126 EXPECT_EQ(SERVICE_WORKER_ERROR_ABORT, status); |
125 | 127 |
126 // Verify that we didn't send the message to start the worker. | 128 // Verify that we didn't send the message to start the worker. |
127 ASSERT_FALSE( | 129 ASSERT_FALSE( |
128 ipc_sink()->GetUniqueMessageMatching(EmbeddedWorkerMsg_StartWorker::ID)); | 130 ipc_sink()->GetUniqueMessageMatching(EmbeddedWorkerMsg_StartWorker::ID)); |
129 } | 131 } |
130 | 132 |
131 } // namespace content | 133 } // namespace content |
OLD | NEW |