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 "content/public/browser/service_worker_context.h" | 5 #include "content/public/browser/service_worker_context.h" |
6 | 6 |
7 #include "base/files/scoped_temp_dir.h" | 7 #include "base/files/scoped_temp_dir.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "content/browser/browser_thread_impl.h" | 10 #include "content/browser/browser_thread_impl.h" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 }; | 101 }; |
102 | 102 |
103 } // namespace | 103 } // namespace |
104 | 104 |
105 class ServiceWorkerContextTest : public testing::Test { | 105 class ServiceWorkerContextTest : public testing::Test { |
106 public: | 106 public: |
107 ServiceWorkerContextTest() | 107 ServiceWorkerContextTest() |
108 : browser_thread_bundle_(TestBrowserThreadBundle::IO_MAINLOOP), | 108 : browser_thread_bundle_(TestBrowserThreadBundle::IO_MAINLOOP), |
109 render_process_id_(99) {} | 109 render_process_id_(99) {} |
110 | 110 |
111 virtual void SetUp() override { | 111 void SetUp() override { |
112 helper_.reset(new EmbeddedWorkerTestHelper(render_process_id_)); | 112 helper_.reset(new EmbeddedWorkerTestHelper(render_process_id_)); |
113 } | 113 } |
114 | 114 |
115 virtual void TearDown() override { | 115 void TearDown() override { helper_.reset(); } |
116 helper_.reset(); | |
117 } | |
118 | 116 |
119 ServiceWorkerContextCore* context() { return helper_->context(); } | 117 ServiceWorkerContextCore* context() { return helper_->context(); } |
120 | 118 |
121 protected: | 119 protected: |
122 TestBrowserThreadBundle browser_thread_bundle_; | 120 TestBrowserThreadBundle browser_thread_bundle_; |
123 scoped_ptr<EmbeddedWorkerTestHelper> helper_; | 121 scoped_ptr<EmbeddedWorkerTestHelper> helper_; |
124 const int render_process_id_; | 122 const int render_process_id_; |
125 }; | 123 }; |
126 | 124 |
127 // Make sure basic registration is working. | 125 // Make sure basic registration is working. |
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 false /* expect_waiting */, | 489 false /* expect_waiting */, |
492 true /* expect_active */)); | 490 true /* expect_active */)); |
493 base::RunLoop().RunUntilIdle(); | 491 base::RunLoop().RunUntilIdle(); |
494 | 492 |
495 // The new context should take over next handle ids. | 493 // The new context should take over next handle ids. |
496 EXPECT_EQ(1, context()->GetNewServiceWorkerHandleId()); | 494 EXPECT_EQ(1, context()->GetNewServiceWorkerHandleId()); |
497 EXPECT_EQ(1, context()->GetNewRegistrationHandleId()); | 495 EXPECT_EQ(1, context()->GetNewRegistrationHandleId()); |
498 } | 496 } |
499 | 497 |
500 } // namespace content | 498 } // namespace content |
OLD | NEW |