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

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

Issue 1152543002: ServiceWorker: Migrate the script cache backend from BlockFile to Simple (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 6 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 1388 matching lines...) Expand 10 before | Expand all | Expand 10 after
1399 storage()->NotifyDoneInstallingRegistration( 1399 storage()->NotifyDoneInstallingRegistration(
1400 live_registration3.get(), NULL, SERVICE_WORKER_OK); 1400 live_registration3.get(), NULL, SERVICE_WORKER_OK);
1401 1401
1402 // Find a registration among installed ones. 1402 // Find a registration among installed ones.
1403 EXPECT_EQ(SERVICE_WORKER_OK, 1403 EXPECT_EQ(SERVICE_WORKER_OK,
1404 FindRegistrationForDocument(kDocumentUrl, &found_registration)); 1404 FindRegistrationForDocument(kDocumentUrl, &found_registration));
1405 EXPECT_EQ(live_registration2, found_registration); 1405 EXPECT_EQ(live_registration2, found_registration);
1406 } 1406 }
1407 1407
1408 TEST_F(ServiceWorkerStorageTest, CompareResources) { 1408 TEST_F(ServiceWorkerStorageTest, CompareResources) {
1409 LazyInitialize();
1410
1409 // Compare two small responses containing the same data. 1411 // Compare two small responses containing the same data.
1410 WriteBasicResponse(storage(), 1); 1412 WriteBasicResponse(storage(), 1);
1411 WriteBasicResponse(storage(), 2); 1413 WriteBasicResponse(storage(), 2);
1412 ServiceWorkerStatusCode status = static_cast<ServiceWorkerStatusCode>(-1); 1414 ServiceWorkerStatusCode status = static_cast<ServiceWorkerStatusCode>(-1);
1413 bool are_equal = false; 1415 bool are_equal = false;
1414 storage()->CompareScriptResources( 1416 storage()->CompareScriptResources(
1415 1, 2, 1417 1, 2,
1416 base::Bind(&OnCompareComplete, &status, &are_equal)); 1418 base::Bind(&OnCompareComplete, &status, &are_equal));
1417 base::RunLoop().RunUntilIdle(); 1419 base::RunLoop().RunUntilIdle();
1418 EXPECT_EQ(SERVICE_WORKER_OK, status); 1420 EXPECT_EQ(SERVICE_WORKER_OK, status);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1461 are_equal = true; 1463 are_equal = true;
1462 storage()->CompareScriptResources( 1464 storage()->CompareScriptResources(
1463 5, 6, 1465 5, 6,
1464 base::Bind(&OnCompareComplete, &status, &are_equal)); 1466 base::Bind(&OnCompareComplete, &status, &are_equal));
1465 base::RunLoop().RunUntilIdle(); 1467 base::RunLoop().RunUntilIdle();
1466 EXPECT_EQ(SERVICE_WORKER_OK, status); 1468 EXPECT_EQ(SERVICE_WORKER_OK, status);
1467 EXPECT_FALSE(are_equal); 1469 EXPECT_FALSE(are_equal);
1468 } 1470 }
1469 1471
1470 } // namespace content 1472 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/service_worker/service_worker_storage.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698