diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-06 22:28:28 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-06 22:28:28 +0000 |
commit | 5cf8bdeb18b6d7a3e0327d1f012391cabb9abe85 (patch) | |
tree | 90ab60c3ff7fe1d63d5cc042fafeb29edae17ac9 /chrome | |
parent | 06eee70c5530309d7e17f47e5297c7218fa0a5f1 (diff) | |
download | chromium_src-5cf8bdeb18b6d7a3e0327d1f012391cabb9abe85.zip chromium_src-5cf8bdeb18b6d7a3e0327d1f012391cabb9abe85.tar.gz chromium_src-5cf8bdeb18b6d7a3e0327d1f012391cabb9abe85.tar.bz2 |
Remove a bunch of unnecessary .c_str() calls.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/527010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35657 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/common/extensions/extension_unittest.cc | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/chrome/common/extensions/extension_unittest.cc b/chrome/common/extensions/extension_unittest.cc index 29485de..a294c23 100644 --- a/chrome/common/extensions/extension_unittest.cc +++ b/chrome/common/extensions/extension_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -339,8 +339,7 @@ TEST(ExtensionTest, LoadPageActionHelper) { // First try with an empty dictionary. action.reset(extension.LoadExtensionActionHelper(&input, &error_msg)); ASSERT_TRUE(action != NULL); - ASSERT_STREQ("", error_msg.c_str()); - error_msg = ""; + ASSERT_TRUE(error_msg.empty()); // Now setup some values to use in the action. const std::string id("MyExtensionActionId"); @@ -359,19 +358,19 @@ TEST(ExtensionTest, LoadPageActionHelper) { // Parse and read back the values from the object. action.reset(extension.LoadExtensionActionHelper(&input, &error_msg)); ASSERT_TRUE(NULL != action.get()); - ASSERT_STREQ("", error_msg.c_str()); - ASSERT_STREQ(id.c_str(), action->id().c_str()); + ASSERT_TRUE(error_msg.empty()); + ASSERT_EQ(id, action->id()); // No title, so fall back to name. - ASSERT_STREQ(name.c_str(), action->GetTitle(1).c_str()); + ASSERT_EQ(name, action->GetTitle(1)); ASSERT_EQ(2u, action->icon_paths()->size()); - ASSERT_STREQ(img1.c_str(), action->icon_paths()->at(0).c_str()); - ASSERT_STREQ(img2.c_str(), action->icon_paths()->at(1).c_str()); + ASSERT_EQ(img1, (*action->icon_paths())[0]); + ASSERT_EQ(img2, (*action->icon_paths())[1]); // Explicitly set the same type and parse again. input.SetString(keys::kType, values::kPageActionTypeTab); action.reset(extension.LoadExtensionActionHelper(&input, &error_msg)); ASSERT_TRUE(NULL != action.get()); - ASSERT_STREQ("", error_msg.c_str()); + ASSERT_TRUE(error_msg.empty()); // Make a deep copy of the input and remove one key at a time and see if we // get the right error. @@ -382,17 +381,14 @@ TEST(ExtensionTest, LoadPageActionHelper) { copy->Remove(keys::kPageActionId, NULL); action.reset(extension.LoadExtensionActionHelper(copy.get(), &error_msg)); ASSERT_TRUE(NULL != action.get()); - ASSERT_STREQ("", error_msg.c_str()); - error_msg = ""; // Then remove the name key. It's optional, so no error. copy.reset(static_cast<DictionaryValue*>(input.DeepCopy())); copy->Remove(keys::kName, NULL); action.reset(extension.LoadExtensionActionHelper(copy.get(), &error_msg)); ASSERT_TRUE(NULL != action.get()); - ASSERT_STREQ("", action->GetTitle(1).c_str()); - ASSERT_STREQ("", error_msg.c_str()); - error_msg = ""; + ASSERT_TRUE(action->GetTitle(1).empty()); + ASSERT_TRUE(error_msg.empty()); // Then remove the icon paths key. copy.reset(static_cast<DictionaryValue*>(input.DeepCopy())); @@ -415,7 +411,7 @@ TEST(ExtensionTest, LoadPageActionHelper) { // Parse and read back the values from the object. action.reset(extension.LoadExtensionActionHelper(&input, &error_msg)); ASSERT_TRUE(action.get()); - ASSERT_STREQ("", error_msg.c_str()); + ASSERT_TRUE(error_msg.empty()); ASSERT_EQ(kTitle, action->GetTitle(1)); ASSERT_EQ(0u, action->icon_paths()->size()); @@ -434,8 +430,7 @@ TEST(ExtensionTest, LoadPageActionHelper) { action.reset(extension.LoadExtensionActionHelper(&input, &error_msg)); ASSERT_TRUE(NULL != action.get()); ASSERT_EQ(kTitle, action->GetTitle(1)); - ASSERT_STREQ("", error_msg.c_str()); - error_msg = ""; + ASSERT_TRUE(error_msg.empty()); input.Remove(keys::kPageActionDefaultTitle, NULL); action.reset(extension.LoadExtensionActionHelper(&input, &error_msg)); |