| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "chrome/browser/installable/installable_manager.h" | 5 #include "chrome/browser/installable/installable_manager.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "base/threading/thread_task_runner_handle.h" | 9 #include "base/threading/thread_task_runner_handle.h" |
| 10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| (...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 613 | 613 |
| 614 EXPECT_TRUE(tester->primary_icon_url().is_empty()); | 614 EXPECT_TRUE(tester->primary_icon_url().is_empty()); |
| 615 EXPECT_EQ(nullptr, tester->primary_icon()); | 615 EXPECT_EQ(nullptr, tester->primary_icon()); |
| 616 EXPECT_TRUE(tester->badge_icon_url().is_empty()); | 616 EXPECT_TRUE(tester->badge_icon_url().is_empty()); |
| 617 EXPECT_EQ(nullptr, tester->badge_icon()); | 617 EXPECT_EQ(nullptr, tester->badge_icon()); |
| 618 EXPECT_FALSE(tester->is_installable()); | 618 EXPECT_FALSE(tester->is_installable()); |
| 619 EXPECT_EQ(NO_MATCHING_SERVICE_WORKER, tester->error_code()); | 619 EXPECT_EQ(NO_MATCHING_SERVICE_WORKER, tester->error_code()); |
| 620 } | 620 } |
| 621 } | 621 } |
| 622 | 622 |
| 623 IN_PROC_BROWSER_TEST_F(InstallableManagerBrowserTest, |
| 624 CheckPageWithNoServiceWorkerFetchHandler) { |
| 625 base::RunLoop run_loop; |
| 626 std::unique_ptr<CallbackTester> tester( |
| 627 new CallbackTester(run_loop.QuitClosure())); |
| 628 |
| 629 NavigateAndRunInstallableManager( |
| 630 tester.get(), GetWebAppParams(), |
| 631 "/banners/no_sw_fetch_handler_test_page.html"); |
| 632 |
| 633 RunInstallableManager(tester.get(), GetWebAppParams()); |
| 634 run_loop.Run(); |
| 635 |
| 636 EXPECT_FALSE(tester->manifest().IsEmpty()); |
| 637 EXPECT_FALSE(tester->manifest_url().is_empty()); |
| 638 |
| 639 EXPECT_TRUE(tester->primary_icon_url().is_empty()); |
| 640 EXPECT_EQ(nullptr, tester->primary_icon()); |
| 641 EXPECT_TRUE(tester->badge_icon_url().is_empty()); |
| 642 EXPECT_EQ(nullptr, tester->badge_icon()); |
| 643 EXPECT_FALSE(tester->is_installable()); |
| 644 EXPECT_EQ(NOT_OFFLINE_CAPABLE, tester->error_code()); |
| 645 } |
| 646 |
| 623 IN_PROC_BROWSER_TEST_F(InstallableManagerBrowserTest, CheckDataUrlIcon) { | 647 IN_PROC_BROWSER_TEST_F(InstallableManagerBrowserTest, CheckDataUrlIcon) { |
| 624 // Verify that InstallableManager can handle data URL icons. | 648 // Verify that InstallableManager can handle data URL icons. |
| 625 base::RunLoop run_loop; | 649 base::RunLoop run_loop; |
| 626 std::unique_ptr<CallbackTester> tester( | 650 std::unique_ptr<CallbackTester> tester( |
| 627 new CallbackTester(run_loop.QuitClosure())); | 651 new CallbackTester(run_loop.QuitClosure())); |
| 628 | 652 |
| 629 NavigateAndRunInstallableManager(tester.get(), GetWebAppParams(), | 653 NavigateAndRunInstallableManager(tester.get(), GetWebAppParams(), |
| 630 GetURLOfPageWithServiceWorkerAndManifest( | 654 GetURLOfPageWithServiceWorkerAndManifest( |
| 631 "/banners/manifest_data_url_icon.json")); | 655 "/banners/manifest_data_url_icon.json")); |
| 632 run_loop.Run(); | 656 run_loop.Run(); |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 761 CheckNestedCallsToGetData) { | 785 CheckNestedCallsToGetData) { |
| 762 // Verify that we can call GetData while in a callback from GetData. | 786 // Verify that we can call GetData while in a callback from GetData. |
| 763 base::RunLoop run_loop; | 787 base::RunLoop run_loop; |
| 764 InstallableParams params = GetWebAppParams(); | 788 InstallableParams params = GetWebAppParams(); |
| 765 std::unique_ptr<NestedCallbackTester> tester( | 789 std::unique_ptr<NestedCallbackTester> tester( |
| 766 new NestedCallbackTester(GetManager(), params, run_loop.QuitClosure())); | 790 new NestedCallbackTester(GetManager(), params, run_loop.QuitClosure())); |
| 767 | 791 |
| 768 tester->Run(); | 792 tester->Run(); |
| 769 run_loop.Run(); | 793 run_loop.Run(); |
| 770 } | 794 } |
| OLD | NEW |