Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1944)

Unified Diff: chrome/browser/installable/installable_manager_unittest.cc

Issue 2642233002: Require WebApp & WebAPK primary icons to have IconPurpose::ANY (Closed)
Patch Set: rebase Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/installable/installable_manager.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/installable/installable_manager_unittest.cc
diff --git a/chrome/browser/installable/installable_manager_unittest.cc b/chrome/browser/installable/installable_manager_unittest.cc
index 9002ddb7e8a1a0a5eecfcb1baf6da7d45bc93942..b7ec00c5f8e265a1e2ecf2cd73c05b0970248df5 100644
--- a/chrome/browser/installable/installable_manager_unittest.cc
+++ b/chrome/browser/installable/installable_manager_unittest.cc
@@ -8,6 +8,8 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/WebKit/public/platform/WebDisplayMode.h"
+using IconPurpose = content::Manifest::Icon::IconPurpose;
+
class InstallableManagerUnitTest : public testing::Test {
public:
InstallableManagerUnitTest() : manager_(new InstallableManager(nullptr)) { }
@@ -27,6 +29,7 @@ class InstallableManagerUnitTest : public testing::Test {
content::Manifest::Icon icon;
icon.type = base::ASCIIToUTF16("image/png");
icon.sizes.push_back(gfx::Size(144, 144));
+ icon.purpose.push_back(IconPurpose::ANY);
manifest.icons.push_back(icon);
return manifest;
@@ -131,6 +134,20 @@ TEST_F(InstallableManagerUnitTest, ManifestRequiresImagePNG) {
EXPECT_EQ(MANIFEST_MISSING_SUITABLE_ICON, GetErrorCode());
}
+TEST_F(InstallableManagerUnitTest, ManifestRequiresPurposeAny) {
+ content::Manifest manifest = GetValidManifest();
+
+ // The icon MUST have IconPurpose::ANY at least.
+ manifest.icons[0].purpose[0] = IconPurpose::BADGE;
+ EXPECT_FALSE(IsManifestValid(manifest));
+ EXPECT_EQ(MANIFEST_MISSING_SUITABLE_ICON, GetErrorCode());
+
+ // If one of the icon purposes match the requirement, it should be accepted.
+ manifest.icons[0].purpose.push_back(IconPurpose::ANY);
+ EXPECT_TRUE(IsManifestValid(manifest));
+ EXPECT_EQ(NO_ERROR_DETECTED, GetErrorCode());
+}
+
TEST_F(InstallableManagerUnitTest, ManifestRequiresMinimalSize) {
content::Manifest manifest = GetValidManifest();
« no previous file with comments | « chrome/browser/installable/installable_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698