| OLD | NEW |
| 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 <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 DISALLOW_COPY_AND_ASSIGN(ManifestParserTest); | 64 DISALLOW_COPY_AND_ASSIGN(ManifestParserTest); |
| 65 }; | 65 }; |
| 66 | 66 |
| 67 const GURL ManifestParserTest::default_document_url( | 67 const GURL ManifestParserTest::default_document_url( |
| 68 "http://foo.com/index.html"); | 68 "http://foo.com/index.html"); |
| 69 const GURL ManifestParserTest::default_manifest_url( | 69 const GURL ManifestParserTest::default_manifest_url( |
| 70 "http://foo.com/manifest.json"); | 70 "http://foo.com/manifest.json"); |
| 71 | 71 |
| 72 TEST_F(ManifestParserTest, CrashTest) { | 72 TEST_F(ManifestParserTest, CrashTest) { |
| 73 // Passing temporary variables should not crash. | 73 // Passing temporary variables should not crash. |
| 74 ManifestParser parser("{\"start_url\": \"/\"}", | 74 const base::StringPiece json = "{\"start_url\": \"/\"}"; |
| 75 GURL("http://example.com"), | 75 GURL url("http://example.com"); |
| 76 GURL("http://example.com")); | 76 ManifestParser parser(json, url, url); |
| 77 parser.Parse(); | 77 parser.Parse(); |
| 78 std::vector<ManifestDebugInfo::Error> errors; | 78 std::vector<ManifestDebugInfo::Error> errors; |
| 79 parser.TakeErrors(&errors); | 79 parser.TakeErrors(&errors); |
| 80 | 80 |
| 81 // .Parse() should have been call without crashing and succeeded. | 81 // .Parse() should have been call without crashing and succeeded. |
| 82 EXPECT_EQ(0u, errors.size()); | 82 EXPECT_EQ(0u, errors.size()); |
| 83 EXPECT_FALSE(parser.manifest().IsEmpty()); | 83 EXPECT_FALSE(parser.manifest().IsEmpty()); |
| 84 } | 84 } |
| 85 | 85 |
| 86 TEST_F(ManifestParserTest, EmptyStringNull) { | 86 TEST_F(ManifestParserTest, EmptyStringNull) { |
| (...skipping 1327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1414 { | 1414 { |
| 1415 Manifest manifest = ParseManifest("{ \"gcm_sender_id\": 42 }"); | 1415 Manifest manifest = ParseManifest("{ \"gcm_sender_id\": 42 }"); |
| 1416 EXPECT_TRUE(manifest.gcm_sender_id.is_null()); | 1416 EXPECT_TRUE(manifest.gcm_sender_id.is_null()); |
| 1417 EXPECT_EQ(1u, GetErrorCount()); | 1417 EXPECT_EQ(1u, GetErrorCount()); |
| 1418 EXPECT_EQ("property 'gcm_sender_id' ignored, type string expected.", | 1418 EXPECT_EQ("property 'gcm_sender_id' ignored, type string expected.", |
| 1419 errors()[0]); | 1419 errors()[0]); |
| 1420 } | 1420 } |
| 1421 } | 1421 } |
| 1422 | 1422 |
| 1423 } // namespace content | 1423 } // namespace content |
| OLD | NEW |