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

Side by Side Diff: content/renderer/manifest/manifest_parser_unittest.cc

Issue 580513002: Add support for gcm_sender_id in Manifest. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@manifest_start_url
Patch Set: Created 6 years, 2 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
« no previous file with comments | « content/renderer/manifest/manifest_parser.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "content/renderer/manifest/manifest_parser.h" 5 #include "content/renderer/manifest/manifest_parser.h"
6 6
7 #include "base/strings/string_util.h" 7 #include "base/strings/string_util.h"
8 #include "content/public/common/manifest.h" 8 #include "content/public/common/manifest.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 573
574 // Some invalid width/height combinations. 574 // Some invalid width/height combinations.
575 { 575 {
576 Manifest manifest = ParseManifest("{ \"icons\": [ {\"src\": \"\"," 576 Manifest manifest = ParseManifest("{ \"icons\": [ {\"src\": \"\","
577 "\"sizes\": \"x 40xx 1x2x3 x42 42xx42\" } ] }"); 577 "\"sizes\": \"x 40xx 1x2x3 x42 42xx42\" } ] }");
578 gfx::Size any = gfx::Size(0, 0); 578 gfx::Size any = gfx::Size(0, 0);
579 EXPECT_EQ(manifest.icons[0].sizes.size(), 0u); 579 EXPECT_EQ(manifest.icons[0].sizes.size(), 0u);
580 } 580 }
581 } 581 }
582 582
583 TEST_F(ManifestParserTest, GCMSenderIDParseRules) {
584 // Smoke test.
585 {
586 Manifest manifest = ParseManifest("{ \"gcm_sender_id\": \"foo\" }");
587 EXPECT_TRUE(EqualsASCII(manifest.gcm_sender_id.string(), "foo"));
588 }
589
590 // Trim whitespaces.
591 {
592 Manifest manifest = ParseManifest("{ \"gcm_sender_id\": \" foo \" }");
593 EXPECT_TRUE(EqualsASCII(manifest.gcm_sender_id.string(), "foo"));
594 }
595
596 // Don't parse if property isn't a string.
597 {
598 Manifest manifest = ParseManifest("{ \"gcm_sender_id\": {} }");
599 EXPECT_TRUE(manifest.gcm_sender_id.is_null());
600 }
601 {
602 Manifest manifest = ParseManifest("{ \"gcm_sender_id\": 42 }");
603 EXPECT_TRUE(manifest.gcm_sender_id.is_null());
604 }
605 }
606
583 } // namespace content 607 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/manifest/manifest_parser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698