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

Unified Diff: chrome/browser/extensions/component_loader_unittest.cc

Issue 2504333003: Fix DictionaryValue leak in component_loader.cc (Closed)
Patch Set: address comments + rewrite all loops Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/extensions/component_loader.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/component_loader_unittest.cc
diff --git a/chrome/browser/extensions/component_loader_unittest.cc b/chrome/browser/extensions/component_loader_unittest.cc
index 1ec72cc634bec253d5bbb2d732ca2eca8487c07f..496a6c5fc91d74d314239a539759b4da7534d603 100644
--- a/chrome/browser/extensions/component_loader_unittest.cc
+++ b/chrome/browser/extensions/component_loader_unittest.cc
@@ -134,47 +134,46 @@ TEST_F(ComponentLoaderTest, ParseManifest) {
std::unique_ptr<base::DictionaryValue> manifest;
// Test invalid JSON.
- manifest.reset(
- component_loader_.ParseManifest("{ 'test': 3 } invalid"));
- EXPECT_FALSE(manifest.get());
+ manifest = component_loader_.ParseManifest("{ 'test': 3 } invalid");
+ EXPECT_FALSE(manifest);
// Test manifests that are valid JSON, but don't have an object literal
// at the root. ParseManifest() should always return NULL.
- manifest.reset(component_loader_.ParseManifest(std::string()));
- EXPECT_FALSE(manifest.get());
+ manifest = component_loader_.ParseManifest(std::string());
+ EXPECT_FALSE(manifest);
- manifest.reset(component_loader_.ParseManifest("[{ \"foo\": 3 }]"));
- EXPECT_FALSE(manifest.get());
+ manifest = component_loader_.ParseManifest("[{ \"foo\": 3 }]");
+ EXPECT_FALSE(manifest);
- manifest.reset(component_loader_.ParseManifest("\"Test\""));
- EXPECT_FALSE(manifest.get());
+ manifest = component_loader_.ParseManifest("\"Test\"");
+ EXPECT_FALSE(manifest);
- manifest.reset(component_loader_.ParseManifest("42"));
- EXPECT_FALSE(manifest.get());
+ manifest = component_loader_.ParseManifest("42");
+ EXPECT_FALSE(manifest);
- manifest.reset(component_loader_.ParseManifest("true"));
- EXPECT_FALSE(manifest.get());
+ manifest = component_loader_.ParseManifest("true");
+ EXPECT_FALSE(manifest);
- manifest.reset(component_loader_.ParseManifest("false"));
- EXPECT_FALSE(manifest.get());
+ manifest = component_loader_.ParseManifest("false");
+ EXPECT_FALSE(manifest);
- manifest.reset(component_loader_.ParseManifest("null"));
- EXPECT_FALSE(manifest.get());
+ manifest = component_loader_.ParseManifest("null");
+ EXPECT_FALSE(manifest);
// Test parsing valid JSON.
int value = 0;
- manifest.reset(component_loader_.ParseManifest(
- "{ \"test\": { \"one\": 1 }, \"two\": 2 }"));
- ASSERT_TRUE(manifest.get());
+ manifest = component_loader_.ParseManifest(
+ "{ \"test\": { \"one\": 1 }, \"two\": 2 }");
+ ASSERT_TRUE(manifest);
EXPECT_TRUE(manifest->GetInteger("test.one", &value));
EXPECT_EQ(1, value);
ASSERT_TRUE(manifest->GetInteger("two", &value));
EXPECT_EQ(2, value);
std::string string_value;
- manifest.reset(component_loader_.ParseManifest(manifest_contents_));
+ manifest = component_loader_.ParseManifest(manifest_contents_);
ASSERT_TRUE(manifest->GetString("background.page", &string_value));
EXPECT_EQ("backgroundpage.html", string_value);
}
« no previous file with comments | « chrome/browser/extensions/component_loader.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698