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

Side by Side Diff: content/browser/service_worker/service_worker_storage_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: just clear in dtor 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 <string> 5 #include <string>
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/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/thread_task_runner_handle.h" 10 #include "base/thread_task_runner_handle.h"
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 } 192 }
193 193
194 virtual void SetUp() OVERRIDE { 194 virtual void SetUp() OVERRIDE {
195 context_.reset( 195 context_.reset(
196 new ServiceWorkerContextCore(GetUserDataDirectory(), 196 new ServiceWorkerContextCore(GetUserDataDirectory(),
197 base::ThreadTaskRunnerHandle::Get(), 197 base::ThreadTaskRunnerHandle::Get(),
198 base::ThreadTaskRunnerHandle::Get(), 198 base::ThreadTaskRunnerHandle::Get(),
199 base::ThreadTaskRunnerHandle::Get(), 199 base::ThreadTaskRunnerHandle::Get(),
200 NULL, 200 NULL,
201 NULL, 201 NULL,
202 NULL,
202 NULL)); 203 NULL));
203 context_ptr_ = context_->AsWeakPtr(); 204 context_ptr_ = context_->AsWeakPtr();
204 } 205 }
205 206
206 virtual void TearDown() OVERRIDE { 207 virtual void TearDown() OVERRIDE {
207 context_.reset(); 208 context_.reset();
208 } 209 }
209 210
210 virtual base::FilePath GetUserDataDirectory() { return base::FilePath(); } 211 virtual base::FilePath GetUserDataDirectory() { return base::FilePath(); }
211 212
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after
810 // Simulate browser shutdown. The purgeable and uncommitted resources are now 811 // Simulate browser shutdown. The purgeable and uncommitted resources are now
811 // stale. 812 // stale.
812 context_.reset(); 813 context_.reset();
813 context_.reset( 814 context_.reset(
814 new ServiceWorkerContextCore(GetUserDataDirectory(), 815 new ServiceWorkerContextCore(GetUserDataDirectory(),
815 base::ThreadTaskRunnerHandle::Get(), 816 base::ThreadTaskRunnerHandle::Get(),
816 base::ThreadTaskRunnerHandle::Get(), 817 base::ThreadTaskRunnerHandle::Get(),
817 base::ThreadTaskRunnerHandle::Get(), 818 base::ThreadTaskRunnerHandle::Get(),
818 NULL, 819 NULL,
819 NULL, 820 NULL,
821 NULL,
820 NULL)); 822 NULL));
821 storage()->LazyInitialize(base::Bind(&base::DoNothing)); 823 storage()->LazyInitialize(base::Bind(&base::DoNothing));
822 base::RunLoop().RunUntilIdle(); 824 base::RunLoop().RunUntilIdle();
823 825
824 // Store a new uncommitted resource. This triggers stale resource cleanup. 826 // Store a new uncommitted resource. This triggers stale resource cleanup.
825 int64 kNewResourceId = storage()->NewResourceId(); 827 int64 kNewResourceId = storage()->NewResourceId();
826 WriteBasicResponse(storage(), kNewResourceId); 828 WriteBasicResponse(storage(), kNewResourceId);
827 storage()->StoreUncommittedResponseId(kNewResourceId); 829 storage()->StoreUncommittedResponseId(kNewResourceId);
828 base::RunLoop().RunUntilIdle(); 830 base::RunLoop().RunUntilIdle();
829 831
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
1038 are_equal = true; 1040 are_equal = true;
1039 storage()->CompareScriptResources( 1041 storage()->CompareScriptResources(
1040 5, 6, 1042 5, 6,
1041 base::Bind(&OnCompareComplete, &status, &are_equal)); 1043 base::Bind(&OnCompareComplete, &status, &are_equal));
1042 base::RunLoop().RunUntilIdle(); 1044 base::RunLoop().RunUntilIdle();
1043 EXPECT_EQ(SERVICE_WORKER_OK, status); 1045 EXPECT_EQ(SERVICE_WORKER_OK, status);
1044 EXPECT_FALSE(are_equal); 1046 EXPECT_FALSE(are_equal);
1045 } 1047 }
1046 1048
1047 } // namespace content 1049 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698