Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 17 matching lines...) Expand all Loading... | |
| 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 // The second argument is the web_contents pointer, which is used for | 36 // The second argument is the web_contents pointer, which is used for |
| 37 // developer debug logging to the console. The logging is skipped inside the | 37 // developer debug logging to the console. The logging is skipped inside the |
| 38 // method if a null web_contents pointer is provided, so this is safe. | 38 // method if a null web_contents pointer is provided, so this is safe. |
|
dominickn
2016/01/17 23:20:18
Nit: add a comment about the third argument here.
horo
2016/01/18 06:28:56
Done.
| |
| 39 return AppBannerDataFetcher::IsManifestValidForWebApp(manifest, nullptr); | 39 return AppBannerDataFetcher::IsManifestValidForWebApp(manifest, nullptr, |
| 40 false); | |
| 40 } | 41 } |
| 41 }; | 42 }; |
| 42 | 43 |
| 43 TEST_F(AppBannerDataFetcherUnitTest, EmptyManifestIsInvalid) { | 44 TEST_F(AppBannerDataFetcherUnitTest, EmptyManifestIsInvalid) { |
| 44 content::Manifest manifest; | 45 content::Manifest manifest; |
| 45 EXPECT_FALSE(IsManifestValid(manifest)); | 46 EXPECT_FALSE(IsManifestValid(manifest)); |
| 46 } | 47 } |
| 47 | 48 |
| 48 TEST_F(AppBannerDataFetcherUnitTest, CheckMinimalValidManifest) { | 49 TEST_F(AppBannerDataFetcherUnitTest, CheckMinimalValidManifest) { |
| 49 content::Manifest manifest = GetValidManifest(); | 50 content::Manifest manifest = GetValidManifest(); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 101 // Non-square is okay. | 102 // Non-square is okay. |
| 102 manifest.icons[0].sizes[1] = gfx::Size(144, 200); | 103 manifest.icons[0].sizes[1] = gfx::Size(144, 200); |
| 103 EXPECT_TRUE(IsManifestValid(manifest)); | 104 EXPECT_TRUE(IsManifestValid(manifest)); |
| 104 | 105 |
| 105 // The representation of the keyword 'any' should be recognized. | 106 // The representation of the keyword 'any' should be recognized. |
| 106 manifest.icons[0].sizes[1] = gfx::Size(0, 0); | 107 manifest.icons[0].sizes[1] = gfx::Size(0, 0); |
| 107 EXPECT_TRUE(IsManifestValid(manifest)); | 108 EXPECT_TRUE(IsManifestValid(manifest)); |
| 108 } | 109 } |
| 109 | 110 |
| 110 } // namespace banners | 111 } // namespace banners |
| OLD | NEW |