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

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

Issue 1851933002: Convert //url to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: IWYU fixup 7 Created 4 years, 8 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') | content/renderer/p2p/port_allocator.h » ('j') | 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 <stdint.h> 7 #include <stdint.h>
8 8
9 #include <memory>
10
9 #include "base/macros.h" 11 #include "base/macros.h"
10 #include "base/strings/string_util.h" 12 #include "base/strings/string_util.h"
11 #include "content/public/common/manifest.h" 13 #include "content/public/common/manifest.h"
12 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
13 15
14 namespace content { 16 namespace content {
15 17
16 namespace { 18 namespace {
17 19
18 uint32_t ExtractColor(int64_t color) { 20 uint32_t ExtractColor(int64_t color) {
19 return reinterpret_cast<uint32_t&>(color); 21 return reinterpret_cast<uint32_t&>(color);
20 } 22 }
21 23
22 } // anonymous namespace 24 } // anonymous namespace
23 25
24 class ManifestParserTest : public testing::Test { 26 class ManifestParserTest : public testing::Test {
25 protected: 27 protected:
26 ManifestParserTest() {} 28 ManifestParserTest() {}
27 ~ManifestParserTest() override {} 29 ~ManifestParserTest() override {}
28 30
29 Manifest ParseManifestWithURLs(const base::StringPiece& data, 31 Manifest ParseManifestWithURLs(const base::StringPiece& data,
30 const GURL& document_url, 32 const GURL& document_url,
31 const GURL& manifest_url) { 33 const GURL& manifest_url) {
32 ManifestParser parser(data, document_url, manifest_url); 34 ManifestParser parser(data, document_url, manifest_url);
33 parser.Parse(); 35 parser.Parse();
34 errors_.clear(); 36 errors_.clear();
35 for (const scoped_ptr<ManifestParser::ErrorInfo>& error_info : 37 for (const std::unique_ptr<ManifestParser::ErrorInfo>& error_info :
36 parser.errors()) { 38 parser.errors()) {
37 errors_.push_back(error_info->error_msg); 39 errors_.push_back(error_info->error_msg);
38 } 40 }
39 return parser.manifest(); 41 return parser.manifest();
40 } 42 }
41 43
42 Manifest ParseManifest(const base::StringPiece& data) { 44 Manifest ParseManifest(const base::StringPiece& data) {
43 return ParseManifestWithURLs( 45 return ParseManifestWithURLs(
44 data, default_document_url, default_manifest_url); 46 data, default_document_url, default_manifest_url);
45 } 47 }
(...skipping 1327 matching lines...) Expand 10 before | Expand all | Expand 10 after
1373 Manifest manifest = ParseManifest("{ \"gcm_sender_id\": 42 }"); 1375 Manifest manifest = ParseManifest("{ \"gcm_sender_id\": 42 }");
1374 EXPECT_TRUE(manifest.gcm_sender_id.is_null()); 1376 EXPECT_TRUE(manifest.gcm_sender_id.is_null());
1375 EXPECT_EQ(1u, GetErrorCount()); 1377 EXPECT_EQ(1u, GetErrorCount());
1376 EXPECT_EQ("Manifest parsing error: property 'gcm_sender_id' ignored," 1378 EXPECT_EQ("Manifest parsing error: property 'gcm_sender_id' ignored,"
1377 " type string expected.", 1379 " type string expected.",
1378 errors()[0]); 1380 errors()[0]);
1379 } 1381 }
1380 } 1382 }
1381 1383
1382 } // namespace content 1384 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/manifest/manifest_parser.cc ('k') | content/renderer/p2p/port_allocator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698