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 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 EXPECT_FALSE(tester->manifest_url().is_empty()); | 508 EXPECT_FALSE(tester->manifest_url().is_empty()); |
509 | 509 |
510 EXPECT_TRUE(tester->icon_url().is_empty()); | 510 EXPECT_TRUE(tester->icon_url().is_empty()); |
511 EXPECT_EQ(nullptr, tester->icon()); | 511 EXPECT_EQ(nullptr, tester->icon()); |
512 EXPECT_FALSE(tester->is_installable()); | 512 EXPECT_FALSE(tester->is_installable()); |
513 EXPECT_EQ(NO_MATCHING_SERVICE_WORKER, tester->error_code()); | 513 EXPECT_EQ(NO_MATCHING_SERVICE_WORKER, tester->error_code()); |
514 } | 514 } |
515 } | 515 } |
516 | 516 |
517 IN_PROC_BROWSER_TEST_F(InstallableManagerBrowserTest, | 517 IN_PROC_BROWSER_TEST_F(InstallableManagerBrowserTest, |
| 518 CheckManifestCorruptedIcon) { |
| 519 // Verify that the returned InstallableData::icon is null if the web manifest |
| 520 // points to a corrupt icon. |
| 521 base::RunLoop run_loop; |
| 522 std::unique_ptr<CallbackTester> tester( |
| 523 new CallbackTester(run_loop.QuitClosure())); |
| 524 |
| 525 NavigateAndRunInstallableManager(tester.get(), GetIconParams(), |
| 526 "/banners/manifest_bad_icon_test_page.html"); |
| 527 run_loop.Run(); |
| 528 |
| 529 EXPECT_FALSE(tester->manifest().IsEmpty()); |
| 530 EXPECT_FALSE(tester->manifest_url().is_empty()); |
| 531 EXPECT_TRUE(tester->icon_url().is_empty()); |
| 532 EXPECT_EQ(nullptr, tester->icon()); |
| 533 EXPECT_FALSE(tester->is_installable()); |
| 534 EXPECT_EQ(NO_ICON_AVAILABLE, tester->error_code()); |
| 535 } |
| 536 |
| 537 IN_PROC_BROWSER_TEST_F(InstallableManagerBrowserTest, |
518 CheckChangeInIconDimensions) { | 538 CheckChangeInIconDimensions) { |
519 // Verify that a follow-up request for an icon with a different size works. | 539 // Verify that a follow-up request for an icon with a different size works. |
520 { | 540 { |
521 base::RunLoop run_loop; | 541 base::RunLoop run_loop; |
522 std::unique_ptr<CallbackTester> tester( | 542 std::unique_ptr<CallbackTester> tester( |
523 new CallbackTester(run_loop.QuitClosure())); | 543 new CallbackTester(run_loop.QuitClosure())); |
524 | 544 |
525 NavigateAndRunInstallableManager(tester.get(), GetWebAppParams(), | 545 NavigateAndRunInstallableManager(tester.get(), GetWebAppParams(), |
526 "/banners/manifest_test_page.html"); | 546 "/banners/manifest_test_page.html"); |
527 run_loop.Run(); | 547 run_loop.Run(); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
600 CheckNestedCallsToGetData) { | 620 CheckNestedCallsToGetData) { |
601 // Verify that we can call GetData while in a callback from GetData. | 621 // Verify that we can call GetData while in a callback from GetData. |
602 base::RunLoop run_loop; | 622 base::RunLoop run_loop; |
603 InstallableParams params = GetWebAppParams(); | 623 InstallableParams params = GetWebAppParams(); |
604 std::unique_ptr<NestedCallbackTester> tester( | 624 std::unique_ptr<NestedCallbackTester> tester( |
605 new NestedCallbackTester(GetManager(), params, run_loop.QuitClosure())); | 625 new NestedCallbackTester(GetManager(), params, run_loop.QuitClosure())); |
606 | 626 |
607 tester->Run(); | 627 tester->Run(); |
608 run_loop.Run(); | 628 run_loop.Run(); |
609 } | 629 } |
OLD | NEW |