summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-28 14:19:14 +0000
committerthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-28 14:19:14 +0000
commit494241680229a7bbc14333a3c16fd26b64261ccc (patch)
tree92eee49d0282e2826c809a9f061520f6a3be1879
parent54cb593812104e6cfd93dbbd47fd2037fd46f67b (diff)
downloadchromium_src-494241680229a7bbc14333a3c16fd26b64261ccc.zip
chromium_src-494241680229a7bbc14333a3c16fd26b64261ccc.tar.gz
chromium_src-494241680229a7bbc14333a3c16fd26b64261ccc.tar.bz2
Cleanup: Remove EmptyWString and fix bad EmptyString usage.
Review URL: https://codereview.chromium.org/298023003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@273216 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--base/strings/string_util.cc7
-rw-r--r--chrome/browser/extensions/api/file_system/file_system_api_unittest.cc16
-rw-r--r--chrome/browser/extensions/extension_error_ui_default.cc2
-rw-r--r--chrome/browser/extensions/extension_install_ui_browsertest.cc2
-rw-r--r--chrome/browser/extensions/extension_test_message_listener.cc2
-rw-r--r--chrome/browser/extensions/extension_test_message_listener_unittest.cc15
6 files changed, 20 insertions, 24 deletions
diff --git a/base/strings/string_util.cc b/base/strings/string_util.cc
index 0adb989..e23317e 100644
--- a/base/strings/string_util.cc
+++ b/base/strings/string_util.cc
@@ -32,13 +32,12 @@ using base::string16;
namespace {
-// Force the singleton used by Empty[W]String[16] to be a unique type. This
+// Force the singleton used by EmptyString[16] to be a unique type. This
// prevents other code that might accidentally use Singleton<string> from
// getting our internal one.
struct EmptyStrings {
EmptyStrings() {}
const std::string s;
- const std::wstring ws;
const string16 s16;
static EmptyStrings* GetInstance() {
@@ -108,10 +107,6 @@ const std::string& EmptyString() {
return EmptyStrings::GetInstance()->s;
}
-const std::wstring& EmptyWString() {
- return EmptyStrings::GetInstance()->ws;
-}
-
const string16& EmptyString16() {
return EmptyStrings::GetInstance()->s16;
}
diff --git a/chrome/browser/extensions/api/file_system/file_system_api_unittest.cc b/chrome/browser/extensions/api/file_system/file_system_api_unittest.cc
index 179c2c3..0b92aff 100644
--- a/chrome/browser/extensions/api/file_system/file_system_api_unittest.cc
+++ b/chrome/browser/extensions/api/file_system/file_system_api_unittest.cc
@@ -16,7 +16,7 @@ using extensions::api::file_system::AcceptOption;
namespace {
void CheckExtensions(const std::vector<base::FilePath::StringType>& expected,
- std::vector<base::FilePath::StringType>& actual) {
+ const std::vector<base::FilePath::StringType>& actual) {
EXPECT_EQ(expected.size(), actual.size());
if (expected.size() != actual.size())
return;
@@ -71,7 +71,7 @@ TEST_F(FileSystemApiUnitTest, FileSystemChooseEntryFunctionFileTypeInfoTest) {
file_type_info = ui::SelectFileDialog::FileTypeInfo();
std::vector<linked_ptr<AcceptOption> > options;
options.push_back(linked_ptr<AcceptOption>(BuildAcceptOption(
- base::EmptyString(), "application/x-chrome-extension", "jso")));
+ std::string(), "application/x-chrome-extension", "jso")));
acceptsAllTypes = false;
FileSystemChooseEntryFunction::BuildFileTypeInfo(&file_type_info,
base::FilePath::StringType(), &options, &acceptsAllTypes);
@@ -90,7 +90,7 @@ TEST_F(FileSystemApiUnitTest, FileSystemChooseEntryFunctionFileTypeInfoTest) {
file_type_info = ui::SelectFileDialog::FileTypeInfo();
options.clear();
options.push_back(linked_ptr<AcceptOption>(BuildAcceptOption(
- base::EmptyString(), base::EmptyString(), "unrelated")));
+ std::string(), std::string(), "unrelated")));
acceptsAllTypes = false;
FileSystemChooseEntryFunction::BuildFileTypeInfo(&file_type_info,
ToStringType(".jso"), &options, &acceptsAllTypes);
@@ -100,9 +100,9 @@ TEST_F(FileSystemApiUnitTest, FileSystemChooseEntryFunctionFileTypeInfoTest) {
file_type_info = ui::SelectFileDialog::FileTypeInfo();
options.clear();
options.push_back(linked_ptr<AcceptOption>(
- BuildAcceptOption(base::EmptyString(), base::EmptyString(), "jso,js")));
+ BuildAcceptOption(std::string(), std::string(), "jso,js")));
options.push_back(linked_ptr<AcceptOption>(
- BuildAcceptOption(base::EmptyString(), base::EmptyString(), "cpp,cc")));
+ BuildAcceptOption(std::string(), std::string(), "cpp,cc")));
acceptsAllTypes = false;
FileSystemChooseEntryFunction::BuildFileTypeInfo(&file_type_info,
base::FilePath::StringType(), &options, &acceptsAllTypes);
@@ -122,7 +122,7 @@ TEST_F(FileSystemApiUnitTest, FileSystemChooseEntryFunctionFileTypeInfoTest) {
file_type_info = ui::SelectFileDialog::FileTypeInfo();
options.clear();
options.push_back(linked_ptr<AcceptOption>(
- BuildAcceptOption(base::EmptyString(), "image/*", "html")));
+ BuildAcceptOption(std::string(), "image/*", "html")));
acceptsAllTypes = false;
FileSystemChooseEntryFunction::BuildFileTypeInfo(&file_type_info,
base::FilePath::StringType(), &options, &acceptsAllTypes);
@@ -135,7 +135,7 @@ TEST_F(FileSystemApiUnitTest, FileSystemChooseEntryFunctionFileTypeInfoTest) {
file_type_info = ui::SelectFileDialog::FileTypeInfo();
options.clear();
options.push_back(linked_ptr<AcceptOption>(BuildAcceptOption(
- base::EmptyString(), "image/*,audio/*,video/*", base::EmptyString())));
+ std::string(), "image/*,audio/*,video/*", std::string())));
acceptsAllTypes = false;
FileSystemChooseEntryFunction::BuildFileTypeInfo(&file_type_info,
base::FilePath::StringType(), &options, &acceptsAllTypes);
@@ -146,7 +146,7 @@ TEST_F(FileSystemApiUnitTest, FileSystemChooseEntryFunctionFileTypeInfoTest) {
file_type_info = ui::SelectFileDialog::FileTypeInfo();
options.clear();
options.push_back(linked_ptr<AcceptOption>(
- BuildAcceptOption("File Types 101", "image/jpeg", base::EmptyString())));
+ BuildAcceptOption("File Types 101", "image/jpeg", std::string())));
acceptsAllTypes = false;
FileSystemChooseEntryFunction::BuildFileTypeInfo(&file_type_info,
base::FilePath::StringType(), &options, &acceptsAllTypes);
diff --git a/chrome/browser/extensions/extension_error_ui_default.cc b/chrome/browser/extensions/extension_error_ui_default.cc
index 64ac2ef..eec4a43 100644
--- a/chrome/browser/extensions/extension_error_ui_default.cc
+++ b/chrome/browser/extensions/extension_error_ui_default.cc
@@ -39,7 +39,7 @@ bool ExtensionErrorUIDefault::ShowErrorInBubbleView() {
void ExtensionErrorUIDefault::ShowExtensions() {
DCHECK(browser_);
- chrome::ShowExtensions(browser_, base::EmptyString());
+ chrome::ShowExtensions(browser_, std::string());
}
void ExtensionErrorUIDefault::Close() {
diff --git a/chrome/browser/extensions/extension_install_ui_browsertest.cc b/chrome/browser/extensions/extension_install_ui_browsertest.cc
index a62068f..73d4181 100644
--- a/chrome/browser/extensions/extension_install_ui_browsertest.cc
+++ b/chrome/browser/extensions/extension_install_ui_browsertest.cc
@@ -240,7 +240,7 @@ IN_PROC_BROWSER_TEST_F(NewTabUISortingBrowserTest,
EXPECT_FALSE(service->GetInstalledExtension(app_id));
// Move the test app from the end to be before the web store.
sorting->OnExtensionMoved(
- app_id, base::EmptyString(), extension_misc::kWebStoreAppId);
+ app_id, std::string(), extension_misc::kWebStoreAppId);
EXPECT_EQ(app_id, last_reordered_extension_id_);
// Now install the app.
diff --git a/chrome/browser/extensions/extension_test_message_listener.cc b/chrome/browser/extensions/extension_test_message_listener.cc
index 66f1280..777b2aa 100644
--- a/chrome/browser/extensions/extension_test_message_listener.cc
+++ b/chrome/browser/extensions/extension_test_message_listener.cc
@@ -94,7 +94,7 @@ void ExtensionTestMessageListener::Observe(
// Reply immediately, or save the function for future use.
function_ = function;
if (!will_reply_)
- Reply(base::EmptyString());
+ Reply(std::string());
if (waiting_) {
waiting_ = false;
diff --git a/chrome/browser/extensions/extension_test_message_listener_unittest.cc b/chrome/browser/extensions/extension_test_message_listener_unittest.cc
index e4ef815..a020aac 100644
--- a/chrome/browser/extensions/extension_test_message_listener_unittest.cc
+++ b/chrome/browser/extensions/extension_test_message_listener_unittest.cc
@@ -12,6 +12,7 @@ namespace extensions {
namespace {
+const char kFormat[] = "[\"%s\"]";
const char kTestMessage[] = "test message";
const char kTestMessage2[] = "test message 2";
const char kFailureMessage[] = "failure";
@@ -26,7 +27,7 @@ TEST_F(ExtensionTestMessageListenerUnittest, BasicTestExtensionMessageTest) {
ExtensionTestMessageListener listener(kTestMessage, false); // won't reply
EXPECT_FALSE(listener.was_satisfied());
RunFunction(new TestSendMessageFunction,
- base::StringPrintf("[\"%s\"]", kTestMessage));
+ base::StringPrintf(kFormat, kTestMessage));
EXPECT_TRUE(listener.was_satisfied());
EXPECT_EQ(kTestMessage, listener.message());
}
@@ -36,7 +37,7 @@ TEST_F(ExtensionTestMessageListenerUnittest, BasicTestExtensionMessageTest) {
ExtensionTestMessageListener listener(false); // won't reply
EXPECT_FALSE(listener.was_satisfied());
RunFunction(new TestSendMessageFunction,
- base::StringPrintf("[\"%s\"]", kTestMessage2));
+ base::StringPrintf(kFormat, kTestMessage2));
EXPECT_TRUE(listener.was_satisfied());
EXPECT_EQ(kTestMessage2, listener.message());
}
@@ -47,14 +48,14 @@ TEST_F(ExtensionTestMessageListenerUnittest, BasicTestExtensionMessageTest) {
ExtensionTestMessageListener listener(false); // won't reply
EXPECT_FALSE(listener.was_satisfied());
RunFunction(new TestSendMessageFunction,
- base::StringPrintf("[\"%s\"]", kTestMessage));
+ base::StringPrintf(kFormat, kTestMessage));
EXPECT_EQ(kTestMessage, listener.message());
EXPECT_TRUE(listener.was_satisfied());
listener.Reset();
EXPECT_FALSE(listener.was_satisfied());
- EXPECT_EQ(base::EmptyString(), listener.message());
+ EXPECT_TRUE(listener.message().empty());
RunFunction(new TestSendMessageFunction,
- base::StringPrintf("[\"%s\"]", kTestMessage2));
+ base::StringPrintf(kFormat, kTestMessage2));
EXPECT_TRUE(listener.was_satisfied());
EXPECT_EQ(kTestMessage2, listener.message());
}
@@ -65,12 +66,12 @@ TEST_F(ExtensionTestMessageListenerUnittest, BasicTestExtensionMessageTest) {
ExtensionTestMessageListener listener(kTestMessage, false); // won't reply
listener.set_failure_message(kFailureMessage);
RunFunction(new TestSendMessageFunction,
- base::StringPrintf("[\"%s\"]", kTestMessage));
+ base::StringPrintf(kFormat, kTestMessage));
EXPECT_TRUE(listener.WaitUntilSatisfied()); // succeeds
EXPECT_EQ(kTestMessage, listener.message());
listener.Reset();
RunFunction(new TestSendMessageFunction,
- base::StringPrintf("[\"%s\"]", kFailureMessage));
+ base::StringPrintf(kFormat, kFailureMessage));
EXPECT_FALSE(listener.WaitUntilSatisfied()); // fails
EXPECT_EQ(kFailureMessage, listener.message());
}