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

Unified Diff: chrome/browser/banners/app_banner_data_fetcher_unittest.cc

Issue 1829643002: App Banner: require 'display' to be set to 'standalone' or 'fullscreen'. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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/banners/app_banner_data_fetcher.cc ('k') | chrome/browser/banners/app_banner_debug_log.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/banners/app_banner_data_fetcher_unittest.cc
diff --git a/chrome/browser/banners/app_banner_data_fetcher_unittest.cc b/chrome/browser/banners/app_banner_data_fetcher_unittest.cc
index 4be44feb74fac8636a73d5971473266ca8e8721a..a7dd57f81286c7100128ee855717f3259c11ebba 100644
--- a/chrome/browser/banners/app_banner_data_fetcher_unittest.cc
+++ b/chrome/browser/banners/app_banner_data_fetcher_unittest.cc
@@ -6,6 +6,7 @@
#include "base/strings/utf_string_conversions.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/WebKit/public/platform/WebDisplayMode.h"
namespace banners {
@@ -23,6 +24,7 @@ class AppBannerDataFetcherUnitTest : public testing::Test {
manifest.name = ToNullableUTF16("foo");
manifest.short_name = ToNullableUTF16("bar");
manifest.start_url = GURL("http://example.com");
+ manifest.display = blink::WebDisplayModeStandalone;
content::Manifest::Icon icon;
icon.type = ToNullableUTF16("image/png");
@@ -67,6 +69,23 @@ TEST_F(AppBannerDataFetcherUnitTest, ManifestRequiresNameORShortName) {
EXPECT_FALSE(IsManifestValid(manifest));
}
+TEST_F(AppBannerDataFetcherUnitTest, ManifestRequiresNonEmptyNameORShortName) {
+ content::Manifest manifest = GetValidManifest();
+
+ manifest.name = ToNullableUTF16("");
+ manifest.short_name = ToNullableUTF16("");
+ EXPECT_FALSE(IsManifestValid(manifest));
+
+ manifest.name = ToNullableUTF16("foo");
+ EXPECT_TRUE(IsManifestValid(manifest));
+
+ manifest.short_name = ToNullableUTF16("");
+ EXPECT_TRUE(IsManifestValid(manifest));
dominickn 2016/03/23 11:40:53 Nit: Isn't short_name already empty at this point?
mlamouri (slow - plz ping) 2016/03/23 11:46:10 Correct. I did some changes before upload that mad
+
+ manifest.name = ToNullableUTF16("");
+ EXPECT_FALSE(IsManifestValid(manifest));
+}
+
TEST_F(AppBannerDataFetcherUnitTest, ManifestRequiresValidStartURL) {
content::Manifest manifest = GetValidManifest();
@@ -110,4 +129,23 @@ TEST_F(AppBannerDataFetcherUnitTest, ManifestRequiresMinimalSize) {
EXPECT_TRUE(IsManifestValid(manifest));
}
+TEST_F(AppBannerDataFetcherUnitTest, ManifestDisplayStandaloneFullscreen) {
+ content::Manifest manifest = GetValidManifest();
+
+ manifest.display = blink::WebDisplayModeUndefined;
+ EXPECT_FALSE(IsManifestValid(manifest));
+
+ manifest.display = blink::WebDisplayModeBrowser;
+ EXPECT_FALSE(IsManifestValid(manifest));
+
+ manifest.display = blink::WebDisplayModeMinimalUi;
+ EXPECT_FALSE(IsManifestValid(manifest));
+
+ manifest.display = blink::WebDisplayModeStandalone;
+ EXPECT_TRUE(IsManifestValid(manifest));
+
+ manifest.display = blink::WebDisplayModeFullscreen;
+ EXPECT_TRUE(IsManifestValid(manifest));
+}
+
} // namespace banners
« no previous file with comments | « chrome/browser/banners/app_banner_data_fetcher.cc ('k') | chrome/browser/banners/app_banner_debug_log.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698