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

Side by Side Diff: chrome/browser/android/webapk/webapk_builder_unittest.cc

Issue 2138973002: Initial CL for talking to the WebAPK server to generate WebAPK (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/android/webapk/webapk_builder.h"
6 #include "content/public/common/manifest.h"
7 #include "content/renderer/manifest/manifest_parser.h"
8 #include "testing/gtest/include/gtest/gtest.h"
9 #include "url/gurl.h"
10
11 TEST(WebApkBuilderTest, DisplayToString) {
12 for (int display = 0; display < blink::WebDisplayModeLast; ++display) {
13 std::string display_string = WebApkBuilder::DisplayToString(
14 static_cast<blink::WebDisplayMode>(display));
15 content::ManifestParser parser("{\"display\":\"" + display_string + "\"}",
16 GURL(), GURL());
17 parser.Parse();
18 EXPECT_FALSE(parser.failed());
19 EXPECT_EQ(parser.manifest().display, display)
20 << "Incorrect conversion from display enum value to string: " << display
21 << " " << display_string;
22 }
23 }
24
25 TEST(WebApkBuilderTest, OrientationToString) {
26 for (int orientation = 0;
27 orientation < blink::WebScreenOrientationLockNatural; ++orientation) {
28 std::string orientation_string = WebApkBuilder::OrientationToString(
29 static_cast<blink::WebScreenOrientationLockType>(orientation));
30 content::ManifestParser parser(
31 "{\"orientation\":\"" + orientation_string + "\"}", GURL(), GURL());
32 parser.Parse();
33 EXPECT_FALSE(parser.failed());
34 EXPECT_EQ(parser.manifest().orientation, orientation)
35 << "Incorrect conversion from display enum value to string: "
36 << orientation << " " << orientation_string;
37 }
38 }
39
40 // Test that the "invalid color value" is what the server expects.
41 TEST(WebApkBuilderTest, InvalidColorFormat) {
42 content::ManifestParser parser("{\"theme_color\":\"falu\"}", GURL(),
43 GURL());
44 parser.Parse();
45 ASSERT_FALSE(parser.failed());
46 EXPECT_EQ(0x80000000, parser.manifest().theme_color);
47 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698