| 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 <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 1376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1387 storage()->NotifyDoneInstallingRegistration( | 1387 storage()->NotifyDoneInstallingRegistration( |
| 1388 live_registration3.get(), NULL, SERVICE_WORKER_OK); | 1388 live_registration3.get(), NULL, SERVICE_WORKER_OK); |
| 1389 | 1389 |
| 1390 // Find a registration among installed ones. | 1390 // Find a registration among installed ones. |
| 1391 EXPECT_EQ(SERVICE_WORKER_OK, | 1391 EXPECT_EQ(SERVICE_WORKER_OK, |
| 1392 FindRegistrationForDocument(kDocumentUrl, &found_registration)); | 1392 FindRegistrationForDocument(kDocumentUrl, &found_registration)); |
| 1393 EXPECT_EQ(live_registration2, found_registration); | 1393 EXPECT_EQ(live_registration2, found_registration); |
| 1394 } | 1394 } |
| 1395 | 1395 |
| 1396 TEST_F(ServiceWorkerStorageTest, CompareResources) { | 1396 TEST_F(ServiceWorkerStorageTest, CompareResources) { |
| 1397 LazyInitialize(); |
| 1398 |
| 1397 // Compare two small responses containing the same data. | 1399 // Compare two small responses containing the same data. |
| 1398 WriteBasicResponse(storage(), 1); | 1400 WriteBasicResponse(storage(), 1); |
| 1399 WriteBasicResponse(storage(), 2); | 1401 WriteBasicResponse(storage(), 2); |
| 1400 ServiceWorkerStatusCode status = static_cast<ServiceWorkerStatusCode>(-1); | 1402 ServiceWorkerStatusCode status = static_cast<ServiceWorkerStatusCode>(-1); |
| 1401 bool are_equal = false; | 1403 bool are_equal = false; |
| 1402 storage()->CompareScriptResources( | 1404 storage()->CompareScriptResources( |
| 1403 1, 2, | 1405 1, 2, |
| 1404 base::Bind(&OnCompareComplete, &status, &are_equal)); | 1406 base::Bind(&OnCompareComplete, &status, &are_equal)); |
| 1405 base::RunLoop().RunUntilIdle(); | 1407 base::RunLoop().RunUntilIdle(); |
| 1406 EXPECT_EQ(SERVICE_WORKER_OK, status); | 1408 EXPECT_EQ(SERVICE_WORKER_OK, status); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1449 are_equal = true; | 1451 are_equal = true; |
| 1450 storage()->CompareScriptResources( | 1452 storage()->CompareScriptResources( |
| 1451 5, 6, | 1453 5, 6, |
| 1452 base::Bind(&OnCompareComplete, &status, &are_equal)); | 1454 base::Bind(&OnCompareComplete, &status, &are_equal)); |
| 1453 base::RunLoop().RunUntilIdle(); | 1455 base::RunLoop().RunUntilIdle(); |
| 1454 EXPECT_EQ(SERVICE_WORKER_OK, status); | 1456 EXPECT_EQ(SERVICE_WORKER_OK, status); |
| 1455 EXPECT_FALSE(are_equal); | 1457 EXPECT_FALSE(are_equal); |
| 1456 } | 1458 } |
| 1457 | 1459 |
| 1458 } // namespace content | 1460 } // namespace content |
| OLD | NEW |