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

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

Issue 633873002: Service Worker: Respect the "clear on exit" content setting (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@contentsettings
Patch Set: sync Created 6 years, 2 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 "content/browser/service_worker/service_worker_registration.h" 5 #include "content/browser/service_worker/service_worker_registration.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 "base/run_loop.h" 10 #include "base/run_loop.h"
11 #include "base/thread_task_runner_handle.h" 11 #include "base/thread_task_runner_handle.h"
12 #include "content/browser/browser_thread_impl.h" 12 #include "content/browser/browser_thread_impl.h"
13 #include "content/browser/service_worker/service_worker_context_core.h" 13 #include "content/browser/service_worker/service_worker_context_core.h"
14 #include "content/browser/service_worker/service_worker_registration_handle.h" 14 #include "content/browser/service_worker/service_worker_registration_handle.h"
15 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
16 #include "url/gurl.h" 16 #include "url/gurl.h"
17 17
18 namespace content { 18 namespace content {
19 19
20 class ServiceWorkerRegistrationTest : public testing::Test { 20 class ServiceWorkerRegistrationTest : public testing::Test {
21 public: 21 public:
22 ServiceWorkerRegistrationTest() 22 ServiceWorkerRegistrationTest()
23 : io_thread_(BrowserThread::IO, &message_loop_) {} 23 : io_thread_(BrowserThread::IO, &message_loop_) {}
24 24
25 virtual void SetUp() override { 25 virtual void SetUp() override {
26 scoped_ptr<ServiceWorkerDatabaseTaskManager> database_task_manager(
27 new MockServiceWorkerDatabaseTaskManager(
28 base::ThreadTaskRunnerHandle::Get()));
26 context_.reset( 29 context_.reset(
27 new ServiceWorkerContextCore(base::FilePath(), 30 new ServiceWorkerContextCore(base::FilePath(),
28 base::ThreadTaskRunnerHandle::Get(), 31 base::ThreadTaskRunnerHandle::Get(),
29 base::ThreadTaskRunnerHandle::Get(), 32 database_task_manager.Pass(),
30 base::ThreadTaskRunnerHandle::Get(), 33 base::ThreadTaskRunnerHandle::Get(),
31 NULL, 34 NULL,
32 NULL, 35 NULL,
36 NULL,
33 NULL)); 37 NULL));
34 context_ptr_ = context_->AsWeakPtr(); 38 context_ptr_ = context_->AsWeakPtr();
35 } 39 }
36 40
37 virtual void TearDown() override { 41 virtual void TearDown() override {
38 context_.reset(); 42 context_.reset();
39 base::RunLoop().RunUntilIdle(); 43 base::RunLoop().RunUntilIdle();
40 } 44 }
41 45
42 class RegistrationListener : public ServiceWorkerRegistration::Listener { 46 class RegistrationListener : public ServiceWorkerRegistration::Listener {
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 scoped_ptr<ServiceWorkerRegistrationHandle> handle( 173 scoped_ptr<ServiceWorkerRegistrationHandle> handle(
170 new ServiceWorkerRegistrationHandle(context_ptr_, 174 new ServiceWorkerRegistrationHandle(context_ptr_,
171 NULL, 175 NULL,
172 kProviderId, 176 kProviderId,
173 registration.get())); 177 registration.get()));
174 registration->NotifyRegistrationFailed(); 178 registration->NotifyRegistrationFailed();
175 // Don't crash when handle gets destructed. 179 // Don't crash when handle gets destructed.
176 } 180 }
177 181
178 } // namespace content 182 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698