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

Side by Side Diff: chrome/browser/banners/app_banner_data_fetcher_unittest.cc

Issue 1129103003: Log messages regarding why app banners aren't displayed to the console (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Factoring out debug log message function Created 5 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/banners/app_banner_data_fetcher.h" 5 #include "chrome/browser/banners/app_banner_data_fetcher.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 namespace banners { 10 namespace banners {
(...skipping 15 matching lines...) Expand all
26 26
27 content::Manifest::Icon icon; 27 content::Manifest::Icon icon;
28 icon.type = ToNullableUTF16("image/png"); 28 icon.type = ToNullableUTF16("image/png");
29 icon.sizes.push_back(gfx::Size(144, 144)); 29 icon.sizes.push_back(gfx::Size(144, 144));
30 manifest.icons.push_back(icon); 30 manifest.icons.push_back(icon);
31 31
32 return manifest; 32 return manifest;
33 } 33 }
34 34
35 static bool IsManifestValid(const content::Manifest& manifest) { 35 static bool IsManifestValid(const content::Manifest& manifest) {
36 return AppBannerDataFetcher::IsManifestValidForWebApp(manifest); 36 // second argument is the web_contents pointer to allow debug logging
37 // to the console. logging doesn't take place if the pointer is null
benwells 2015/05/11 08:08:40 Please use proper case, class names and grammar in
dominickn (DO NOT USE) 2015/05/12 07:41:31 Done.
38 return AppBannerDataFetcher::IsManifestValidForWebApp(manifest, nullptr);
37 } 39 }
38 }; 40 };
39 41
40 TEST_F(AppBannerDataFetcherUnitTest, EmptyManifestIsInvalid) { 42 TEST_F(AppBannerDataFetcherUnitTest, EmptyManifestIsInvalid) {
41 content::Manifest manifest; 43 content::Manifest manifest;
42 EXPECT_FALSE(IsManifestValid(manifest)); 44 EXPECT_FALSE(IsManifestValid(manifest));
43 } 45 }
44 46
45 TEST_F(AppBannerDataFetcherUnitTest, CheckMinimalValidManifest) { 47 TEST_F(AppBannerDataFetcherUnitTest, CheckMinimalValidManifest) {
46 content::Manifest manifest = GetValidManifest(); 48 content::Manifest manifest = GetValidManifest();
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 // Non-square is okay. 100 // Non-square is okay.
99 manifest.icons[0].sizes[1] = gfx::Size(144, 200); 101 manifest.icons[0].sizes[1] = gfx::Size(144, 200);
100 EXPECT_TRUE(IsManifestValid(manifest)); 102 EXPECT_TRUE(IsManifestValid(manifest));
101 103
102 // The representation of the keyword 'any' should be recognized. 104 // The representation of the keyword 'any' should be recognized.
103 manifest.icons[0].sizes[1] = gfx::Size(0, 0); 105 manifest.icons[0].sizes[1] = gfx::Size(0, 0);
104 EXPECT_TRUE(IsManifestValid(manifest)); 106 EXPECT_TRUE(IsManifestValid(manifest));
105 } 107 }
106 108
107 } // namespace banners 109 } // namespace banners
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698