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" |
11 #include "content/browser/service_worker/service_worker_context_core.h" | 11 #include "content/browser/service_worker/service_worker_context_core.h" |
12 #include "content/browser/service_worker/service_worker_context_wrapper.h" | 12 #include "content/browser/service_worker/service_worker_context_wrapper.h" |
13 #include "content/common/service_worker/embedded_worker_messages.h" | 13 #include "content/common/service_worker/embedded_worker_messages.h" |
14 #include "content/public/test/test_browser_thread_bundle.h" | 14 #include "content/public/test/test_browser_thread_bundle.h" |
15 #include "testing/gmock/include/gmock/gmock.h" | 15 #include "testing/gmock/include/gmock/gmock.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
17 | 17 |
18 namespace content { | 18 namespace content { |
19 | 19 |
20 static const int kRenderProcessId = 11; | 20 static const int kRenderProcessId = 11; |
21 | 21 |
22 class EmbeddedWorkerInstanceTest : public testing::Test { | 22 class EmbeddedWorkerInstanceTest : public testing::Test { |
23 protected: | 23 protected: |
24 EmbeddedWorkerInstanceTest() | 24 EmbeddedWorkerInstanceTest() |
25 : thread_bundle_(TestBrowserThreadBundle::IO_MAINLOOP) {} | 25 : thread_bundle_(TestBrowserThreadBundle::IO_MAINLOOP) {} |
26 | 26 |
27 virtual void SetUp() OVERRIDE { | 27 virtual void SetUp() override { |
28 helper_.reset(new EmbeddedWorkerTestHelper(kRenderProcessId)); | 28 helper_.reset(new EmbeddedWorkerTestHelper(kRenderProcessId)); |
29 } | 29 } |
30 | 30 |
31 virtual void TearDown() OVERRIDE { | 31 virtual void TearDown() override { |
32 helper_.reset(); | 32 helper_.reset(); |
33 } | 33 } |
34 | 34 |
35 ServiceWorkerContextCore* context() { return helper_->context(); } | 35 ServiceWorkerContextCore* context() { return helper_->context(); } |
36 | 36 |
37 EmbeddedWorkerRegistry* embedded_worker_registry() { | 37 EmbeddedWorkerRegistry* embedded_worker_registry() { |
38 DCHECK(context()); | 38 DCHECK(context()); |
39 return context()->embedded_worker_registry(); | 39 return context()->embedded_worker_registry(); |
40 } | 40 } |
41 | 41 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 worker.reset(); | 124 worker.reset(); |
125 run_loop.Run(); | 125 run_loop.Run(); |
126 EXPECT_EQ(SERVICE_WORKER_ERROR_ABORT, status); | 126 EXPECT_EQ(SERVICE_WORKER_ERROR_ABORT, status); |
127 | 127 |
128 // 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. |
129 ASSERT_FALSE( | 129 ASSERT_FALSE( |
130 ipc_sink()->GetUniqueMessageMatching(EmbeddedWorkerMsg_StartWorker::ID)); | 130 ipc_sink()->GetUniqueMessageMatching(EmbeddedWorkerMsg_StartWorker::ID)); |
131 } | 131 } |
132 | 132 |
133 } // namespace content | 133 } // namespace content |
OLD | NEW |