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

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

Issue 1571633002: Pass Manifest JSON paser error line and column number to console. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add comments Created 4 years, 11 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 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 "base/macros.h" 9 #include "base/macros.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 13 matching lines...) Expand all
24 class ManifestParserTest : public testing::Test { 24 class ManifestParserTest : public testing::Test {
25 protected: 25 protected:
26 ManifestParserTest() {} 26 ManifestParserTest() {}
27 ~ManifestParserTest() override {} 27 ~ManifestParserTest() override {}
28 28
29 Manifest ParseManifestWithURLs(const base::StringPiece& data, 29 Manifest ParseManifestWithURLs(const base::StringPiece& data,
30 const GURL& document_url, 30 const GURL& document_url,
31 const GURL& manifest_url) { 31 const GURL& manifest_url) {
32 ManifestParser parser(data, document_url, manifest_url); 32 ManifestParser parser(data, document_url, manifest_url);
33 parser.Parse(); 33 parser.Parse();
34 errors_ = parser.errors(); 34 errors_.clear();
35 for (const scoped_ptr<ManifestParser::ErrorInfo>& error_info :
36 parser.errors()) {
37 errors_.push_back(error_info->error_msg);
38 }
35 return parser.manifest(); 39 return parser.manifest();
36 } 40 }
37 41
38 Manifest ParseManifest(const base::StringPiece& data) { 42 Manifest ParseManifest(const base::StringPiece& data) {
39 return ParseManifestWithURLs( 43 return ParseManifestWithURLs(
40 data, default_document_url, default_manifest_url); 44 data, default_document_url, default_manifest_url);
41 } 45 }
42 46
43 const std::vector<std::string>& errors() const { 47 const std::vector<std::string>& errors() const {
44 return errors_; 48 return errors_;
(...skipping 1324 matching lines...) Expand 10 before | Expand all | Expand 10 after
1369 Manifest manifest = ParseManifest("{ \"gcm_sender_id\": 42 }"); 1373 Manifest manifest = ParseManifest("{ \"gcm_sender_id\": 42 }");
1370 EXPECT_TRUE(manifest.gcm_sender_id.is_null()); 1374 EXPECT_TRUE(manifest.gcm_sender_id.is_null());
1371 EXPECT_EQ(1u, GetErrorCount()); 1375 EXPECT_EQ(1u, GetErrorCount());
1372 EXPECT_EQ("Manifest parsing error: property 'gcm_sender_id' ignored," 1376 EXPECT_EQ("Manifest parsing error: property 'gcm_sender_id' ignored,"
1373 " type string expected.", 1377 " type string expected.",
1374 errors()[0]); 1378 errors()[0]);
1375 } 1379 }
1376 } 1380 }
1377 1381
1378 } // namespace content 1382 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/manifest/manifest_parser.cc ('k') | third_party/WebKit/Source/web/WebLocalFrameImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698