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

Unified Diff: chrome/common/extensions/extension_file_util_unittest.cc

Issue 15836003: Update chrome/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/extension_file_util_unittest.cc
diff --git a/chrome/common/extensions/extension_file_util_unittest.cc b/chrome/common/extensions/extension_file_util_unittest.cc
index 8f89c4547751def0f6a446d31d6b765f16845c7b..343f4cfbeaac5d70e1e3c36d8db42a39cc53b0ad 100644
--- a/chrome/common/extensions/extension_file_util_unittest.cc
+++ b/chrome/common/extensions/extension_file_util_unittest.cc
@@ -114,7 +114,7 @@ TEST_F(ExtensionFileUtilTest, LoadExtensionWithValidLocales) {
std::string error;
scoped_refptr<Extension> extension(extension_file_util::LoadExtension(
install_dir, Manifest::UNPACKED, Extension::NO_FLAGS, &error));
- ASSERT_TRUE(extension != NULL);
+ ASSERT_TRUE(extension.get() != NULL);
EXPECT_EQ("The first extension that I made.", extension->description());
}
@@ -130,7 +130,7 @@ TEST_F(ExtensionFileUtilTest, LoadExtensionWithoutLocalesFolder) {
std::string error;
scoped_refptr<Extension> extension(extension_file_util::LoadExtension(
install_dir, Manifest::UNPACKED, Extension::NO_FLAGS, &error));
- ASSERT_FALSE(extension == NULL);
+ ASSERT_FALSE(extension.get() == NULL);
EXPECT_TRUE(error.empty());
}
@@ -194,7 +194,7 @@ TEST_F(ExtensionFileUtilTest,
std::string error;
scoped_refptr<Extension> extension(extension_file_util::LoadExtension(
install_dir, Manifest::UNPACKED, Extension::NO_FLAGS, &error));
- ASSERT_TRUE(extension == NULL);
+ ASSERT_TRUE(extension.get() == NULL);
ASSERT_FALSE(error.empty());
ASSERT_STREQ("Manifest file is missing or unreadable.", error.c_str());
}
@@ -211,7 +211,7 @@ TEST_F(ExtensionFileUtilTest, LoadExtensionGivesHelpfullErrorOnBadManifest) {
std::string error;
scoped_refptr<Extension> extension(extension_file_util::LoadExtension(
install_dir, Manifest::UNPACKED, Extension::NO_FLAGS, &error));
- ASSERT_TRUE(extension == NULL);
+ ASSERT_TRUE(extension.get() == NULL);
ASSERT_FALSE(error.empty());
ASSERT_STREQ("Manifest is not valid JSON. "
"Line: 2, column: 16, Syntax error.", error.c_str());
@@ -227,9 +227,10 @@ TEST_F(ExtensionFileUtilTest, FailLoadingNonUTF8Scripts) {
std::string error;
scoped_refptr<Extension> extension(extension_file_util::LoadExtension(
install_dir, Manifest::UNPACKED, Extension::NO_FLAGS, &error));
- ASSERT_TRUE(extension == NULL);
+ ASSERT_TRUE(extension.get() == NULL);
ASSERT_STREQ("Could not load file 'bad_encoding.js' for content script. "
- "It isn't UTF-8 encoded.", error.c_str());
+ "It isn't UTF-8 encoded.",
+ error.c_str());
}
TEST_F(ExtensionFileUtilTest, ExtensionURLToRelativeFilePath) {
@@ -392,9 +393,8 @@ TEST_F(ExtensionFileUtilTest, ValidateThemeUTF8) {
ASSERT_TRUE(extension.get()) << error;
std::vector<extensions::InstallWarning> warnings;
- EXPECT_TRUE(extension_file_util::ValidateExtension(extension,
- &error, &warnings)) <<
- error;
+ EXPECT_TRUE(extension_file_util::ValidateExtension(
+ extension.get(), &error, &warnings)) << error;
EXPECT_EQ(0U, warnings.size());
}
@@ -417,8 +417,8 @@ TEST_F(ExtensionFileUtilTest, BackgroundScriptsMustExist) {
value.get(), temp.path(), Manifest::UNPACKED, 0, &error);
ASSERT_TRUE(extension.get()) << error;
- EXPECT_FALSE(extension_file_util::ValidateExtension(extension,
- &error, &warnings));
+ EXPECT_FALSE(extension_file_util::ValidateExtension(
+ extension.get(), &error, &warnings));
EXPECT_EQ(l10n_util::GetStringFUTF8(
IDS_EXTENSION_LOAD_BACKGROUND_SCRIPT_FAILED, ASCIIToUTF16("foo.js")),
error);
@@ -432,8 +432,8 @@ TEST_F(ExtensionFileUtilTest, BackgroundScriptsMustExist) {
ASSERT_TRUE(extension.get()) << error;
warnings.clear();
- EXPECT_FALSE(extension_file_util::ValidateExtension(extension,
- &error, &warnings));
+ EXPECT_FALSE(extension_file_util::ValidateExtension(
+ extension.get(), &error, &warnings));
EXPECT_EQ(l10n_util::GetStringFUTF8(
IDS_EXTENSION_LOAD_BACKGROUND_SCRIPT_FAILED,
ASCIIToUTF16("http://google.com/foo.js")),
@@ -543,9 +543,8 @@ TEST_F(ExtensionFileUtilTest, CheckZeroLengthImageFile) {
std::string error;
scoped_refptr<Extension> extension(extension_file_util::LoadExtension(
ext_dir, Manifest::UNPACKED, Extension::NO_FLAGS, &error));
- EXPECT_TRUE(extension == NULL);
- EXPECT_STREQ("Could not load extension icon 'icon.png'.",
- error.c_str());
+ EXPECT_TRUE(extension.get() == NULL);
+ EXPECT_STREQ("Could not load extension icon 'icon.png'.", error.c_str());
// Try to install an extension with a zero-length browser action icon file.
ext_dir = install_dir.AppendASCII("extensions")
@@ -555,9 +554,9 @@ TEST_F(ExtensionFileUtilTest, CheckZeroLengthImageFile) {
scoped_refptr<Extension> extension2(extension_file_util::LoadExtension(
ext_dir, Manifest::UNPACKED, Extension::NO_FLAGS, &error));
- EXPECT_TRUE(extension2 == NULL);
+ EXPECT_TRUE(extension2.get() == NULL);
EXPECT_STREQ("Could not load icon 'icon.png' for browser action.",
- error.c_str());
+ error.c_str());
// Try to install an extension with a zero-length page action icon file.
ext_dir = install_dir.AppendASCII("extensions")
@@ -567,9 +566,9 @@ TEST_F(ExtensionFileUtilTest, CheckZeroLengthImageFile) {
scoped_refptr<Extension> extension3(extension_file_util::LoadExtension(
ext_dir, Manifest::UNPACKED, Extension::NO_FLAGS, &error));
- EXPECT_TRUE(extension3 == NULL);
+ EXPECT_TRUE(extension3.get() == NULL);
EXPECT_STREQ("Could not load icon 'icon.png' for page action.",
- error.c_str());
+ error.c_str());
}
// TODO(aa): More tests as motivation allows. Maybe steal some from

Powered by Google App Engine
This is Rietveld 408576698