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 1607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1618 base::WeakPtr<EmbeddedWorkerTestHelper> helper) | 1618 base::WeakPtr<EmbeddedWorkerTestHelper> helper) |
1619 : EmbeddedWorkerTestHelper::MockEmbeddedWorkerInstanceClient(helper) {} | 1619 : EmbeddedWorkerTestHelper::MockEmbeddedWorkerInstanceClient(helper) {} |
1620 int num_of_startworker() const { return num_of_startworker_; } | 1620 int num_of_startworker() const { return num_of_startworker_; } |
1621 void set_next_pause_after_download(bool expectation) { | 1621 void set_next_pause_after_download(bool expectation) { |
1622 next_pause_after_download_ = expectation; | 1622 next_pause_after_download_ = expectation; |
1623 } | 1623 } |
1624 | 1624 |
1625 protected: | 1625 protected: |
1626 void StartWorker( | 1626 void StartWorker( |
1627 const EmbeddedWorkerStartParams& params, | 1627 const EmbeddedWorkerStartParams& params, |
1628 service_manager::mojom::InterfaceProviderPtr browser_interfaces, | 1628 mojom::ServiceWorkerEventDispatcherRequest request) override { |
1629 service_manager::mojom::InterfaceProviderRequest renderer_request) | |
1630 override { | |
1631 ASSERT_TRUE(next_pause_after_download_.has_value()); | 1629 ASSERT_TRUE(next_pause_after_download_.has_value()); |
1632 EXPECT_EQ(next_pause_after_download_.value(), params.pause_after_download); | 1630 EXPECT_EQ(next_pause_after_download_.value(), params.pause_after_download); |
1633 num_of_startworker_++; | 1631 num_of_startworker_++; |
1634 EmbeddedWorkerTestHelper::MockEmbeddedWorkerInstanceClient::StartWorker( | 1632 EmbeddedWorkerTestHelper::MockEmbeddedWorkerInstanceClient::StartWorker( |
1635 params, std::move(browser_interfaces), std::move(renderer_request)); | 1633 params, std::move(request)); |
1636 } | 1634 } |
1637 | 1635 |
1638 private: | 1636 private: |
1639 base::Optional<bool> next_pause_after_download_; | 1637 base::Optional<bool> next_pause_after_download_; |
1640 int num_of_startworker_ = 0; | 1638 int num_of_startworker_ = 0; |
1641 DISALLOW_COPY_AND_ASSIGN(CheckPauseAfterDownloadEmbeddedWorkerInstanceClient); | 1639 DISALLOW_COPY_AND_ASSIGN(CheckPauseAfterDownloadEmbeddedWorkerInstanceClient); |
1642 }; | 1640 }; |
1643 | 1641 |
1644 TEST_P(ServiceWorkerJobTestP, Update_PauseAfterDownload) { | 1642 TEST_P(ServiceWorkerJobTestP, Update_PauseAfterDownload) { |
1645 UpdateJobTestHelper* update_helper = new UpdateJobTestHelper; | 1643 UpdateJobTestHelper* update_helper = new UpdateJobTestHelper; |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1749 EXPECT_EQ(new_version.get(), registration->active_version()); | 1747 EXPECT_EQ(new_version.get(), registration->active_version()); |
1750 EXPECT_EQ(ServiceWorkerVersion::ACTIVATING, new_version->status()); | 1748 EXPECT_EQ(ServiceWorkerVersion::ACTIVATING, new_version->status()); |
1751 registration->RemoveListener(update_helper); | 1749 registration->RemoveListener(update_helper); |
1752 } | 1750 } |
1753 | 1751 |
1754 INSTANTIATE_TEST_CASE_P(ServiceWorkerJobTest, | 1752 INSTANTIATE_TEST_CASE_P(ServiceWorkerJobTest, |
1755 ServiceWorkerJobTestP, | 1753 ServiceWorkerJobTestP, |
1756 ::testing::Values(false, true)); | 1754 ::testing::Values(false, true)); |
1757 | 1755 |
1758 } // namespace content | 1756 } // namespace content |
OLD | NEW |