OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <stdint.h> | 5 #include <stdint.h> |
6 #include <tuple> | 6 #include <tuple> |
7 | 7 |
8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 1463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1474 void OnInstallEvent(int embedded_worker_id, | 1474 void OnInstallEvent(int embedded_worker_id, |
1475 int request_id) override { | 1475 int request_id) override { |
1476 if (!install_callback_.is_null()) | 1476 if (!install_callback_.is_null()) |
1477 install_callback_.Run(); | 1477 install_callback_.Run(); |
1478 SimulateSend(new ServiceWorkerHostMsg_InstallEventFinished( | 1478 SimulateSend(new ServiceWorkerHostMsg_InstallEventFinished( |
1479 embedded_worker_id, request_id, install_event_result_, | 1479 embedded_worker_id, request_id, install_event_result_, |
1480 has_fetch_handler_, base::Time::Now())); | 1480 has_fetch_handler_, base::Time::Now())); |
1481 } | 1481 } |
1482 | 1482 |
1483 void OnActivateEvent( | 1483 void OnActivateEvent( |
1484 const mojom::ServiceWorkerEventDispatcher::DispatchActivateEventCallback& | 1484 mojom::ServiceWorkerEventDispatcher::DispatchActivateEventCallback |
1485 callback) override { | 1485 callback) override { |
1486 callback.Run(EventResultToStatus(activate_event_result_), | 1486 std::move(callback).Run(EventResultToStatus(activate_event_result_), |
1487 base::Time::Now()); | 1487 base::Time::Now()); |
1488 } | 1488 } |
1489 | 1489 |
1490 void set_install_callback(const base::Closure& callback) { | 1490 void set_install_callback(const base::Closure& callback) { |
1491 install_callback_ = callback; | 1491 install_callback_ = callback; |
1492 } | 1492 } |
1493 void set_install_event_result(blink::WebServiceWorkerEventResult result) { | 1493 void set_install_event_result(blink::WebServiceWorkerEventResult result) { |
1494 install_event_result_ = result; | 1494 install_event_result_ = result; |
1495 } | 1495 } |
1496 void set_activate_event_result(blink::WebServiceWorkerEventResult result) { | 1496 void set_activate_event_result(blink::WebServiceWorkerEventResult result) { |
1497 activate_event_result_ = result; | 1497 activate_event_result_ = result; |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1749 // should not be promoted to ACTIVATED because failure occur | 1749 // should not be promoted to ACTIVATED because failure occur |
1750 // during shutdown. | 1750 // during shutdown. |
1751 runner->RunUntilIdle(); | 1751 runner->RunUntilIdle(); |
1752 base::RunLoop().RunUntilIdle(); | 1752 base::RunLoop().RunUntilIdle(); |
1753 EXPECT_EQ(new_version.get(), registration->active_version()); | 1753 EXPECT_EQ(new_version.get(), registration->active_version()); |
1754 EXPECT_EQ(ServiceWorkerVersion::ACTIVATING, new_version->status()); | 1754 EXPECT_EQ(ServiceWorkerVersion::ACTIVATING, new_version->status()); |
1755 registration->RemoveListener(update_helper); | 1755 registration->RemoveListener(update_helper); |
1756 } | 1756 } |
1757 | 1757 |
1758 } // namespace content | 1758 } // namespace content |
OLD | NEW |