diff options
664 files changed, 5049 insertions, 3730 deletions
diff --git a/base/debug/trace_event_unittest.cc b/base/debug/trace_event_unittest.cc index 8376660..782f07b 100644 --- a/base/debug/trace_event_unittest.cc +++ b/base/debug/trace_event_unittest.cc @@ -1535,7 +1535,7 @@ TEST_F(TraceEventTestFixture, TraceCategoriesAfterNestedEnable) { trace_log->SetEnabled(std::string("foo2"), TraceLog::RECORD_UNTIL_FULL); EXPECT_TRUE(*trace_log->GetCategoryEnabled("foo2")); EXPECT_FALSE(*trace_log->GetCategoryEnabled("baz")); - trace_log->SetEnabled(std::string(""), TraceLog::RECORD_UNTIL_FULL); + trace_log->SetEnabled(std::string(), TraceLog::RECORD_UNTIL_FULL); EXPECT_TRUE(*trace_log->GetCategoryEnabled("foo")); EXPECT_TRUE(*trace_log->GetCategoryEnabled("baz")); trace_log->SetDisabled(); @@ -1558,7 +1558,8 @@ TEST_F(TraceEventTestFixture, TraceCategoriesAfterNestedEnable) { TEST_F(TraceEventTestFixture, TraceOptionsParsing) { ManualTestSetUp(); - EXPECT_EQ(TraceLog::RECORD_UNTIL_FULL, TraceLog::TraceOptionsFromString("")); + EXPECT_EQ(TraceLog::RECORD_UNTIL_FULL, + TraceLog::TraceOptionsFromString(std::string())); EXPECT_EQ(TraceLog::RECORD_UNTIL_FULL, TraceLog::TraceOptionsFromString("record-until-full")); diff --git a/base/file_util_posix.cc b/base/file_util_posix.cc index fa2c1ff..1512c0f 100644 --- a/base/file_util_posix.cc +++ b/base/file_util_posix.cc @@ -541,7 +541,8 @@ bool CreateDirectory(const FilePath& full_path) { base::FilePath MakeUniqueDirectory(const base::FilePath& path) { const int kMaxAttempts = 20; for (int attempts = 0; attempts < kMaxAttempts; attempts++) { - int uniquifier = GetUniquePathNumber(path, FILE_PATH_LITERAL("")); + int uniquifier = + GetUniquePathNumber(path, FILE_PATH_LITERAL(std::string())); if (uniquifier < 0) break; base::FilePath test_path = (uniquifier == 0) ? path : diff --git a/base/file_util_unittest.cc b/base/file_util_unittest.cc index 1f10a335..77dd7ac 100644 --- a/base/file_util_unittest.cc +++ b/base/file_util_unittest.cc @@ -1846,15 +1846,14 @@ TEST_F(FileUtilTest, FileEnumeratorTest) { // create the files FilePath dir2file = dir2.Append(FILE_PATH_LITERAL("dir2file.txt")); - CreateTextFile(dir2file, L""); + CreateTextFile(dir2file, std::wstring()); FilePath dir2innerfile = dir2inner.Append(FILE_PATH_LITERAL("innerfile.txt")); - CreateTextFile(dir2innerfile, L""); + CreateTextFile(dir2innerfile, std::wstring()); FilePath file1 = temp_dir_.path().Append(FILE_PATH_LITERAL("file1.txt")); - CreateTextFile(file1, L""); - FilePath file2_rel = - dir2.Append(FilePath::kParentDirectory) - .Append(FILE_PATH_LITERAL("file2.txt")); - CreateTextFile(file2_rel, L""); + CreateTextFile(file1, std::wstring()); + FilePath file2_rel = dir2.Append(FilePath::kParentDirectory) + .Append(FILE_PATH_LITERAL("file2.txt")); + CreateTextFile(file2_rel, std::wstring()); FilePath file2_abs = temp_dir_.path().Append(FILE_PATH_LITERAL("file2.txt")); // Only enumerate files. diff --git a/base/files/file_path.cc b/base/files/file_path.cc index 72604e8..01d9eab 100644 --- a/base/files/file_path.cc +++ b/base/files/file_path.cc @@ -552,7 +552,7 @@ string16 FilePath::LossyDisplayName() const { std::string FilePath::MaybeAsASCII() const { if (IsStringASCII(path_)) return path_; - return ""; + return std::string(); } std::string FilePath::AsUTF8Unsafe() const { diff --git a/base/i18n/char_iterator_unittest.cc b/base/i18n/char_iterator_unittest.cc index 6d1294e..509e27c 100644 --- a/base/i18n/char_iterator_unittest.cc +++ b/base/i18n/char_iterator_unittest.cc @@ -11,7 +11,7 @@ namespace base { namespace i18n { TEST(CharIteratorsTest, TestUTF8) { - std::string empty(""); + std::string empty; UTF8CharIterator empty_iter(&empty); ASSERT_TRUE(empty_iter.end()); ASSERT_EQ(0, empty_iter.array_pos()); diff --git a/base/json/json_value_serializer_unittest.cc b/base/json/json_value_serializer_unittest.cc index e510500..9df0435 100644 --- a/base/json/json_value_serializer_unittest.cc +++ b/base/json/json_value_serializer_unittest.cc @@ -196,7 +196,7 @@ TEST(JSONValueSerializerTest, Roundtrip) { // initialized with a const string. ASSERT_FALSE(serializer.Serialize(*root_dict)); - std::string test_serialization = ""; + std::string test_serialization; JSONStringValueSerializer mutable_serializer(&test_serialization); ASSERT_TRUE(mutable_serializer.Serialize(*root_dict)); ASSERT_EQ(original_serialization, test_serialization); diff --git a/base/metrics/field_trial.cc b/base/metrics/field_trial.cc index 4ab5ff9..1f4f9ae 100644 --- a/base/metrics/field_trial.cc +++ b/base/metrics/field_trial.cc @@ -318,7 +318,7 @@ std::string FieldTrialList::FindFullName(const std::string& name) { FieldTrial* field_trial = Find(name); if (field_trial) return field_trial->group_name(); - return ""; + return std::string(); } // static diff --git a/base/metrics/field_trial_unittest.cc b/base/metrics/field_trial_unittest.cc index 81c4f37..bb2c39f 100644 --- a/base/metrics/field_trial_unittest.cc +++ b/base/metrics/field_trial_unittest.cc @@ -86,7 +86,7 @@ TEST_F(FieldTrialTest, Registration) { EXPECT_EQ(name1, trial1->trial_name()); EXPECT_EQ("", trial1->group_name_internal()); - trial1->AppendGroup("", 7); + trial1->AppendGroup(std::string(), 7); EXPECT_EQ(trial1, FieldTrialList::Find(name1)); EXPECT_FALSE(FieldTrialList::Find(name2)); @@ -221,7 +221,7 @@ TEST_F(FieldTrialTest, OneWinner) { std::string winner_name; for (int i = 1; i <= group_count; ++i) { - int might_win = trial->AppendGroup("", 1); + int might_win = trial->AppendGroup(std::string(), 1); // Because we keep appending groups, we want to see if the last group that // was added has been assigned or not. diff --git a/base/metrics/statistics_recorder.cc b/base/metrics/statistics_recorder.cc index f6174f3..13aeeb7 100644 --- a/base/metrics/statistics_recorder.cc +++ b/base/metrics/statistics_recorder.cc @@ -308,7 +308,7 @@ StatisticsRecorder::~StatisticsRecorder() { DCHECK(histograms_ && ranges_ && lock_); if (dump_on_exit_) { string output; - WriteGraph("", &output); + WriteGraph(std::string(), &output); DLOG(INFO) << output; } diff --git a/base/metrics/stats_counters.cc b/base/metrics/stats_counters.cc index f763220..12416d9 100644 --- a/base/metrics/stats_counters.cc +++ b/base/metrics/stats_counters.cc @@ -45,7 +45,7 @@ int* StatsCounter::GetPtr() { if (counter_id_ == -1) { counter_id_ = table->FindCounter(name_); if (table->GetSlot() == 0) { - if (!table->RegisterThread("")) { + if (!table->RegisterThread(std::string())) { // There is no room for this thread. This thread // cannot use counters. counter_id_ = 0; diff --git a/base/metrics/stats_table.cc b/base/metrics/stats_table.cc index dede1e4..9585863 100644 --- a/base/metrics/stats_table.cc +++ b/base/metrics/stats_table.cc @@ -431,8 +431,8 @@ int* StatsTable::FindLocation(const char* name) { // Get the slot for this thread. Try to register // it if none exists. int slot = table->GetSlot(); - if (!slot && !(slot = table->RegisterThread(""))) - return NULL; + if (!slot && !(slot = table->RegisterThread(std::string()))) + return NULL; // Find the counter id for the counter. std::string str_name(name); diff --git a/base/nix/mime_util_xdg.cc b/base/nix/mime_util_xdg.cc index 00dcafa..5794b6d 100644 --- a/base/nix/mime_util_xdg.cc +++ b/base/nix/mime_util_xdg.cc @@ -344,9 +344,9 @@ size_t IconTheme::MatchesSize(SubDirInfo* info, size_t size) { std::string IconTheme::ReadLine(FILE* fp) { if (!fp) - return ""; + return std::string(); - std::string result = ""; + std::string result; const size_t kBufferSize = 100; char buffer[kBufferSize]; while ((fgets(buffer, kBufferSize - 1, fp)) != NULL) { diff --git a/base/pickle_unittest.cc b/base/pickle_unittest.cc index d418fdf..d252dae 100644 --- a/base/pickle_unittest.cc +++ b/base/pickle_unittest.cc @@ -134,7 +134,7 @@ TEST(PickleTest, UnalignedSize) { TEST(PickleTest, ZeroLenStr) { Pickle pickle; - EXPECT_TRUE(pickle.WriteString("")); + EXPECT_TRUE(pickle.WriteString(std::string())); PickleIterator iter(pickle); std::string outstr; @@ -144,7 +144,7 @@ TEST(PickleTest, ZeroLenStr) { TEST(PickleTest, ZeroLenWStr) { Pickle pickle; - EXPECT_TRUE(pickle.WriteWString(L"")); + EXPECT_TRUE(pickle.WriteWString(std::wstring())); PickleIterator iter(pickle); std::string outstr; diff --git a/base/prefs/pref_change_registrar_unittest.cc b/base/prefs/pref_change_registrar_unittest.cc index 49da721..f353a8f 100644 --- a/base/prefs/pref_change_registrar_unittest.cc +++ b/base/prefs/pref_change_registrar_unittest.cc @@ -132,7 +132,7 @@ class ObserveSetOfPreferencesTest : public testing::Test { PrefRegistrySimple* registry = pref_service_->registry(); registry->RegisterStringPref(kHomePage, "http://google.com"); registry->RegisterBooleanPref(kHomePageIsNewTabPage, false); - registry->RegisterStringPref(kApplicationLocale, ""); + registry->RegisterStringPref(kApplicationLocale, std::string()); } PrefChangeRegistrar* CreatePrefChangeRegistrar() { diff --git a/base/prefs/pref_service_unittest.cc b/base/prefs/pref_service_unittest.cc index 26fe19a..927f2f7 100644 --- a/base/prefs/pref_service_unittest.cc +++ b/base/prefs/pref_service_unittest.cc @@ -45,7 +45,7 @@ TEST(PrefServiceTest, NoObserverFire) { Mock::VerifyAndClearExpectations(&obs); // Clearing the pref should cause the pref to fire. - const StringValue expected_default_value(""); + const StringValue expected_default_value((std::string())); obs.Expect(pref_name, &expected_default_value); prefs.ClearPref(pref_name); Mock::VerifyAndClearExpectations(&obs); diff --git a/base/process_util_linux.cc b/base/process_util_linux.cc index 2af9227..e06d99c 100644 --- a/base/process_util_linux.cc +++ b/base/process_util_linux.cc @@ -161,7 +161,7 @@ std::string GetProcStatsFieldAsString( ProcStatsFields field_num) { if (field_num < VM_COMM || field_num > VM_STATE) { NOTREACHED(); - return ""; + return std::string(); } if (proc_stats.size() > static_cast<size_t>(field_num)) diff --git a/base/process_util_unittest.cc b/base/process_util_unittest.cc index 265a2df..3ce9942 100644 --- a/base/process_util_unittest.cc +++ b/base/process_util_unittest.cc @@ -758,8 +758,8 @@ TEST_F(ProcessUtilTest, LaunchProcess) { EXPECT_EQ(0, setenv("BASE_TEST", "testing", 1 /* override */)); EXPECT_EQ("testing\n", TestLaunchProcess(env_changes, no_clone_flags)); - env_changes.push_back(std::make_pair(std::string("BASE_TEST"), - std::string(""))); + env_changes.push_back( + std::make_pair(std::string("BASE_TEST"), std::string())); EXPECT_EQ("\n", TestLaunchProcess(env_changes, no_clone_flags)); env_changes[0].second = "foo"; @@ -800,7 +800,7 @@ TEST_F(ProcessUtilTest, AlterEnvironment) { delete[] e; changes.clear(); - changes.push_back(std::make_pair(std::string("A"), std::string(""))); + changes.push_back(std::make_pair(std::string("A"), std::string())); e = base::AlterEnvironment(changes, empty); EXPECT_TRUE(e[0] == NULL); delete[] e; @@ -819,7 +819,7 @@ TEST_F(ProcessUtilTest, AlterEnvironment) { delete[] e; changes.clear(); - changes.push_back(std::make_pair(std::string("A"), std::string(""))); + changes.push_back(std::make_pair(std::string("A"), std::string())); e = base::AlterEnvironment(changes, a2); EXPECT_TRUE(e[0] == NULL); delete[] e; diff --git a/base/string_util_unittest.cc b/base/string_util_unittest.cc index d36b955..d580fba 100644 --- a/base/string_util_unittest.cc +++ b/base/string_util_unittest.cc @@ -70,7 +70,7 @@ TEST(StringUtilTest, TruncateUTF8ToByteSize) { std::string output; // Empty strings and invalid byte_size arguments - EXPECT_FALSE(Truncated("", 0, &output)); + EXPECT_FALSE(Truncated(std::string(), 0, &output)); EXPECT_EQ(output, ""); EXPECT_TRUE(Truncated("\xe1\x80\xbf", 0, &output)); EXPECT_EQ(output, ""); @@ -319,7 +319,7 @@ TEST(StringUtilTest, CollapseWhitespaceASCII) { } TEST(StringUtilTest, ContainsOnlyWhitespaceASCII) { - EXPECT_TRUE(ContainsOnlyWhitespaceASCII("")); + EXPECT_TRUE(ContainsOnlyWhitespaceASCII(std::string())); EXPECT_TRUE(ContainsOnlyWhitespaceASCII(" ")); EXPECT_TRUE(ContainsOnlyWhitespaceASCII("\t")); EXPECT_TRUE(ContainsOnlyWhitespaceASCII("\t \r \n ")); @@ -712,7 +712,7 @@ void TokenizeTest() { EXPECT_EQ(r[2], STR(" three")); r.clear(); - size = Tokenize(STR(""), STR(","), &r); + size = Tokenize(STR(), STR(","), &r); EXPECT_EQ(0U, size); ASSERT_EQ(0U, r.size()); r.clear(); @@ -761,7 +761,7 @@ TEST(StringUtilTest, JoinString) { in.push_back("c"); EXPECT_EQ("a,b,c", JoinString(in, ',')); - in.push_back(""); + in.push_back(std::string()); EXPECT_EQ("a,b,c,", JoinString(in, ',')); in.push_back(" "); EXPECT_EQ("a|b|c|| ", JoinString(in, '|')); @@ -780,7 +780,7 @@ TEST(StringUtilTest, JoinStringWithString) { parts.push_back("c"); EXPECT_EQ("a, b, c", JoinString(parts, separator)); - parts.push_back(""); + parts.push_back(std::string()); EXPECT_EQ("a, b, c, ", JoinString(parts, separator)); parts.push_back(" "); EXPECT_EQ("a|b|c|| ", JoinString(parts, "|")); @@ -812,10 +812,10 @@ TEST(StringUtilTest, StartsWith) { EXPECT_TRUE(StartsWithASCII("JavaScript:url", "javascript", false)); EXPECT_FALSE(StartsWithASCII("java", "javascript", true)); EXPECT_FALSE(StartsWithASCII("java", "javascript", false)); - EXPECT_FALSE(StartsWithASCII("", "javascript", false)); - EXPECT_FALSE(StartsWithASCII("", "javascript", true)); - EXPECT_TRUE(StartsWithASCII("java", "", false)); - EXPECT_TRUE(StartsWithASCII("java", "", true)); + EXPECT_FALSE(StartsWithASCII(std::string(), "javascript", false)); + EXPECT_FALSE(StartsWithASCII(std::string(), "javascript", true)); + EXPECT_TRUE(StartsWithASCII("java", std::string(), false)); + EXPECT_TRUE(StartsWithASCII("java", std::string(), true)); EXPECT_TRUE(StartsWith(L"javascript:url", L"javascript", true)); EXPECT_FALSE(StartsWith(L"JavaScript:url", L"javascript", true)); @@ -823,10 +823,10 @@ TEST(StringUtilTest, StartsWith) { EXPECT_TRUE(StartsWith(L"JavaScript:url", L"javascript", false)); EXPECT_FALSE(StartsWith(L"java", L"javascript", true)); EXPECT_FALSE(StartsWith(L"java", L"javascript", false)); - EXPECT_FALSE(StartsWith(L"", L"javascript", false)); - EXPECT_FALSE(StartsWith(L"", L"javascript", true)); - EXPECT_TRUE(StartsWith(L"java", L"", false)); - EXPECT_TRUE(StartsWith(L"java", L"", true)); + EXPECT_FALSE(StartsWith(std::wstring(), L"javascript", false)); + EXPECT_FALSE(StartsWith(std::wstring(), L"javascript", true)); + EXPECT_TRUE(StartsWith(L"java", std::wstring(), false)); + EXPECT_TRUE(StartsWith(L"java", std::wstring(), true)); } TEST(StringUtilTest, EndsWith) { @@ -838,14 +838,14 @@ TEST(StringUtilTest, EndsWith) { EXPECT_FALSE(EndsWith(L".plug", L".plugin", false)); EXPECT_FALSE(EndsWith(L"Foo.plugin Bar", L".plugin", true)); EXPECT_FALSE(EndsWith(L"Foo.plugin Bar", L".plugin", false)); - EXPECT_FALSE(EndsWith(L"", L".plugin", false)); - EXPECT_FALSE(EndsWith(L"", L".plugin", true)); - EXPECT_TRUE(EndsWith(L"Foo.plugin", L"", false)); - EXPECT_TRUE(EndsWith(L"Foo.plugin", L"", true)); + EXPECT_FALSE(EndsWith(std::wstring(), L".plugin", false)); + EXPECT_FALSE(EndsWith(std::wstring(), L".plugin", true)); + EXPECT_TRUE(EndsWith(L"Foo.plugin", std::wstring(), false)); + EXPECT_TRUE(EndsWith(L"Foo.plugin", std::wstring(), true)); EXPECT_TRUE(EndsWith(L".plugin", L".plugin", false)); EXPECT_TRUE(EndsWith(L".plugin", L".plugin", true)); - EXPECT_TRUE(EndsWith(L"", L"", false)); - EXPECT_TRUE(EndsWith(L"", L"", true)); + EXPECT_TRUE(EndsWith(std::wstring(), std::wstring(), false)); + EXPECT_TRUE(EndsWith(std::wstring(), std::wstring(), true)); } TEST(StringUtilTest, GetStringFWithOffsets) { @@ -1142,10 +1142,10 @@ TEST(StringUtilTest, ReplaceChars) { TEST(StringUtilTest, ContainsOnlyChars) { // Providing an empty list of characters should return false but for the empty // string. - EXPECT_TRUE(ContainsOnlyChars("", "")); - EXPECT_FALSE(ContainsOnlyChars("Hello", "")); + EXPECT_TRUE(ContainsOnlyChars(std::string(), std::string())); + EXPECT_FALSE(ContainsOnlyChars("Hello", std::string())); - EXPECT_TRUE(ContainsOnlyChars("", "1234")); + EXPECT_TRUE(ContainsOnlyChars(std::string(), "1234")); EXPECT_TRUE(ContainsOnlyChars("1", "1234")); EXPECT_TRUE(ContainsOnlyChars("1", "4321")); EXPECT_TRUE(ContainsOnlyChars("123", "4321")); diff --git a/base/strings/string_split.cc b/base/strings/string_split.cc index f5f19e9..819fdba 100644 --- a/base/strings/string_split.cc +++ b/base/strings/string_split.cc @@ -107,7 +107,8 @@ bool SplitStringIntoKeyValuePairs( success = false; } DCHECK_LE(value.size(), 1U); - kv_pairs->push_back(make_pair(key, value.empty()? "" : value[0])); + kv_pairs->push_back( + make_pair(key, value.empty() ? std::string() : value[0])); } return success; } diff --git a/base/strings/string_split_unittest.cc b/base/strings/string_split_unittest.cc index a950cac..6729497 100644 --- a/base/strings/string_split_unittest.cc +++ b/base/strings/string_split_unittest.cc @@ -36,9 +36,10 @@ class SplitStringIntoKeyValuesTest : public testing::Test { }; TEST_F(SplitStringIntoKeyValuesTest, EmptyInputMultipleValues) { - EXPECT_FALSE(SplitStringIntoKeyValues("", // Empty input - '\t', // Key separators - &key, &values)); + EXPECT_FALSE(SplitStringIntoKeyValues(std::string(), // Empty input + '\t', // Key separators + &key, + &values)); EXPECT_TRUE(key.empty()); EXPECT_TRUE(values.empty()); } @@ -69,9 +70,10 @@ TEST_F(SplitStringIntoKeyValuesTest, KeyWithMultipleValues) { } TEST_F(SplitStringIntoKeyValuesTest, EmptyInputSingleValue) { - EXPECT_FALSE(SplitStringIntoKeyValues("", // Empty input - '\t', // Key separators - &key, &values)); + EXPECT_FALSE(SplitStringIntoKeyValues(std::string(), // Empty input + '\t', // Key separators + &key, + &values)); EXPECT_TRUE(key.empty()); EXPECT_TRUE(values.empty()); } @@ -108,9 +110,9 @@ class SplitStringIntoKeyValuePairsTest : public testing::Test { }; TEST_F(SplitStringIntoKeyValuePairsTest, EmptyString) { - EXPECT_TRUE(SplitStringIntoKeyValuePairs("", - ':', // Key-value delimiters - ',', // Key-value pair delims + EXPECT_TRUE(SplitStringIntoKeyValuePairs(std::string(), + ':', // Key-value delimiters + ',', // Key-value pair delims &kv_pairs)); EXPECT_TRUE(kv_pairs.empty()); } @@ -153,7 +155,7 @@ TEST_F(SplitStringIntoKeyValuePairsTest, DelimiterInValue) { TEST(SplitStringUsingSubstrTest, EmptyString) { std::vector<std::string> results; - SplitStringUsingSubstr("", "DELIMITER", &results); + SplitStringUsingSubstr(std::string(), "DELIMITER", &results); ASSERT_EQ(1u, results.size()); EXPECT_THAT(results, ElementsAre("")); } @@ -162,7 +164,7 @@ TEST(SplitStringUsingSubstrTest, EmptyString) { TEST(StringUtilTest, SplitString) { std::vector<std::wstring> r; - SplitString(L"", L',', &r); + SplitString(std::wstring(), L',', &r); EXPECT_EQ(0U, r.size()); r.clear(); diff --git a/base/sys_info_posix.cc b/base/sys_info_posix.cc index 854f123..57b7af6 100644 --- a/base/sys_info_posix.cc +++ b/base/sys_info_posix.cc @@ -55,7 +55,7 @@ std::string SysInfo::OperatingSystemName() { struct utsname info; if (uname(&info) < 0) { NOTREACHED(); - return ""; + return std::string(); } return std::string(info.sysname); } @@ -67,7 +67,7 @@ std::string SysInfo::OperatingSystemVersion() { struct utsname info; if (uname(&info) < 0) { NOTREACHED(); - return ""; + return std::string(); } return std::string(info.release); } @@ -78,7 +78,7 @@ std::string SysInfo::OperatingSystemArchitecture() { struct utsname info; if (uname(&info) < 0) { NOTREACHED(); - return ""; + return std::string(); } std::string arch(info.machine); if (arch == "i386" || arch == "i486" || arch == "i586" || arch == "i686") { diff --git a/base/test/trace_event_analyzer.cc b/base/test/trace_event_analyzer.cc index 431945b..8457ce9 100644 --- a/base/test/trace_event_analyzer.cc +++ b/base/test/trace_event_analyzer.cc @@ -140,7 +140,7 @@ std::string TraceEvent::GetKnownArgAsString(const std::string& name) const { if (GetArgAsString(name, &arg_string)) return arg_string; NOTREACHED(); - return ""; + return std::string(); } double TraceEvent::GetKnownArgAsDouble(const std::string& name) const { diff --git a/base/test/trace_event_analyzer_unittest.cc b/base/test/trace_event_analyzer_unittest.cc index 33cacbf..52926fd 100644 --- a/base/test/trace_event_analyzer_unittest.cc +++ b/base/test/trace_event_analyzer_unittest.cc @@ -786,7 +786,7 @@ TEST_F(TraceEventAnalyzerTest, FindClosest) { events[0].name = "one"; events[2].name = "two"; events[4].name = "three"; - Query query_named = Query::EventName() != Query::String(""); + Query query_named = Query::EventName() != Query::String(std::string()); Query query_one = Query::EventName() == Query::String("one"); // Only one event matches query_one, so two closest can't be found. @@ -822,7 +822,7 @@ TEST_F(TraceEventAnalyzerTest, CountMatches) { events[0].name = "one"; events[2].name = "two"; events[4].name = "three"; - Query query_named = Query::EventName() != Query::String(""); + Query query_named = Query::EventName() != Query::String(std::string()); Query query_one = Query::EventName() == Query::String("one"); EXPECT_EQ(0u, CountMatches(event_ptrs, Query::Bool(false))); diff --git a/base/values_unittest.cc b/base/values_unittest.cc index 98bc73c..bad83fa 100644 --- a/base/values_unittest.cc +++ b/base/values_unittest.cc @@ -599,7 +599,7 @@ TEST(ValuesTest, RemoveEmptyChildren) { // Make sure we don't prune too much. root->SetBoolean("bool", true); root->Set("empty_dict", new DictionaryValue); - root->SetString("empty_string", ""); + root->SetString("empty_string", std::string()); root.reset(root->DeepCopyWithoutEmptyChildren()); EXPECT_EQ(2U, root->size()); diff --git a/base/vlog_unittest.cc b/base/vlog_unittest.cc index ef7247f..3a508f4 100644 --- a/base/vlog_unittest.cc +++ b/base/vlog_unittest.cc @@ -16,12 +16,20 @@ namespace { TEST(VlogTest, NoVmodule) { int min_log_level = 0; - EXPECT_EQ(0, VlogInfo("", "", &min_log_level).GetVlogLevel("test1")); - EXPECT_EQ(0, VlogInfo("0", "", &min_log_level).GetVlogLevel("test2")); - EXPECT_EQ(0, VlogInfo("blah", "", &min_log_level).GetVlogLevel("test3")); - EXPECT_EQ(0, VlogInfo("0blah1", "", &min_log_level).GetVlogLevel("test4")); - EXPECT_EQ(1, VlogInfo("1", "", &min_log_level).GetVlogLevel("test5")); - EXPECT_EQ(5, VlogInfo("5", "", &min_log_level).GetVlogLevel("test6")); + EXPECT_EQ(0, + VlogInfo(std::string(), std::string(), &min_log_level) + .GetVlogLevel("test1")); + EXPECT_EQ(0, + VlogInfo("0", std::string(), &min_log_level).GetVlogLevel("test2")); + EXPECT_EQ( + 0, VlogInfo("blah", std::string(), &min_log_level).GetVlogLevel("test3")); + EXPECT_EQ( + 0, + VlogInfo("0blah1", std::string(), &min_log_level).GetVlogLevel("test4")); + EXPECT_EQ(1, + VlogInfo("1", std::string(), &min_log_level).GetVlogLevel("test5")); + EXPECT_EQ(5, + VlogInfo("5", std::string(), &min_log_level).GetVlogLevel("test6")); } TEST(VlogTest, MatchVlogPattern) { @@ -92,7 +100,7 @@ TEST(VlogTest, VmoduleDirs) { const char kVModuleSwitch[] = "foo/bar.cc=1,baz\\*\\qux.cc=2,*quux/*=3,*/*-inl.h=4"; int min_log_level = 0; - VlogInfo vlog_info("", kVModuleSwitch, &min_log_level); + VlogInfo vlog_info(std::string(), kVModuleSwitch, &min_log_level); EXPECT_EQ(0, vlog_info.GetVlogLevel("/foo/bar.cc")); EXPECT_EQ(0, vlog_info.GetVlogLevel("bar.cc")); EXPECT_EQ(1, vlog_info.GetVlogLevel("foo/bar.cc")); diff --git a/chrome/browser/about_flags_unittest.cc b/chrome/browser/about_flags_unittest.cc index 4720ce6..1f6ef04 100644 --- a/chrome/browser/about_flags_unittest.cc +++ b/chrome/browser/about_flags_unittest.cc @@ -285,7 +285,7 @@ TEST_F(AboutFlagsTest, CheckValues) { // Convert the flags to switches. ConvertFlagsToSwitches(&prefs_, &command_line); EXPECT_TRUE(command_line.HasSwitch(kSwitch1)); - EXPECT_EQ(std::string(""), command_line.GetSwitchValueASCII(kSwitch1)); + EXPECT_EQ(std::string(), command_line.GetSwitchValueASCII(kSwitch1)); EXPECT_TRUE(command_line.HasSwitch(kSwitch2)); EXPECT_EQ(std::string(kValueForSwitch2), command_line.GetSwitchValueASCII(kSwitch2)); diff --git a/chrome/browser/accessibility/accessibility_events.cc b/chrome/browser/accessibility/accessibility_events.cc index 65cf111..9a46ef6 100644 --- a/chrome/browser/accessibility/accessibility_events.cc +++ b/chrome/browser/accessibility/accessibility_events.cc @@ -166,7 +166,6 @@ AccessibilityTextBoxInfo::AccessibilityTextBoxInfo(Profile* profile, const std::string& context, bool password) : AccessibilityControlInfo(profile, name), - value_(""), password_(password), selection_start_(0), selection_end_(0) { diff --git a/chrome/browser/autofill/autofill_browsertest.cc b/chrome/browser/autofill/autofill_browsertest.cc index af63f86..b3d6f54 100644 --- a/chrome/browser/autofill/autofill_browsertest.cc +++ b/chrome/browser/autofill/autofill_browsertest.cc @@ -505,14 +505,14 @@ class AutofillTest : public InProcessBrowserTest { // The previewed values should not be accessible to JavaScript. ExpectFieldValue("firstname", "M"); - ExpectFieldValue("lastname", ""); - ExpectFieldValue("address1", ""); - ExpectFieldValue("address2", ""); - ExpectFieldValue("city", ""); - ExpectFieldValue("state", ""); - ExpectFieldValue("zip", ""); - ExpectFieldValue("country", ""); - ExpectFieldValue("phone", ""); + ExpectFieldValue("lastname", std::string()); + ExpectFieldValue("address1", std::string()); + ExpectFieldValue("address2", std::string()); + ExpectFieldValue("city", std::string()); + ExpectFieldValue("state", std::string()); + ExpectFieldValue("zip", std::string()); + ExpectFieldValue("country", std::string()); + ExpectFieldValue("phone", std::string()); // TODO(isherman): It would be nice to test that the previewed values are // displayed: http://crbug.com/57220 @@ -742,7 +742,7 @@ IN_PROC_BROWSER_TEST_F(AutofillTest, DISABLED_AutofillFormWithRepeatedField) { // Invoke Autofill. TryBasicFormFill(); - ExpectFieldValue("state_freeform", ""); + ExpectFieldValue("state_freeform", std::string()); } // http://crbug.com/150084 @@ -1307,8 +1307,8 @@ IN_PROC_BROWSER_TEST_F(AutofillTest, MAYBE_ComparePhoneNumbers) { ExpectFieldValue("PHONE_HOME_NUMBER_3-2", "555"); ExpectFieldValue("PHONE_HOME_NUMBER_4-1", "4567"); ExpectFieldValue("PHONE_HOME_NUMBER_4-2", "4567"); - ExpectFieldValue("PHONE_HOME_EXT-1", ""); - ExpectFieldValue("PHONE_HOME_EXT-2", ""); + ExpectFieldValue("PHONE_HOME_EXT-1", std::string()); + ExpectFieldValue("PHONE_HOME_EXT-2", std::string()); ExpectFieldValue("PHONE_HOME_COUNTRY_CODE-1", "1"); } @@ -1447,7 +1447,7 @@ IN_PROC_BROWSER_TEST_F(AutofillTest, MAYBE_NoAutofillForReadOnlyFields) { ui_test_utils::NavigateToURL(browser(), url); PopulateForm("firstname"); - ExpectFieldValue("email", ""); + ExpectFieldValue("email", std::string()); ExpectFieldValue("address", addr_line1); } diff --git a/chrome/browser/automation/automation_misc_browsertest.cc b/chrome/browser/automation/automation_misc_browsertest.cc index 97efd95..11ce614 100644 --- a/chrome/browser/automation/automation_misc_browsertest.cc +++ b/chrome/browser/automation/automation_misc_browsertest.cc @@ -82,8 +82,8 @@ IN_PROC_BROWSER_TEST_F(AutomationMiscBrowserTest, ProcessMouseEvent) { " window.didClick = true;" "}, true);")); AutomationMouseEvent automation_event; - automation_event.location_script_chain.push_back( - ScriptEvaluationRequest("{'x': 5, 'y': 10}", "")); + automation_event.location_script_chain + .push_back(ScriptEvaluationRequest("{'x': 5, 'y': 10}", std::string())); WebKit::WebMouseEvent& mouse_event = automation_event.mouse_event; mouse_event.type = WebKit::WebInputEvent::MouseDown; mouse_event.button = WebKit::WebMouseEvent::ButtonLeft; diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc index ae9f48c..e176eec 100644 --- a/chrome/browser/automation/testing_automation_provider.cc +++ b/chrome/browser/automation/testing_automation_provider.cc @@ -991,7 +991,7 @@ void TestingAutomationProvider::GetTabTitle(int handle, NavigationController* tab = tab_tracker_->GetResource(handle); NavigationEntry* entry = tab->GetActiveEntry(); if (entry != NULL) { - *title = UTF16ToWideHack(entry->GetTitleForDisplay("")); + *title = UTF16ToWideHack(entry->GetTitleForDisplay(std::string())); } else { *title = std::wstring(); } @@ -3414,7 +3414,7 @@ void TestingAutomationProvider::RemoveSavedPassword( // This observer will delete itself. PasswordStoreLoginsChangedObserver* observer = new PasswordStoreLoginsChangedObserver( - this, reply_message, PasswordStoreChange::REMOVE, ""); + this, reply_message, PasswordStoreChange::REMOVE, std::string()); observer->Init(); password_store->RemoveLogin(to_remove); @@ -5353,7 +5353,7 @@ void TestingAutomationProvider::GetTabInfo( return; } DictionaryValue dict; - dict.SetString("title", entry->GetTitleForDisplay("")); + dict.SetString("title", entry->GetTitleForDisplay(std::string())); dict.SetString("url", entry->GetVirtualURL().spec()); reply.SendSuccess(&dict); } else { diff --git a/chrome/browser/bookmarks/bookmark_utils_unittest.cc b/chrome/browser/bookmarks/bookmark_utils_unittest.cc index f71645e..a5f253d 100644 --- a/chrome/browser/bookmarks/bookmark_utils_unittest.cc +++ b/chrome/browser/bookmarks/bookmark_utils_unittest.cc @@ -166,22 +166,31 @@ TEST_F(BookmarkUtilsTest, ApplyEditsWithNoFolderChange) { { BookmarkEditor::EditDetails detail( BookmarkEditor::EditDetails::AddFolder(bookmarkbar, 1)); - ApplyEditsWithNoFolderChange(&model, bookmarkbar, detail, - ASCIIToUTF16("folder0"), GURL("")); + ApplyEditsWithNoFolderChange(&model, + bookmarkbar, + detail, + ASCIIToUTF16("folder0"), + GURL(std::string())); EXPECT_EQ(ASCIIToUTF16("folder0"), bookmarkbar->GetChild(1)->GetTitle()); } { BookmarkEditor::EditDetails detail( BookmarkEditor::EditDetails::AddFolder(bookmarkbar, -1)); - ApplyEditsWithNoFolderChange(&model, bookmarkbar, detail, - ASCIIToUTF16("folder1"), GURL("")); + ApplyEditsWithNoFolderChange(&model, + bookmarkbar, + detail, + ASCIIToUTF16("folder1"), + GURL(std::string())); EXPECT_EQ(ASCIIToUTF16("folder1"), bookmarkbar->GetChild(3)->GetTitle()); } { BookmarkEditor::EditDetails detail( BookmarkEditor::EditDetails::AddFolder(bookmarkbar, 10)); - ApplyEditsWithNoFolderChange(&model, bookmarkbar, detail, - ASCIIToUTF16("folder2"), GURL("")); + ApplyEditsWithNoFolderChange(&model, + bookmarkbar, + detail, + ASCIIToUTF16("folder2"), + GURL(std::string())); EXPECT_EQ(ASCIIToUTF16("folder2"), bookmarkbar->GetChild(4)->GetTitle()); } } diff --git a/chrome/browser/browsing_data/browsing_data_cookie_helper_unittest.cc b/chrome/browser/browsing_data/browsing_data_cookie_helper_unittest.cc index 94df56c..be0879b 100644 --- a/chrome/browser/browsing_data/browsing_data_cookie_helper_unittest.cc +++ b/chrome/browser/browsing_data/browsing_data_cookie_helper_unittest.cc @@ -277,8 +277,10 @@ TEST_F(BrowsingDataCookieHelperTest, CannedDomainCookie) { helper->AddChangedCookie(origin, origin, "A=1; Domain=.www.google.com", net::CookieOptions()); // Try adding invalid cookies that will be ignored. - helper->AddChangedCookie(origin, origin, "", net::CookieOptions()); - helper->AddChangedCookie(origin, origin, "C=bad guy; Domain=wrongdomain.com", + helper->AddChangedCookie(origin, origin, std::string(), net::CookieOptions()); + helper->AddChangedCookie(origin, + origin, + "C=bad guy; Domain=wrongdomain.com", net::CookieOptions()); helper->StartFetching( diff --git a/chrome/browser/browsing_data/browsing_data_database_helper_browsertest.cc b/chrome/browser/browsing_data/browsing_data_database_helper_browsertest.cc index 8c29d07..019a45b 100644 --- a/chrome/browser/browsing_data/browsing_data_database_helper_browsertest.cc +++ b/chrome/browser/browsing_data/browsing_data_database_helper_browsertest.cc @@ -104,9 +104,9 @@ IN_PROC_BROWSER_TEST_F(BrowsingDataDatabaseHelperTest, CannedAddDatabase) { scoped_refptr<CannedBrowsingDataDatabaseHelper> helper( new CannedBrowsingDataDatabaseHelper(browser()->profile())); - helper->AddDatabase(origin1, db1, ""); - helper->AddDatabase(origin1, db2, ""); - helper->AddDatabase(origin2, db3, ""); + helper->AddDatabase(origin1, db1, std::string()); + helper->AddDatabase(origin1, db2, std::string()); + helper->AddDatabase(origin2, db3, std::string()); TestCompletionCallback callback; helper->StartFetching( @@ -136,8 +136,8 @@ IN_PROC_BROWSER_TEST_F(BrowsingDataDatabaseHelperTest, CannedUnique) { scoped_refptr<CannedBrowsingDataDatabaseHelper> helper( new CannedBrowsingDataDatabaseHelper(browser()->profile())); - helper->AddDatabase(origin, db, ""); - helper->AddDatabase(origin, db, ""); + helper->AddDatabase(origin, db, std::string()); + helper->AddDatabase(origin, db, std::string()); TestCompletionCallback callback; helper->StartFetching( diff --git a/chrome/browser/browsing_data/browsing_data_database_helper_unittest.cc b/chrome/browser/browsing_data/browsing_data_database_helper_unittest.cc index 2a2b474..89c290d 100644 --- a/chrome/browser/browsing_data/browsing_data_database_helper_unittest.cc +++ b/chrome/browser/browsing_data/browsing_data_database_helper_unittest.cc @@ -35,7 +35,7 @@ TEST_F(CannedBrowsingDataDatabaseHelperTest, Empty) { new CannedBrowsingDataDatabaseHelper(&profile)); ASSERT_TRUE(helper->empty()); - helper->AddDatabase(origin, db, ""); + helper->AddDatabase(origin, db, std::string()); ASSERT_FALSE(helper->empty()); helper->Reset(); ASSERT_TRUE(helper->empty()); @@ -52,9 +52,9 @@ TEST_F(CannedBrowsingDataDatabaseHelperTest, IgnoreExtensionsAndDevTools) { new CannedBrowsingDataDatabaseHelper(&profile)); ASSERT_TRUE(helper->empty()); - helper->AddDatabase(origin1, db, ""); + helper->AddDatabase(origin1, db, std::string()); ASSERT_TRUE(helper->empty()); - helper->AddDatabase(origin2, db, ""); + helper->AddDatabase(origin2, db, std::string()); ASSERT_TRUE(helper->empty()); helper->Reset(); ASSERT_TRUE(helper->empty()); diff --git a/chrome/browser/browsing_data/cookies_tree_model_unittest.cc b/chrome/browser/browsing_data/cookies_tree_model_unittest.cc index 58b1dd5..9699414 100644 --- a/chrome/browser/browsing_data/cookies_tree_model_unittest.cc +++ b/chrome/browser/browsing_data/cookies_tree_model_unittest.cc @@ -416,7 +416,7 @@ TEST_F(CookiesTreeModelTest, RemoveAll) { SCOPED_TRACE("After removing"); EXPECT_EQ(1, cookies_model->GetRoot()->GetTotalNodeCount()); EXPECT_EQ(0, cookies_model->GetRoot()->child_count()); - EXPECT_EQ(std::string(""), GetDisplayedCookies(cookies_model.get())); + EXPECT_EQ(std::string(), GetDisplayedCookies(cookies_model.get())); EXPECT_TRUE(mock_browsing_data_cookie_helper_->AllDeleted()); EXPECT_TRUE(mock_browsing_data_database_helper_->AllDeleted()); EXPECT_TRUE(mock_browsing_data_local_storage_helper_->AllDeleted()); diff --git a/chrome/browser/certificate_manager_model.cc b/chrome/browser/certificate_manager_model.cc index f519a0d..aecd3a3 100644 --- a/chrome/browser/certificate_manager_model.cc +++ b/chrome/browser/certificate_manager_model.cc @@ -38,7 +38,7 @@ void CertificateManagerModel::Refresh() { chrome::UnlockSlotsIfNecessary( modules, chrome::kCryptoModulePasswordListCerts, - "", // unused. + std::string(), // unused. base::Bind(&CertificateManagerModel::RefreshSlotsUnlocked, base::Unretained(this))); } @@ -95,9 +95,8 @@ string16 CertificateManagerModel::GetColumnText( x509_certificate_model::GetTokenName(cert.os_cert_handle())); break; case COL_SERIAL_NUMBER: - rv = ASCIIToUTF16( - x509_certificate_model::GetSerialNumberHexified( - cert.os_cert_handle(), "")); + rv = ASCIIToUTF16(x509_certificate_model::GetSerialNumberHexified( + cert.os_cert_handle(), std::string())); break; case COL_EXPIRES_ON: if (!cert.valid_expiry().is_null()) diff --git a/chrome/browser/content_settings/content_settings_browsertest.cc b/chrome/browser/content_settings/content_settings_browsertest.cc index 88c664c..f4105ad 100644 --- a/chrome/browser/content_settings/content_settings_browsertest.cc +++ b/chrome/browser/content_settings/content_settings_browsertest.cc @@ -338,12 +338,12 @@ IN_PROC_BROWSER_TEST_F(ClickToPlayPluginTest, AllowException) { browser()->profile()->GetHostContentSettingsMap()->SetDefaultContentSetting( CONTENT_SETTINGS_TYPE_PLUGINS, CONTENT_SETTING_BLOCK); - browser()->profile()->GetHostContentSettingsMap()->SetContentSetting( - ContentSettingsPattern::FromURL(url), - ContentSettingsPattern::Wildcard(), - CONTENT_SETTINGS_TYPE_PLUGINS, - "", - CONTENT_SETTING_ALLOW); + browser()->profile()->GetHostContentSettingsMap() + ->SetContentSetting(ContentSettingsPattern::FromURL(url), + ContentSettingsPattern::Wildcard(), + CONTENT_SETTINGS_TYPE_PLUGINS, + std::string(), + CONTENT_SETTING_ALLOW); string16 expected_title(ASCIIToUTF16("OK")); content::TitleWatcher title_watcher( @@ -357,12 +357,12 @@ IN_PROC_BROWSER_TEST_F(ClickToPlayPluginTest, BlockException) { GURL url = ui_test_utils::GetTestUrl( base::FilePath(), base::FilePath().AppendASCII("clicktoplay.html")); - browser()->profile()->GetHostContentSettingsMap()->SetContentSetting( - ContentSettingsPattern::FromURL(url), - ContentSettingsPattern::Wildcard(), - CONTENT_SETTINGS_TYPE_PLUGINS, - "", - CONTENT_SETTING_BLOCK); + browser()->profile()->GetHostContentSettingsMap() + ->SetContentSetting(ContentSettingsPattern::FromURL(url), + ContentSettingsPattern::Wildcard(), + CONTENT_SETTINGS_TYPE_PLUGINS, + std::string(), + CONTENT_SETTING_BLOCK); string16 expected_title(ASCIIToUTF16("Click To Play")); content::TitleWatcher title_watcher( diff --git a/chrome/browser/content_settings/content_settings_internal_extension_provider.cc b/chrome/browser/content_settings/content_settings_internal_extension_provider.cc index 815d037..56dd993 100644 --- a/chrome/browser/content_settings/content_settings_internal_extension_provider.cc +++ b/chrome/browser/content_settings/content_settings_internal_extension_provider.cc @@ -117,19 +117,19 @@ void InternalExtensionProvider::SetContentSettingForExtension( value_map_.DeleteValue(primary_pattern, secondary_pattern, CONTENT_SETTINGS_TYPE_PLUGINS, - ResourceIdentifier("")); + ResourceIdentifier()); } else { value_map_.SetValue(primary_pattern, secondary_pattern, CONTENT_SETTINGS_TYPE_PLUGINS, - ResourceIdentifier(""), + ResourceIdentifier(), Value::CreateIntegerValue(setting)); } } NotifyObservers(primary_pattern, secondary_pattern, CONTENT_SETTINGS_TYPE_PLUGINS, - ResourceIdentifier("")); + ResourceIdentifier()); } } // namespace content_settings diff --git a/chrome/browser/content_settings/content_settings_origin_identifier_value_map_unittest.cc b/chrome/browser/content_settings/content_settings_origin_identifier_value_map_unittest.cc index 21089fb..b8612a5 100644 --- a/chrome/browser/content_settings/content_settings_origin_identifier_value_map_unittest.cc +++ b/chrome/browser/content_settings/content_settings_origin_identifier_value_map_unittest.cc @@ -14,38 +14,40 @@ TEST(OriginIdentifierValueMapTest, SetGetValue) { content_settings::OriginIdentifierValueMap map; - EXPECT_EQ(NULL, map.GetValue(GURL("http://www.google.com"), - GURL("http://www.google.com"), - CONTENT_SETTINGS_TYPE_COOKIES, - "")); - map.SetValue( - ContentSettingsPattern::FromString("[*.]google.com"), - ContentSettingsPattern::FromString("[*.]google.com"), - CONTENT_SETTINGS_TYPE_COOKIES, - "", - Value::CreateIntegerValue(1)); + EXPECT_EQ(NULL, + map.GetValue(GURL("http://www.google.com"), + GURL("http://www.google.com"), + CONTENT_SETTINGS_TYPE_COOKIES, + std::string())); + map.SetValue(ContentSettingsPattern::FromString("[*.]google.com"), + ContentSettingsPattern::FromString("[*.]google.com"), + CONTENT_SETTINGS_TYPE_COOKIES, + std::string(), + Value::CreateIntegerValue(1)); scoped_ptr<Value> expected_value(Value::CreateIntegerValue(1)); - EXPECT_TRUE(expected_value->Equals( - map.GetValue(GURL("http://www.google.com"), - GURL("http://www.google.com"), - CONTENT_SETTINGS_TYPE_COOKIES, - ""))); - - EXPECT_EQ(NULL, map.GetValue(GURL("http://www.google.com"), - GURL("http://www.youtube.com"), - CONTENT_SETTINGS_TYPE_COOKIES, - "")); - - EXPECT_EQ(NULL, map.GetValue(GURL("http://www.youtube.com"), - GURL("http://www.google.com"), - CONTENT_SETTINGS_TYPE_COOKIES, - "")); - - EXPECT_EQ(NULL, map.GetValue(GURL("http://www.google.com"), - GURL("http://www.google.com"), - CONTENT_SETTINGS_TYPE_POPUPS, - "")); + EXPECT_TRUE(expected_value->Equals(map.GetValue(GURL("http://www.google.com"), + GURL("http://www.google.com"), + CONTENT_SETTINGS_TYPE_COOKIES, + std::string()))); + + EXPECT_EQ(NULL, + map.GetValue(GURL("http://www.google.com"), + GURL("http://www.youtube.com"), + CONTENT_SETTINGS_TYPE_COOKIES, + std::string())); + + EXPECT_EQ(NULL, + map.GetValue(GURL("http://www.youtube.com"), + GURL("http://www.google.com"), + CONTENT_SETTINGS_TYPE_COOKIES, + std::string())); + + EXPECT_EQ(NULL, + map.GetValue(GURL("http://www.google.com"), + GURL("http://www.google.com"), + CONTENT_SETTINGS_TYPE_POPUPS, + std::string())); EXPECT_EQ(NULL, map.GetValue(GURL("http://www.google.com"), GURL("http://www.google.com"), @@ -119,12 +121,11 @@ TEST(OriginIdentifierValueMapTest, Clear) { CONTENT_SETTINGS_TYPE_PLUGINS, "java-plugin", Value::CreateIntegerValue(1)); - map.SetValue( - ContentSettingsPattern::FromString("[*.]google.com"), - ContentSettingsPattern::FromString("[*.]google.com"), - CONTENT_SETTINGS_TYPE_COOKIES, - "", - Value::CreateIntegerValue(1)); + map.SetValue(ContentSettingsPattern::FromString("[*.]google.com"), + ContentSettingsPattern::FromString("[*.]google.com"), + CONTENT_SETTINGS_TYPE_COOKIES, + std::string(), + Value::CreateIntegerValue(1)); EXPECT_FALSE(map.empty()); int actual_value; EXPECT_TRUE(map.GetValue(GURL("http://www.google.com"), @@ -145,38 +146,36 @@ TEST(OriginIdentifierValueMapTest, Clear) { TEST(OriginIdentifierValueMapTest, ListEntryPrecedences) { content_settings::OriginIdentifierValueMap map; - map.SetValue( - ContentSettingsPattern::FromString("[*.]google.com"), - ContentSettingsPattern::FromString("[*.]google.com"), - CONTENT_SETTINGS_TYPE_COOKIES, - "", - Value::CreateIntegerValue(1)); + map.SetValue(ContentSettingsPattern::FromString("[*.]google.com"), + ContentSettingsPattern::FromString("[*.]google.com"), + CONTENT_SETTINGS_TYPE_COOKIES, + std::string(), + Value::CreateIntegerValue(1)); - map.SetValue( - ContentSettingsPattern::FromString("www.google.com"), - ContentSettingsPattern::FromString("[*.]google.com"), - CONTENT_SETTINGS_TYPE_COOKIES, - "", - Value::CreateIntegerValue(2)); + map.SetValue(ContentSettingsPattern::FromString("www.google.com"), + ContentSettingsPattern::FromString("[*.]google.com"), + CONTENT_SETTINGS_TYPE_COOKIES, + std::string(), + Value::CreateIntegerValue(2)); int actual_value; EXPECT_TRUE(map.GetValue(GURL("http://mail.google.com"), GURL("http://www.google.com"), CONTENT_SETTINGS_TYPE_COOKIES, - "")->GetAsInteger(&actual_value)); + std::string())->GetAsInteger(&actual_value)); EXPECT_EQ(1, actual_value); EXPECT_TRUE(map.GetValue(GURL("http://www.google.com"), GURL("http://www.google.com"), CONTENT_SETTINGS_TYPE_COOKIES, - "")->GetAsInteger(&actual_value)); + std::string())->GetAsInteger(&actual_value)); EXPECT_EQ(2, actual_value); } TEST(OriginIdentifierValueMapTest, IterateEmpty) { content_settings::OriginIdentifierValueMap map; scoped_ptr<content_settings::RuleIterator> rule_iterator( - map.GetRuleIterator(CONTENT_SETTINGS_TYPE_COOKIES, "", NULL)); + map.GetRuleIterator(CONTENT_SETTINGS_TYPE_COOKIES, std::string(), NULL)); EXPECT_FALSE(rule_iterator->HasNext()); } @@ -187,21 +186,19 @@ TEST(OriginIdentifierValueMapTest, IterateNonempty) { ContentSettingsPattern::FromString("[*.]google.com"); ContentSettingsPattern sub_pattern = ContentSettingsPattern::FromString("sub.google.com"); - map.SetValue( - pattern, - ContentSettingsPattern::Wildcard(), - CONTENT_SETTINGS_TYPE_COOKIES, - "", - Value::CreateIntegerValue(1)); - map.SetValue( - sub_pattern, - ContentSettingsPattern::Wildcard(), - CONTENT_SETTINGS_TYPE_COOKIES, - "", - Value::CreateIntegerValue(2)); + map.SetValue(pattern, + ContentSettingsPattern::Wildcard(), + CONTENT_SETTINGS_TYPE_COOKIES, + std::string(), + Value::CreateIntegerValue(1)); + map.SetValue(sub_pattern, + ContentSettingsPattern::Wildcard(), + CONTENT_SETTINGS_TYPE_COOKIES, + std::string(), + Value::CreateIntegerValue(2)); scoped_ptr<content_settings::RuleIterator> rule_iterator( - map.GetRuleIterator(CONTENT_SETTINGS_TYPE_COOKIES, "", NULL)); + map.GetRuleIterator(CONTENT_SETTINGS_TYPE_COOKIES, std::string(), NULL)); ASSERT_TRUE(rule_iterator->HasNext()); content_settings::Rule rule = rule_iterator->Next(); EXPECT_EQ(sub_pattern, rule.primary_pattern); diff --git a/chrome/browser/content_settings/content_settings_policy_provider.cc b/chrome/browser/content_settings/content_settings_policy_provider.cc index b112db0..f1e40fb 100644 --- a/chrome/browser/content_settings/content_settings_policy_provider.cc +++ b/chrome/browser/content_settings/content_settings_policy_provider.cc @@ -276,7 +276,7 @@ void PolicyProvider::GetContentSettingsFromPreferences( pattern_pair.first, secondary_pattern, content_type, - ResourceIdentifier(NO_RESOURCE_IDENTIFIER), + NO_RESOURCE_IDENTIFIER, base::Value::CreateIntegerValue( kPrefsForManagedContentSettingsMap[i].setting)); } diff --git a/chrome/browser/content_settings/content_settings_policy_provider_unittest.cc b/chrome/browser/content_settings/content_settings_policy_provider_unittest.cc index 23c43f8..37b718c 100644 --- a/chrome/browser/content_settings/content_settings_policy_provider_unittest.cc +++ b/chrome/browser/content_settings/content_settings_policy_provider_unittest.cc @@ -150,22 +150,34 @@ TEST_F(PolicyProviderTest, GettingManagedContentSettings) { GURL google_url("http://mail.google.com"); EXPECT_EQ(CONTENT_SETTING_DEFAULT, - GetContentSetting( - &provider, youtube_url, youtube_url, - CONTENT_SETTINGS_TYPE_COOKIES, "", false)); + GetContentSetting(&provider, + youtube_url, + youtube_url, + CONTENT_SETTINGS_TYPE_COOKIES, + std::string(), + false)); EXPECT_EQ(NULL, - GetContentSettingValue( - &provider, youtube_url, youtube_url, - CONTENT_SETTINGS_TYPE_COOKIES, "", false)); + GetContentSettingValue(&provider, + youtube_url, + youtube_url, + CONTENT_SETTINGS_TYPE_COOKIES, + std::string(), + false)); EXPECT_EQ(CONTENT_SETTING_BLOCK, - GetContentSetting( - &provider, google_url, google_url, - CONTENT_SETTINGS_TYPE_IMAGES, "", false)); + GetContentSetting(&provider, + google_url, + google_url, + CONTENT_SETTINGS_TYPE_IMAGES, + std::string(), + false)); scoped_ptr<Value> value_ptr( - GetContentSettingValue( - &provider, google_url, google_url, - CONTENT_SETTINGS_TYPE_IMAGES, "", false)); + GetContentSettingValue(&provider, + google_url, + google_url, + CONTENT_SETTINGS_TYPE_IMAGES, + std::string(), + false)); int int_value = -1; value_ptr->GetAsInteger(&int_value); @@ -176,17 +188,19 @@ TEST_F(PolicyProviderTest, GettingManagedContentSettings) { // SetWebsiteSetting does nothing. scoped_ptr<base::Value> value_block( Value::CreateIntegerValue(CONTENT_SETTING_BLOCK)); - bool owned = provider.SetWebsiteSetting( - yt_url_pattern, - yt_url_pattern, - CONTENT_SETTINGS_TYPE_COOKIES, - "", - value_block.get()); + bool owned = provider.SetWebsiteSetting(yt_url_pattern, + yt_url_pattern, + CONTENT_SETTINGS_TYPE_COOKIES, + std::string(), + value_block.get()); EXPECT_FALSE(owned); EXPECT_EQ(CONTENT_SETTING_DEFAULT, - GetContentSetting( - &provider, youtube_url, youtube_url, - CONTENT_SETTINGS_TYPE_COOKIES, "", false)); + GetContentSetting(&provider, + youtube_url, + youtube_url, + CONTENT_SETTINGS_TYPE_COOKIES, + std::string(), + false)); provider.ShutdownOnUIThread(); } @@ -213,9 +227,12 @@ TEST_F(PolicyProviderTest, ResourceIdentifier) { // There is currently no policy support for resource content settings. // Resource identifiers are simply ignored by the PolicyProvider. EXPECT_EQ(CONTENT_SETTING_ALLOW, - GetContentSetting( - &provider, google_url, google_url, - CONTENT_SETTINGS_TYPE_PLUGINS, "", false)); + GetContentSetting(&provider, + google_url, + google_url, + CONTENT_SETTINGS_TYPE_PLUGINS, + std::string(), + false)); EXPECT_EQ(CONTENT_SETTING_DEFAULT, GetContentSetting( @@ -232,10 +249,14 @@ TEST_F(PolicyProviderTest, AutoSelectCertificateList) { PolicyProvider provider(prefs); GURL google_url("https://mail.google.com"); // Tests the default setting for auto selecting certificates - EXPECT_EQ(NULL, - GetContentSettingValue( - &provider, google_url, google_url, - CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, "", false)); + EXPECT_EQ( + NULL, + GetContentSettingValue(&provider, + google_url, + google_url, + CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, + std::string(), + false)); // Set the content settings pattern list for origins to auto select // certificates. @@ -247,13 +268,21 @@ TEST_F(PolicyProviderTest, AutoSelectCertificateList) { prefs->SetManagedPref(prefs::kManagedAutoSelectCertificateForUrls, value); GURL youtube_url("https://www.youtube.com"); - EXPECT_EQ(NULL, - GetContentSettingValue( - &provider, youtube_url, youtube_url, - CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, "", false)); - scoped_ptr<Value> cert_filter(GetContentSettingValue( - &provider, google_url, google_url, - CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, "", false)); + EXPECT_EQ( + NULL, + GetContentSettingValue(&provider, + youtube_url, + youtube_url, + CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, + std::string(), + false)); + scoped_ptr<Value> cert_filter( + GetContentSettingValue(&provider, + google_url, + google_url, + CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, + std::string(), + false)); ASSERT_EQ(Value::TYPE_DICTIONARY, cert_filter->GetType()); DictionaryValue* dict_value = diff --git a/chrome/browser/content_settings/content_settings_pref_provider.cc b/chrome/browser/content_settings/content_settings_pref_provider.cc index a92315e..4690f2f 100644 --- a/chrome/browser/content_settings/content_settings_pref_provider.cc +++ b/chrome/browser/content_settings/content_settings_pref_provider.cc @@ -188,22 +188,21 @@ void PrefProvider::ClearAllContentSettingsRules( { base::AutoLock auto_lock(lock_); scoped_ptr<RuleIterator> rule_iterator( - map_to_modify->GetRuleIterator(content_type, "", NULL)); + map_to_modify->GetRuleIterator(content_type, std::string(), NULL)); // Copy the rules; we cannot call |UpdatePref| while holding |lock_|. while (rule_iterator->HasNext()) rules_to_delete.push_back(rule_iterator->Next()); - map_to_modify->DeleteValues(content_type, ""); + map_to_modify->DeleteValues(content_type, std::string()); } for (std::vector<Rule>::const_iterator it = rules_to_delete.begin(); it != rules_to_delete.end(); ++it) { - UpdatePref( - it->primary_pattern, - it->secondary_pattern, - content_type, - "", - NULL); + UpdatePref(it->primary_pattern, + it->secondary_pattern, + content_type, + std::string(), + NULL); } NotifyObservers(ContentSettingsPattern(), ContentSettingsPattern(), @@ -307,8 +306,8 @@ void PrefProvider::UpdatePref( void PrefProvider::MigrateObsoleteMediaContentSetting() { std::vector<Rule> rules_to_delete; { - scoped_ptr<RuleIterator> rule_iterator( - GetRuleIterator(CONTENT_SETTINGS_TYPE_MEDIASTREAM, "", false)); + scoped_ptr<RuleIterator> rule_iterator(GetRuleIterator( + CONTENT_SETTINGS_TYPE_MEDIASTREAM, std::string(), false)); while (rule_iterator->HasNext()) { // Skip default setting and rules without a value. const content_settings::Rule& rule = rule_iterator->Next(); @@ -333,7 +332,7 @@ void PrefProvider::MigrateObsoleteMediaContentSetting() { SetWebsiteSetting(it->primary_pattern, it->secondary_pattern, CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, - "", + std::string(), Value::CreateIntegerValue(CONTENT_SETTING_ALLOW)); } // Add the exception to the new camera content setting. @@ -341,7 +340,7 @@ void PrefProvider::MigrateObsoleteMediaContentSetting() { SetWebsiteSetting(it->primary_pattern, it->secondary_pattern, CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, - "", + std::string(), Value::CreateIntegerValue(CONTENT_SETTING_ALLOW)); } @@ -349,7 +348,7 @@ void PrefProvider::MigrateObsoleteMediaContentSetting() { SetWebsiteSetting(it->primary_pattern, it->secondary_pattern, CONTENT_SETTINGS_TYPE_MEDIASTREAM, - "", + std::string(), NULL); } } @@ -455,7 +454,7 @@ void PrefProvider::ReadContentSettingsFromPref(bool overwrite) { value_map_.SetValue(pattern_pair.first, pattern_pair.second, content_type, - ResourceIdentifier(""), + ResourceIdentifier(), value); if (content_type == CONTENT_SETTINGS_TYPE_COOKIES) { ContentSetting s = ValueToContentSetting(value); diff --git a/chrome/browser/content_settings/content_settings_pref_provider_unittest.cc b/chrome/browser/content_settings/content_settings_pref_provider_unittest.cc index f951829..1ddc6d0 100644 --- a/chrome/browser/content_settings/content_settings_pref_provider_unittest.cc +++ b/chrome/browser/content_settings/content_settings_pref_provider_unittest.cc @@ -121,7 +121,7 @@ TEST_F(PrefProviderTest, Observer) { pattern, ContentSettingsPattern::Wildcard(), CONTENT_SETTINGS_TYPE_IMAGES, - "", + std::string(), Value::CreateIntegerValue(CONTENT_SETTING_ALLOW)); pref_content_settings_provider.ShutdownOnUIThread(); @@ -166,20 +166,26 @@ TEST_F(PrefProviderTest, Incognito) { pattern, pattern, CONTENT_SETTINGS_TYPE_IMAGES, - "", + std::string(), Value::CreateIntegerValue(CONTENT_SETTING_ALLOW)); GURL host("http://example.com/"); // The value should of course be visible in the regular PrefProvider. EXPECT_EQ(CONTENT_SETTING_ALLOW, - GetContentSetting( - &pref_content_settings_provider, - host, host, CONTENT_SETTINGS_TYPE_IMAGES, "", false)); + GetContentSetting(&pref_content_settings_provider, + host, + host, + CONTENT_SETTINGS_TYPE_IMAGES, + std::string(), + false)); // And also in the OTR version. EXPECT_EQ(CONTENT_SETTING_ALLOW, - GetContentSetting( - &pref_content_settings_provider_incognito, - host, host, CONTENT_SETTINGS_TYPE_IMAGES, "", false)); + GetContentSetting(&pref_content_settings_provider_incognito, + host, + host, + CONTENT_SETTINGS_TYPE_IMAGES, + std::string(), + false)); // But the value should not be overridden in the OTR user prefs accidentally. EXPECT_FALSE(otr_user_prefs->IsSetInOverlay( prefs::kContentSettingsPatternPairs)); @@ -197,26 +203,40 @@ TEST_F(PrefProviderTest, GetContentSettingsValue) { ContentSettingsPattern::FromString("[*.]example.com"); EXPECT_EQ(CONTENT_SETTING_DEFAULT, - GetContentSetting(&provider, primary_url, primary_url, - CONTENT_SETTINGS_TYPE_IMAGES, "", false)); + GetContentSetting(&provider, + primary_url, + primary_url, + CONTENT_SETTINGS_TYPE_IMAGES, + std::string(), + false)); EXPECT_EQ(NULL, - GetContentSettingValue( - &provider, primary_url, primary_url, - CONTENT_SETTINGS_TYPE_IMAGES, "", false)); + GetContentSettingValue(&provider, + primary_url, + primary_url, + CONTENT_SETTINGS_TYPE_IMAGES, + std::string(), + false)); - provider.SetWebsiteSetting( - primary_pattern, - primary_pattern, - CONTENT_SETTINGS_TYPE_IMAGES, - "", - Value::CreateIntegerValue(CONTENT_SETTING_BLOCK)); + provider.SetWebsiteSetting(primary_pattern, + primary_pattern, + CONTENT_SETTINGS_TYPE_IMAGES, + std::string(), + Value::CreateIntegerValue(CONTENT_SETTING_BLOCK)); EXPECT_EQ(CONTENT_SETTING_BLOCK, - GetContentSetting(&provider, primary_url, primary_url, - CONTENT_SETTINGS_TYPE_IMAGES, "", false)); + GetContentSetting(&provider, + primary_url, + primary_url, + CONTENT_SETTINGS_TYPE_IMAGES, + std::string(), + false)); scoped_ptr<Value> value_ptr( - GetContentSettingValue(&provider, primary_url, primary_url, - CONTENT_SETTINGS_TYPE_IMAGES, "", false)); + GetContentSettingValue(&provider, + primary_url, + primary_url, + CONTENT_SETTINGS_TYPE_IMAGES, + std::string(), + false)); int int_value = -1; value_ptr->GetAsInteger(&int_value); EXPECT_EQ(CONTENT_SETTING_BLOCK, IntToContentSetting(int_value)); @@ -224,12 +244,15 @@ TEST_F(PrefProviderTest, GetContentSettingsValue) { provider.SetWebsiteSetting(primary_pattern, primary_pattern, CONTENT_SETTINGS_TYPE_IMAGES, - "", + std::string(), NULL); EXPECT_EQ(NULL, - GetContentSettingValue( - &provider, primary_url, primary_url, - CONTENT_SETTINGS_TYPE_IMAGES, "", false)); + GetContentSettingValue(&provider, + primary_url, + primary_url, + CONTENT_SETTINGS_TYPE_IMAGES, + std::string(), + false)); provider.ShutdownOnUIThread(); } @@ -250,53 +273,74 @@ TEST_F(PrefProviderTest, Patterns) { ContentSettingsPattern::FromString("file:///tmp/test.html"); EXPECT_EQ(CONTENT_SETTING_DEFAULT, - GetContentSetting( - &pref_content_settings_provider, - host1, host1, CONTENT_SETTINGS_TYPE_IMAGES, "", false)); + GetContentSetting(&pref_content_settings_provider, + host1, + host1, + CONTENT_SETTINGS_TYPE_IMAGES, + std::string(), + false)); pref_content_settings_provider.SetWebsiteSetting( pattern1, pattern1, CONTENT_SETTINGS_TYPE_IMAGES, - "", + std::string(), Value::CreateIntegerValue(CONTENT_SETTING_BLOCK)); EXPECT_EQ(CONTENT_SETTING_BLOCK, - GetContentSetting( - &pref_content_settings_provider, - host1, host1, CONTENT_SETTINGS_TYPE_IMAGES, "", false)); + GetContentSetting(&pref_content_settings_provider, + host1, + host1, + CONTENT_SETTINGS_TYPE_IMAGES, + std::string(), + false)); EXPECT_EQ(CONTENT_SETTING_BLOCK, - GetContentSetting( - &pref_content_settings_provider, - host2, host2, CONTENT_SETTINGS_TYPE_IMAGES, "", false)); + GetContentSetting(&pref_content_settings_provider, + host2, + host2, + CONTENT_SETTINGS_TYPE_IMAGES, + std::string(), + false)); EXPECT_EQ(CONTENT_SETTING_DEFAULT, - GetContentSetting( - &pref_content_settings_provider, - host3, host3, CONTENT_SETTINGS_TYPE_IMAGES, "", false)); + GetContentSetting(&pref_content_settings_provider, + host3, + host3, + CONTENT_SETTINGS_TYPE_IMAGES, + std::string(), + false)); pref_content_settings_provider.SetWebsiteSetting( pattern2, pattern2, CONTENT_SETTINGS_TYPE_IMAGES, - "", + std::string(), Value::CreateIntegerValue(CONTENT_SETTING_BLOCK)); EXPECT_EQ(CONTENT_SETTING_BLOCK, - GetContentSetting( - &pref_content_settings_provider, - host3, host3, CONTENT_SETTINGS_TYPE_IMAGES, "", false)); + GetContentSetting(&pref_content_settings_provider, + host3, + host3, + CONTENT_SETTINGS_TYPE_IMAGES, + std::string(), + false)); EXPECT_EQ(CONTENT_SETTING_DEFAULT, GetContentSetting(&pref_content_settings_provider, - host4, host4, CONTENT_SETTINGS_TYPE_IMAGES, "", + host4, + host4, + CONTENT_SETTINGS_TYPE_IMAGES, + std::string(), false)); pref_content_settings_provider.SetWebsiteSetting( pattern3, pattern3, CONTENT_SETTINGS_TYPE_IMAGES, - "", + std::string(), Value::CreateIntegerValue(CONTENT_SETTING_BLOCK)); EXPECT_EQ(CONTENT_SETTING_BLOCK, - GetContentSetting( - &pref_content_settings_provider, - host4, host4, CONTENT_SETTINGS_TYPE_IMAGES, "", false)); + GetContentSetting(&pref_content_settings_provider, + host4, + host4, + CONTENT_SETTINGS_TYPE_IMAGES, + std::string(), + false)); pref_content_settings_provider.ShutdownOnUIThread(); } diff --git a/chrome/browser/content_settings/content_settings_provider.h b/chrome/browser/content_settings/content_settings_provider.h index fefa226..6bc64de 100644 --- a/chrome/browser/content_settings/content_settings_provider.h +++ b/chrome/browser/content_settings/content_settings_provider.h @@ -7,7 +7,7 @@ #ifndef CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_PROVIDER_H_ #define CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_PROVIDER_H_ -#define NO_RESOURCE_IDENTIFIER "" +#define NO_RESOURCE_IDENTIFIER std::string() #include <string> #include <vector> diff --git a/chrome/browser/content_settings/content_settings_provider_unittest.cc b/chrome/browser/content_settings/content_settings_provider_unittest.cc index e0857b3..0832a1c 100644 --- a/chrome/browser/content_settings/content_settings_provider_unittest.cc +++ b/chrome/browser/content_settings/content_settings_provider_unittest.cc @@ -46,11 +46,18 @@ TEST(ContentSettingsProviderTest, Mock) { CONTENT_SETTINGS_TYPE_PLUGINS, "flash_plugin", false)); EXPECT_EQ(CONTENT_SETTING_DEFAULT, - GetContentSetting(&mock_provider, url, url, - CONTENT_SETTINGS_TYPE_GEOLOCATION, "", false)); + GetContentSetting(&mock_provider, + url, + url, + CONTENT_SETTINGS_TYPE_GEOLOCATION, + std::string(), + false)); EXPECT_EQ(NULL, - GetContentSettingValue(&mock_provider, url, url, - CONTENT_SETTINGS_TYPE_GEOLOCATION, "", + GetContentSettingValue(&mock_provider, + url, + url, + CONTENT_SETTINGS_TYPE_GEOLOCATION, + std::string(), false)); bool owned = mock_provider.SetWebsiteSetting( diff --git a/chrome/browser/content_settings/content_settings_utils.cc b/chrome/browser/content_settings/content_settings_utils.cc index d3a2869..9754ba1 100644 --- a/chrome/browser/content_settings/content_settings_utils.cc +++ b/chrome/browser/content_settings/content_settings_utils.cc @@ -190,10 +190,10 @@ ContentSetting GetContentSetting(const ProviderInterface* provider, void GetRendererContentSettingRules(const HostContentSettingsMap* map, RendererContentSettingRules* rules) { - map->GetSettingsForOneType(CONTENT_SETTINGS_TYPE_IMAGES, "", - &(rules->image_rules)); - map->GetSettingsForOneType(CONTENT_SETTINGS_TYPE_JAVASCRIPT, "", - &(rules->script_rules)); + map->GetSettingsForOneType( + CONTENT_SETTINGS_TYPE_IMAGES, std::string(), &(rules->image_rules)); + map->GetSettingsForOneType( + CONTENT_SETTINGS_TYPE_JAVASCRIPT, std::string(), &(rules->script_rules)); } } // namespace content_settings diff --git a/chrome/browser/content_settings/content_settings_utils_unittest.cc b/chrome/browser/content_settings/content_settings_utils_unittest.cc index 69f88c1..d5eeeca 100644 --- a/chrome/browser/content_settings/content_settings_utils_unittest.cc +++ b/chrome/browser/content_settings/content_settings_utils_unittest.cc @@ -11,7 +11,7 @@ TEST(ContentSettingsUtilsTest, ParsePatternString) { content_settings::PatternPair pattern_pair; - pattern_pair = content_settings::ParsePatternString(""); + pattern_pair = content_settings::ParsePatternString(std::string()); EXPECT_FALSE(pattern_pair.first.IsValid()); EXPECT_FALSE(pattern_pair.second.IsValid()); diff --git a/chrome/browser/content_settings/cookie_settings.cc b/chrome/browser/content_settings/cookie_settings.cc index e34a56e..e0b1ff6 100644 --- a/chrome/browser/content_settings/cookie_settings.cc +++ b/chrome/browser/content_settings/cookie_settings.cc @@ -130,7 +130,7 @@ bool CookieSettings::IsCookieSessionOnly(const GURL& origin) const { void CookieSettings::GetCookieSettings( ContentSettingsForOneType* settings) const { return host_content_settings_map_->GetSettingsForOneType( - CONTENT_SETTINGS_TYPE_COOKIES, "", settings); + CONTENT_SETTINGS_TYPE_COOKIES, std::string(), settings); } void CookieSettings::SetDefaultCookieSetting(ContentSetting setting) { @@ -147,17 +147,21 @@ void CookieSettings::SetCookieSetting( if (setting == CONTENT_SETTING_SESSION_ONLY) { DCHECK(secondary_pattern == ContentSettingsPattern::Wildcard()); } - host_content_settings_map_->SetContentSetting( - primary_pattern, secondary_pattern, CONTENT_SETTINGS_TYPE_COOKIES, "", - setting); + host_content_settings_map_->SetContentSetting(primary_pattern, + secondary_pattern, + CONTENT_SETTINGS_TYPE_COOKIES, + std::string(), + setting); } void CookieSettings::ResetCookieSetting( const ContentSettingsPattern& primary_pattern, const ContentSettingsPattern& secondary_pattern) { - host_content_settings_map_->SetContentSetting( - primary_pattern, secondary_pattern, CONTENT_SETTINGS_TYPE_COOKIES, "", - CONTENT_SETTING_DEFAULT); + host_content_settings_map_->SetContentSetting(primary_pattern, + secondary_pattern, + CONTENT_SETTINGS_TYPE_COOKIES, + std::string(), + CONTENT_SETTING_DEFAULT); } void CookieSettings::ShutdownOnUIThread() { @@ -176,9 +180,12 @@ ContentSetting CookieSettings::GetCookieSetting( // First get any host-specific settings. content_settings::SettingInfo info; - scoped_ptr<base::Value> value( - host_content_settings_map_->GetWebsiteSetting( - url, first_party_url, CONTENT_SETTINGS_TYPE_COOKIES, "", &info)); + scoped_ptr<base::Value> value(host_content_settings_map_->GetWebsiteSetting( + url, + first_party_url, + CONTENT_SETTINGS_TYPE_COOKIES, + std::string(), + &info)); if (source) *source = info.source; diff --git a/chrome/browser/content_settings/host_content_settings_map.cc b/chrome/browser/content_settings/host_content_settings_map.cc index 8749d6f..777203d 100644 --- a/chrome/browser/content_settings/host_content_settings_map.cc +++ b/chrome/browser/content_settings/host_content_settings_map.cc @@ -133,7 +133,7 @@ void HostContentSettingsMap::RegisterExtensionService( OnContentSettingChanged(ContentSettingsPattern(), ContentSettingsPattern(), CONTENT_SETTINGS_TYPE_DEFAULT, - ""); + std::string()); } #endif @@ -159,7 +159,7 @@ ContentSetting HostContentSettingsMap::GetDefaultContentSettingFromProvider( ContentSettingsType content_type, content_settings::ProviderInterface* provider) const { scoped_ptr<content_settings::RuleIterator> rule_iterator( - provider->GetRuleIterator(content_type, "", false)); + provider->GetRuleIterator(content_type, std::string(), false)); ContentSettingsPattern wildcard = ContentSettingsPattern::Wildcard(); while (rule_iterator->HasNext()) { @@ -460,19 +460,18 @@ void HostContentSettingsMap::MigrateObsoleteClearOnExitPref() { AddSettingsForOneType(content_settings_providers_[PREF_PROVIDER], PREF_PROVIDER, CONTENT_SETTINGS_TYPE_COOKIES, - "", + std::string(), &exceptions, false); for (ContentSettingsForOneType::iterator it = exceptions.begin(); it != exceptions.end(); ++it) { if (it->setting != CONTENT_SETTING_ALLOW) continue; - SetWebsiteSetting( - it->primary_pattern, - it->secondary_pattern, - CONTENT_SETTINGS_TYPE_COOKIES, - "", - Value::CreateIntegerValue(CONTENT_SETTING_SESSION_ONLY)); + SetWebsiteSetting(it->primary_pattern, + it->secondary_pattern, + CONTENT_SETTINGS_TYPE_COOKIES, + std::string(), + Value::CreateIntegerValue(CONTENT_SETTING_SESSION_ONLY)); } prefs_->SetBoolean(prefs::kContentSettingsClearOnExitMigrated, true); diff --git a/chrome/browser/content_settings/host_content_settings_map_unittest.cc b/chrome/browser/content_settings/host_content_settings_map_unittest.cc index 57fd929..bba4336 100644 --- a/chrome/browser/content_settings/host_content_settings_map_unittest.cc +++ b/chrome/browser/content_settings/host_content_settings_map_unittest.cc @@ -81,16 +81,16 @@ TEST_F(HostContentSettingsMapTest, IndividualSettings) { ContentSettingsPattern::FromString("[*.]example.com"); EXPECT_EQ(CONTENT_SETTING_ALLOW, host_content_settings_map->GetContentSetting( - host, host, CONTENT_SETTINGS_TYPE_IMAGES, "")); + host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); host_content_settings_map->SetContentSetting( pattern, ContentSettingsPattern::Wildcard(), CONTENT_SETTINGS_TYPE_IMAGES, - "", + std::string(), CONTENT_SETTING_DEFAULT); EXPECT_EQ(CONTENT_SETTING_ALLOW, host_content_settings_map->GetContentSetting( - host, host, CONTENT_SETTINGS_TYPE_IMAGES, "")); + host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); host_content_settings_map->SetContentSetting( pattern, ContentSettingsPattern::Wildcard(), @@ -99,10 +99,10 @@ TEST_F(HostContentSettingsMapTest, IndividualSettings) { CONTENT_SETTING_BLOCK); EXPECT_EQ(CONTENT_SETTING_BLOCK, host_content_settings_map->GetContentSetting( - host, host, CONTENT_SETTINGS_TYPE_IMAGES, "")); + host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); EXPECT_EQ(CONTENT_SETTING_ALLOW, host_content_settings_map->GetContentSetting( - host, host, CONTENT_SETTINGS_TYPE_PLUGINS, "")); + host, host, CONTENT_SETTINGS_TYPE_PLUGINS, std::string())); // Check returning all settings for a host. host_content_settings_map->SetContentSetting( @@ -113,7 +113,7 @@ TEST_F(HostContentSettingsMapTest, IndividualSettings) { CONTENT_SETTING_DEFAULT); EXPECT_EQ(CONTENT_SETTING_ALLOW, host_content_settings_map->GetContentSetting( - host, host, CONTENT_SETTINGS_TYPE_IMAGES, "")); + host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); host_content_settings_map->SetContentSetting( pattern, ContentSettingsPattern::Wildcard(), @@ -122,7 +122,7 @@ TEST_F(HostContentSettingsMapTest, IndividualSettings) { CONTENT_SETTING_BLOCK); EXPECT_EQ(CONTENT_SETTING_BLOCK, host_content_settings_map->GetContentSetting( - host, host, CONTENT_SETTINGS_TYPE_JAVASCRIPT, "")); + host, host, CONTENT_SETTINGS_TYPE_JAVASCRIPT, std::string())); host_content_settings_map->SetContentSetting( pattern, ContentSettingsPattern::Wildcard(), @@ -131,22 +131,23 @@ TEST_F(HostContentSettingsMapTest, IndividualSettings) { CONTENT_SETTING_ALLOW); EXPECT_EQ(CONTENT_SETTING_ALLOW, host_content_settings_map->GetContentSetting( - host, host, CONTENT_SETTINGS_TYPE_PLUGINS, "")); + host, host, CONTENT_SETTINGS_TYPE_PLUGINS, std::string())); EXPECT_EQ(CONTENT_SETTING_BLOCK, host_content_settings_map->GetContentSetting( - host, host, CONTENT_SETTINGS_TYPE_POPUPS, "")); - EXPECT_EQ(CONTENT_SETTING_ASK, - host_content_settings_map->GetContentSetting( - host, host, CONTENT_SETTINGS_TYPE_GEOLOCATION, "")); + host, host, CONTENT_SETTINGS_TYPE_POPUPS, std::string())); EXPECT_EQ(CONTENT_SETTING_ASK, host_content_settings_map->GetContentSetting( - host, host, CONTENT_SETTINGS_TYPE_NOTIFICATIONS, "")); + host, host, CONTENT_SETTINGS_TYPE_GEOLOCATION, std::string())); + EXPECT_EQ( + CONTENT_SETTING_ASK, + host_content_settings_map->GetContentSetting( + host, host, CONTENT_SETTINGS_TYPE_NOTIFICATIONS, std::string())); EXPECT_EQ(CONTENT_SETTING_ASK, host_content_settings_map->GetContentSetting( - host, host, CONTENT_SETTINGS_TYPE_FULLSCREEN, "")); + host, host, CONTENT_SETTINGS_TYPE_FULLSCREEN, std::string())); EXPECT_EQ(CONTENT_SETTING_ASK, host_content_settings_map->GetContentSetting( - host, host, CONTENT_SETTINGS_TYPE_MOUSELOCK, "")); + host, host, CONTENT_SETTINGS_TYPE_MOUSELOCK, std::string())); // Check returning all hosts for a setting. ContentSettingsPattern pattern2 = @@ -164,18 +165,16 @@ TEST_F(HostContentSettingsMapTest, IndividualSettings) { std::string(), CONTENT_SETTING_BLOCK); ContentSettingsForOneType host_settings; - host_content_settings_map->GetSettingsForOneType(CONTENT_SETTINGS_TYPE_IMAGES, - "", - &host_settings); + host_content_settings_map->GetSettingsForOneType( + CONTENT_SETTINGS_TYPE_IMAGES, std::string(), &host_settings); // |host_settings| contains the default setting and an exception. EXPECT_EQ(2U, host_settings.size()); host_content_settings_map->GetSettingsForOneType( - CONTENT_SETTINGS_TYPE_PLUGINS, "", &host_settings); + CONTENT_SETTINGS_TYPE_PLUGINS, std::string(), &host_settings); // |host_settings| contains the default setting and 2 exceptions. EXPECT_EQ(3U, host_settings.size()); - host_content_settings_map->GetSettingsForOneType(CONTENT_SETTINGS_TYPE_POPUPS, - "", - &host_settings); + host_content_settings_map->GetSettingsForOneType( + CONTENT_SETTINGS_TYPE_POPUPS, std::string(), &host_settings); // |host_settings| contains only the default setting. EXPECT_EQ(1U, host_settings.size()); } @@ -217,13 +216,12 @@ TEST_F(HostContentSettingsMapTest, Clear) { host_content_settings_map->ClearSettingsForOneType( CONTENT_SETTINGS_TYPE_IMAGES); ContentSettingsForOneType host_settings; - host_content_settings_map->GetSettingsForOneType(CONTENT_SETTINGS_TYPE_IMAGES, - "", - &host_settings); + host_content_settings_map->GetSettingsForOneType( + CONTENT_SETTINGS_TYPE_IMAGES, std::string(), &host_settings); // |host_settings| contains only the default setting. EXPECT_EQ(1U, host_settings.size()); host_content_settings_map->GetSettingsForOneType( - CONTENT_SETTINGS_TYPE_PLUGINS, "", &host_settings); + CONTENT_SETTINGS_TYPE_PLUGINS, std::string(), &host_settings); // |host_settings| contains the default setting and an exception. EXPECT_EQ(2U, host_settings.size()); } @@ -242,7 +240,7 @@ TEST_F(HostContentSettingsMapTest, Patterns) { ContentSettingsPattern::FromString("example.org"); EXPECT_EQ(CONTENT_SETTING_ALLOW, host_content_settings_map->GetContentSetting( - host1, host1, CONTENT_SETTINGS_TYPE_IMAGES, "")); + host1, host1, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); host_content_settings_map->SetContentSetting( pattern1, ContentSettingsPattern::Wildcard(), @@ -251,13 +249,13 @@ TEST_F(HostContentSettingsMapTest, Patterns) { CONTENT_SETTING_BLOCK); EXPECT_EQ(CONTENT_SETTING_BLOCK, host_content_settings_map->GetContentSetting( - host1, host1, CONTENT_SETTINGS_TYPE_IMAGES, "")); + host1, host1, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); EXPECT_EQ(CONTENT_SETTING_BLOCK, host_content_settings_map->GetContentSetting( - host2, host2, CONTENT_SETTINGS_TYPE_IMAGES, "")); + host2, host2, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); EXPECT_EQ(CONTENT_SETTING_ALLOW, host_content_settings_map->GetContentSetting( - host3, host3, CONTENT_SETTINGS_TYPE_IMAGES, "")); + host3, host3, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); host_content_settings_map->SetContentSetting( pattern2, ContentSettingsPattern::Wildcard(), @@ -266,7 +264,7 @@ TEST_F(HostContentSettingsMapTest, Patterns) { CONTENT_SETTING_BLOCK); EXPECT_EQ(CONTENT_SETTING_BLOCK, host_content_settings_map->GetContentSetting( - host3, host3, CONTENT_SETTINGS_TYPE_IMAGES, "")); + host3, host3, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); } TEST_F(HostContentSettingsMapTest, Observer) { @@ -327,7 +325,7 @@ TEST_F(HostContentSettingsMapTest, ObserveDefaultPref) { CONTENT_SETTINGS_TYPE_IMAGES, CONTENT_SETTING_BLOCK); EXPECT_EQ(CONTENT_SETTING_BLOCK, host_content_settings_map->GetContentSetting( - host, host, CONTENT_SETTINGS_TYPE_IMAGES, "")); + host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); // Make a copy of the pref's new value so we can reset it later. scoped_ptr<Value> new_value(prefs->FindPreference( @@ -337,13 +335,13 @@ TEST_F(HostContentSettingsMapTest, ObserveDefaultPref) { prefs->Set(prefs::kDefaultContentSettings, *default_value); EXPECT_EQ(CONTENT_SETTING_ALLOW, host_content_settings_map->GetContentSetting( - host, host, CONTENT_SETTINGS_TYPE_IMAGES, "")); + host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); // Reseting the pref to its previous value should update the cache. prefs->Set(prefs::kDefaultContentSettings, *new_value); EXPECT_EQ(CONTENT_SETTING_BLOCK, host_content_settings_map->GetContentSetting( - host, host, CONTENT_SETTINGS_TYPE_IMAGES, "")); + host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); } TEST_F(HostContentSettingsMapTest, ObserveExceptionPref) { @@ -363,7 +361,7 @@ TEST_F(HostContentSettingsMapTest, ObserveExceptionPref) { EXPECT_EQ(CONTENT_SETTING_ALLOW, host_content_settings_map->GetContentSetting( - host, host, CONTENT_SETTINGS_TYPE_IMAGES, "")); + host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); host_content_settings_map->SetContentSetting( pattern, @@ -373,7 +371,7 @@ TEST_F(HostContentSettingsMapTest, ObserveExceptionPref) { CONTENT_SETTING_BLOCK); EXPECT_EQ(CONTENT_SETTING_BLOCK, host_content_settings_map->GetContentSetting( - host, host, CONTENT_SETTINGS_TYPE_IMAGES, "")); + host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); // Make a copy of the pref's new value so we can reset it later. scoped_ptr<Value> new_value(prefs->FindPreference( @@ -383,13 +381,13 @@ TEST_F(HostContentSettingsMapTest, ObserveExceptionPref) { prefs->Set(prefs::kContentSettingsPatternPairs, *default_value); EXPECT_EQ(CONTENT_SETTING_ALLOW, host_content_settings_map->GetContentSetting( - host, host, CONTENT_SETTINGS_TYPE_IMAGES, "")); + host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); // Reseting the pref to its previous value should update the cache. prefs->Set(prefs::kContentSettingsPatternPairs, *new_value); EXPECT_EQ(CONTENT_SETTING_BLOCK, host_content_settings_map->GetContentSetting( - host, host, CONTENT_SETTINGS_TYPE_IMAGES, "")); + host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); } TEST_F(HostContentSettingsMapTest, HostTrimEndingDotCheck) { @@ -413,26 +411,26 @@ TEST_F(HostContentSettingsMapTest, HostTrimEndingDotCheck) { pattern, ContentSettingsPattern::Wildcard(), CONTENT_SETTINGS_TYPE_IMAGES, - "", + std::string(), CONTENT_SETTING_DEFAULT); - EXPECT_EQ(CONTENT_SETTING_ALLOW, - host_content_settings_map->GetContentSetting( - host_ending_with_dot, - host_ending_with_dot, - CONTENT_SETTINGS_TYPE_IMAGES, - "")); + EXPECT_EQ( + CONTENT_SETTING_ALLOW, + host_content_settings_map->GetContentSetting(host_ending_with_dot, + host_ending_with_dot, + CONTENT_SETTINGS_TYPE_IMAGES, + std::string())); host_content_settings_map->SetContentSetting( pattern, ContentSettingsPattern::Wildcard(), CONTENT_SETTINGS_TYPE_IMAGES, - "", + std::string(), CONTENT_SETTING_BLOCK); - EXPECT_EQ(CONTENT_SETTING_BLOCK, - host_content_settings_map->GetContentSetting( - host_ending_with_dot, - host_ending_with_dot, - CONTENT_SETTINGS_TYPE_IMAGES, - "")); + EXPECT_EQ( + CONTENT_SETTING_BLOCK, + host_content_settings_map->GetContentSetting(host_ending_with_dot, + host_ending_with_dot, + CONTENT_SETTINGS_TYPE_IMAGES, + std::string())); EXPECT_TRUE(cookie_settings->IsSettingCookieAllowed( host_ending_with_dot, host_ending_with_dot)); @@ -440,7 +438,7 @@ TEST_F(HostContentSettingsMapTest, HostTrimEndingDotCheck) { pattern, ContentSettingsPattern::Wildcard(), CONTENT_SETTINGS_TYPE_COOKIES, - "", + std::string(), CONTENT_SETTING_DEFAULT); EXPECT_TRUE(cookie_settings->IsSettingCookieAllowed( host_ending_with_dot, host_ending_with_dot)); @@ -448,7 +446,7 @@ TEST_F(HostContentSettingsMapTest, HostTrimEndingDotCheck) { pattern, ContentSettingsPattern::Wildcard(), CONTENT_SETTINGS_TYPE_COOKIES, - "", + std::string(), CONTENT_SETTING_BLOCK); EXPECT_FALSE(cookie_settings->IsSettingCookieAllowed( host_ending_with_dot, host_ending_with_dot)); @@ -458,93 +456,93 @@ TEST_F(HostContentSettingsMapTest, HostTrimEndingDotCheck) { host_ending_with_dot, host_ending_with_dot, CONTENT_SETTINGS_TYPE_JAVASCRIPT, - "")); + std::string())); host_content_settings_map->SetContentSetting( pattern, ContentSettingsPattern::Wildcard(), CONTENT_SETTINGS_TYPE_JAVASCRIPT, - "", + std::string(), CONTENT_SETTING_DEFAULT); EXPECT_EQ(CONTENT_SETTING_ALLOW, host_content_settings_map->GetContentSetting( host_ending_with_dot, host_ending_with_dot, CONTENT_SETTINGS_TYPE_JAVASCRIPT, - "")); + std::string())); host_content_settings_map->SetContentSetting( pattern, ContentSettingsPattern::Wildcard(), CONTENT_SETTINGS_TYPE_JAVASCRIPT, - "", + std::string(), CONTENT_SETTING_BLOCK); EXPECT_EQ(CONTENT_SETTING_BLOCK, host_content_settings_map->GetContentSetting( host_ending_with_dot, host_ending_with_dot, CONTENT_SETTINGS_TYPE_JAVASCRIPT, - "")); + std::string())); EXPECT_EQ(CONTENT_SETTING_ALLOW, host_content_settings_map->GetContentSetting( host_ending_with_dot, host_ending_with_dot, CONTENT_SETTINGS_TYPE_PLUGINS, - "")); + std::string())); host_content_settings_map->SetContentSetting( pattern, ContentSettingsPattern::Wildcard(), CONTENT_SETTINGS_TYPE_PLUGINS, - "", + std::string(), CONTENT_SETTING_DEFAULT); EXPECT_EQ(CONTENT_SETTING_ALLOW, host_content_settings_map->GetContentSetting( host_ending_with_dot, host_ending_with_dot, CONTENT_SETTINGS_TYPE_PLUGINS, - "")); + std::string())); host_content_settings_map->SetContentSetting( pattern, ContentSettingsPattern::Wildcard(), CONTENT_SETTINGS_TYPE_PLUGINS, - "", + std::string(), CONTENT_SETTING_BLOCK); EXPECT_EQ(CONTENT_SETTING_BLOCK, host_content_settings_map->GetContentSetting( host_ending_with_dot, host_ending_with_dot, CONTENT_SETTINGS_TYPE_PLUGINS, - "")); + std::string())); - EXPECT_EQ(CONTENT_SETTING_BLOCK, - host_content_settings_map->GetContentSetting( - host_ending_with_dot, - host_ending_with_dot, - CONTENT_SETTINGS_TYPE_POPUPS, - "")); + EXPECT_EQ( + CONTENT_SETTING_BLOCK, + host_content_settings_map->GetContentSetting(host_ending_with_dot, + host_ending_with_dot, + CONTENT_SETTINGS_TYPE_POPUPS, + std::string())); host_content_settings_map->SetContentSetting( pattern, ContentSettingsPattern::Wildcard(), CONTENT_SETTINGS_TYPE_POPUPS, - "", + std::string(), CONTENT_SETTING_DEFAULT); - EXPECT_EQ(CONTENT_SETTING_BLOCK, - host_content_settings_map->GetContentSetting( - host_ending_with_dot, - host_ending_with_dot, - CONTENT_SETTINGS_TYPE_POPUPS, - "")); + EXPECT_EQ( + CONTENT_SETTING_BLOCK, + host_content_settings_map->GetContentSetting(host_ending_with_dot, + host_ending_with_dot, + CONTENT_SETTINGS_TYPE_POPUPS, + std::string())); host_content_settings_map->SetContentSetting( pattern, ContentSettingsPattern::Wildcard(), CONTENT_SETTINGS_TYPE_POPUPS, - "", + std::string(), CONTENT_SETTING_ALLOW); - EXPECT_EQ(CONTENT_SETTING_ALLOW, - host_content_settings_map->GetContentSetting( - host_ending_with_dot, - host_ending_with_dot, - CONTENT_SETTINGS_TYPE_POPUPS, - "")); + EXPECT_EQ( + CONTENT_SETTING_ALLOW, + host_content_settings_map->GetContentSetting(host_ending_with_dot, + host_ending_with_dot, + CONTENT_SETTINGS_TYPE_POPUPS, + std::string())); } TEST_F(HostContentSettingsMapTest, NestedSettings) { @@ -564,52 +562,53 @@ TEST_F(HostContentSettingsMapTest, NestedSettings) { pattern1, ContentSettingsPattern::Wildcard(), CONTENT_SETTINGS_TYPE_IMAGES, - "", + std::string(), CONTENT_SETTING_BLOCK); host_content_settings_map->SetContentSetting( pattern2, ContentSettingsPattern::Wildcard(), CONTENT_SETTINGS_TYPE_COOKIES, - "", + std::string(), CONTENT_SETTING_BLOCK); host_content_settings_map->SetContentSetting( pattern3, ContentSettingsPattern::Wildcard(), CONTENT_SETTINGS_TYPE_PLUGINS, - "", + std::string(), CONTENT_SETTING_BLOCK); host_content_settings_map->SetDefaultContentSetting( CONTENT_SETTINGS_TYPE_JAVASCRIPT, CONTENT_SETTING_BLOCK); EXPECT_EQ(CONTENT_SETTING_BLOCK, host_content_settings_map->GetContentSetting( - host, host, CONTENT_SETTINGS_TYPE_COOKIES, "")); + host, host, CONTENT_SETTINGS_TYPE_COOKIES, std::string())); EXPECT_EQ(CONTENT_SETTING_BLOCK, host_content_settings_map->GetContentSetting( - host, host, CONTENT_SETTINGS_TYPE_IMAGES, "")); + host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); EXPECT_EQ(CONTENT_SETTING_BLOCK, host_content_settings_map->GetContentSetting( - host, host, CONTENT_SETTINGS_TYPE_JAVASCRIPT, "")); + host, host, CONTENT_SETTINGS_TYPE_JAVASCRIPT, std::string())); EXPECT_EQ(CONTENT_SETTING_BLOCK, host_content_settings_map->GetContentSetting( - host, host, CONTENT_SETTINGS_TYPE_PLUGINS, "")); + host, host, CONTENT_SETTINGS_TYPE_PLUGINS, std::string())); EXPECT_EQ(CONTENT_SETTING_BLOCK, host_content_settings_map->GetContentSetting( - host, host, CONTENT_SETTINGS_TYPE_POPUPS, "")); + host, host, CONTENT_SETTINGS_TYPE_POPUPS, std::string())); EXPECT_EQ(CONTENT_SETTING_ASK, host_content_settings_map->GetContentSetting( - host, host, CONTENT_SETTINGS_TYPE_GEOLOCATION, "")); + host, host, CONTENT_SETTINGS_TYPE_GEOLOCATION, std::string())); + EXPECT_EQ( + CONTENT_SETTING_ASK, + host_content_settings_map->GetContentSetting( + host, host, CONTENT_SETTINGS_TYPE_NOTIFICATIONS, std::string())); EXPECT_EQ(CONTENT_SETTING_ASK, host_content_settings_map->GetContentSetting( - host, host, CONTENT_SETTINGS_TYPE_NOTIFICATIONS, "")); + host, host, CONTENT_SETTINGS_TYPE_FULLSCREEN, std::string())); EXPECT_EQ(CONTENT_SETTING_ASK, host_content_settings_map->GetContentSetting( - host, host, CONTENT_SETTINGS_TYPE_FULLSCREEN, "")); - EXPECT_EQ(CONTENT_SETTING_ASK, - host_content_settings_map->GetContentSetting( - host, host, CONTENT_SETTINGS_TYPE_MOUSELOCK, "")); + host, host, CONTENT_SETTINGS_TYPE_MOUSELOCK, std::string())); } TEST_F(HostContentSettingsMapTest, OffTheRecord) { @@ -626,10 +625,10 @@ TEST_F(HostContentSettingsMapTest, OffTheRecord) { EXPECT_EQ(CONTENT_SETTING_ALLOW, host_content_settings_map->GetContentSetting( - host, host, CONTENT_SETTINGS_TYPE_IMAGES, "")); + host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); EXPECT_EQ(CONTENT_SETTING_ALLOW, otr_map->GetContentSetting( - host, host, CONTENT_SETTINGS_TYPE_IMAGES, "")); + host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); // Changing content settings on the main map should also affect the // incognito map. @@ -637,27 +636,28 @@ TEST_F(HostContentSettingsMapTest, OffTheRecord) { pattern, ContentSettingsPattern::Wildcard(), CONTENT_SETTINGS_TYPE_IMAGES, - "", + std::string(), CONTENT_SETTING_BLOCK); EXPECT_EQ(CONTENT_SETTING_BLOCK, host_content_settings_map->GetContentSetting( - host, host, CONTENT_SETTINGS_TYPE_IMAGES, "")); + host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); EXPECT_EQ(CONTENT_SETTING_BLOCK, otr_map->GetContentSetting( - host, host, CONTENT_SETTINGS_TYPE_IMAGES, "")); + host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); // Changing content settings on the incognito map should NOT affect the // main map. - otr_map->SetContentSetting( - pattern, - ContentSettingsPattern::Wildcard(), - CONTENT_SETTINGS_TYPE_IMAGES, "", CONTENT_SETTING_ALLOW); + otr_map->SetContentSetting(pattern, + ContentSettingsPattern::Wildcard(), + CONTENT_SETTINGS_TYPE_IMAGES, + std::string(), + CONTENT_SETTING_ALLOW); EXPECT_EQ(CONTENT_SETTING_BLOCK, host_content_settings_map->GetContentSetting( - host, host, CONTENT_SETTINGS_TYPE_IMAGES, "")); + host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); EXPECT_EQ(CONTENT_SETTING_ALLOW, otr_map->GetContentSetting( - host, host, CONTENT_SETTINGS_TYPE_IMAGES, "")); + host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); otr_map->ShutdownOnUIThread(); } @@ -738,7 +738,7 @@ TEST_F(HostContentSettingsMapTest, ResourceIdentifier) { CONTENT_SETTINGS_TYPE_PLUGINS, NULL); EXPECT_EQ(default_plugin_setting, host_content_settings_map->GetContentSetting( - host, host, CONTENT_SETTINGS_TYPE_PLUGINS, "")); + host, host, CONTENT_SETTINGS_TYPE_PLUGINS, std::string())); // If no resource-specific content settings are defined, the setting should be // DEFAULT. @@ -865,7 +865,7 @@ TEST_F(HostContentSettingsMapTest, pattern, ContentSettingsPattern::Wildcard(), CONTENT_SETTINGS_TYPE_JAVASCRIPT, - "", + std::string(), CONTENT_SETTING_BLOCK); EXPECT_EQ(CONTENT_SETTING_ALLOW, @@ -875,14 +875,14 @@ TEST_F(HostContentSettingsMapTest, GURL host("http://example.com/"); EXPECT_EQ(CONTENT_SETTING_BLOCK, host_content_settings_map->GetContentSetting( - host, host, CONTENT_SETTINGS_TYPE_JAVASCRIPT, "")); + host, host, CONTENT_SETTINGS_TYPE_JAVASCRIPT, std::string())); // Set managed-default-content-setting for content-settings-type JavaScript. prefs->SetManagedPref(prefs::kManagedDefaultJavaScriptSetting, Value::CreateIntegerValue(CONTENT_SETTING_ALLOW)); EXPECT_EQ(CONTENT_SETTING_ALLOW, host_content_settings_map->GetContentSetting( - host, host, CONTENT_SETTINGS_TYPE_JAVASCRIPT, "")); + host, host, CONTENT_SETTINGS_TYPE_JAVASCRIPT, std::string())); } // Managed default content setting should have higher priority @@ -906,7 +906,7 @@ TEST_F(HostContentSettingsMapTest, pattern, ContentSettingsPattern::Wildcard(), CONTENT_SETTINGS_TYPE_JAVASCRIPT, - "", + std::string(), CONTENT_SETTING_ALLOW); EXPECT_EQ(CONTENT_SETTING_BLOCK, @@ -915,20 +915,20 @@ TEST_F(HostContentSettingsMapTest, GURL host("http://example.com/"); EXPECT_EQ(CONTENT_SETTING_ALLOW, host_content_settings_map->GetContentSetting( - host, host, CONTENT_SETTINGS_TYPE_JAVASCRIPT, "")); + host, host, CONTENT_SETTINGS_TYPE_JAVASCRIPT, std::string())); // Set managed-default-content-settings-preferences. prefs->SetManagedPref(prefs::kManagedDefaultJavaScriptSetting, Value::CreateIntegerValue(CONTENT_SETTING_BLOCK)); EXPECT_EQ(CONTENT_SETTING_BLOCK, host_content_settings_map->GetContentSetting( - host, host, CONTENT_SETTINGS_TYPE_JAVASCRIPT, "")); + host, host, CONTENT_SETTINGS_TYPE_JAVASCRIPT, std::string())); // Remove managed-default-content-settings-preferences. prefs->RemoveManagedPref(prefs::kManagedDefaultJavaScriptSetting); EXPECT_EQ(CONTENT_SETTING_ALLOW, host_content_settings_map->GetContentSetting( - host, host, CONTENT_SETTINGS_TYPE_JAVASCRIPT, "")); + host, host, CONTENT_SETTINGS_TYPE_JAVASCRIPT, std::string())); } // If a default-content-setting is set to managed setting, the user defined @@ -1004,10 +1004,10 @@ TEST_F(HostContentSettingsMapTest, GetContentSetting) { CONTENT_SETTING_BLOCK); EXPECT_EQ(CONTENT_SETTING_BLOCK, host_content_settings_map->GetContentSetting( - host, host, CONTENT_SETTINGS_TYPE_IMAGES, "")); + host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); EXPECT_EQ(CONTENT_SETTING_ALLOW, host_content_settings_map->GetContentSetting( - embedder, host, CONTENT_SETTINGS_TYPE_IMAGES, "")); + embedder, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); } TEST_F(HostContentSettingsMapTest, ShouldAllowAllContent) { diff --git a/chrome/browser/content_settings/mock_settings_observer.cc b/chrome/browser/content_settings/mock_settings_observer.cc index a281a1d..c8de7fa 100644 --- a/chrome/browser/content_settings/mock_settings_observer.cc +++ b/chrome/browser/content_settings/mock_settings_observer.cc @@ -35,5 +35,5 @@ void MockSettingsObserver::Observe( // This checks that calling a Get function from an observer doesn't // deadlock. GURL url("http://random-hostname.com/"); - map->GetContentSetting(url, url, CONTENT_SETTINGS_TYPE_IMAGES, ""); + map->GetContentSetting(url, url, CONTENT_SETTINGS_TYPE_IMAGES, std::string()); } diff --git a/chrome/browser/devtools/browser_list_tabcontents_provider.cc b/chrome/browser/devtools/browser_list_tabcontents_provider.cc index aca4bac..2edc6bf 100644 --- a/chrome/browser/devtools/browser_list_tabcontents_provider.cc +++ b/chrome/browser/devtools/browser_list_tabcontents_provider.cc @@ -116,19 +116,19 @@ std::string BrowserListTabContentsProvider::GetViewDescription( content::WebContents* web_contents = content::WebContents::FromRenderViewHost(rvh); if (!web_contents) - return ""; + return std::string(); Profile* profile = Profile::FromBrowserContext(web_contents->GetBrowserContext()); if (!profile) - return ""; + return std::string(); extensions::ExtensionHost* extension_host = extensions::ExtensionSystem::Get(profile)->process_manager()-> GetBackgroundHostForExtension(web_contents->GetURL().host()); if (!extension_host || extension_host->host_contents() != web_contents) - return ""; + return std::string(); return extension_host->extension()->name(); } diff --git a/chrome/browser/devtools/devtools_file_helper.cc b/chrome/browser/devtools/devtools_file_helper.cc index d485a52..4aef091 100644 --- a/chrome/browser/devtools/devtools_file_helper.cc +++ b/chrome/browser/devtools/devtools_file_helper.cc @@ -77,7 +77,7 @@ class SelectFileDialog : public ui::SelectFileDialog::Listener, default_path, NULL, 0, - FILE_PATH_LITERAL(""), + FILE_PATH_LITERAL(std::string()), NULL, NULL); } @@ -346,7 +346,7 @@ void DevToolsFileHelper::AddValidatedFileSystem( file_system_id, registered_name, file_system_path); - callback.Run("", filesystem); + callback.Run(std::string(), filesystem); } void DevToolsFileHelper::RequestFileSystems( diff --git a/chrome/browser/devtools/devtools_sanity_browsertest.cc b/chrome/browser/devtools/devtools_sanity_browsertest.cc index 6a8b30c..4f832f7 100644 --- a/chrome/browser/devtools/devtools_sanity_browsertest.cc +++ b/chrome/browser/devtools/devtools_sanity_browsertest.cc @@ -441,7 +441,7 @@ IN_PROC_BROWSER_TEST_F( IN_PROC_BROWSER_TEST_F(DevToolsExtensionTest, TestDevToolsExtensionAPI) { LoadExtension("devtools_extension"); - RunTest("waitForTestResultsInConsole", ""); + RunTest("waitForTestResultsInConsole", std::string()); } // Tests that chrome.devtools extension can communicate with background page @@ -449,7 +449,7 @@ IN_PROC_BROWSER_TEST_F(DevToolsExtensionTest, IN_PROC_BROWSER_TEST_F(DevToolsExtensionTest, TestDevToolsExtensionMessaging) { LoadExtension("devtools_messaging"); - RunTest("waitForTestResultsInConsole", ""); + RunTest("waitForTestResultsInConsole", std::string()); } // Tests that chrome.experimental.devtools extension is correctly exposed @@ -457,7 +457,7 @@ IN_PROC_BROWSER_TEST_F(DevToolsExtensionTest, IN_PROC_BROWSER_TEST_F(DevToolsExperimentalExtensionTest, TestDevToolsExperimentalExtensionAPI) { LoadExtension("devtools_experimental"); - RunTest("waitForTestResultsInConsole", ""); + RunTest("waitForTestResultsInConsole", std::string()); } // Tests that a content script is in the scripts list. @@ -478,7 +478,7 @@ IN_PROC_BROWSER_TEST_F(DevToolsExtensionTest, IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, MAYBE_TestRendererProcessNativeMemorySize) { - RunTest("testRendererProcessNativeMemorySize", ""); + RunTest("testRendererProcessNativeMemorySize", std::string()); } // Tests that scripts are not duplicated after Scripts Panel switch. diff --git a/chrome/browser/download/download_browsertest.cc b/chrome/browser/download/download_browsertest.cc index 7c63cb7..5ec91a2 100644 --- a/chrome/browser/download/download_browsertest.cc +++ b/chrome/browser/download/download_browsertest.cc @@ -1655,7 +1655,12 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, NewWindow) { IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadHistoryCheck) { GURL download_url(URLRequestSlowDownloadJob::kKnownSizeUrl); - base::FilePath file(net::GenerateFileName(download_url, "", "", "", "", "")); + base::FilePath file(net::GenerateFileName(download_url, + std::string(), + std::string(), + std::string(), + std::string(), + std::string())); // We use the server so that we can get a redirect and test url_chain // persistence. @@ -2627,7 +2632,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, LoadURLExternallyReferrerPolicy) { // Check that the file contains the expected referrer. base::FilePath file(download_items[0]->GetFullPath()); - std::string expected_contents = test_server()->GetURL("").spec(); + std::string expected_contents = test_server()->GetURL(std::string()).spec(); ASSERT_TRUE(VerifyFile(file, expected_contents, expected_contents.length())); } diff --git a/chrome/browser/download/download_file_picker.cc b/chrome/browser/download/download_file_picker.cc index 29a1573..b18a0f0 100644 --- a/chrome/browser/download/download_file_picker.cc +++ b/chrome/browser/download/download_file_picker.cc @@ -86,15 +86,14 @@ void DownloadFilePicker::Init( platform_util::GetTopLevel(web_contents->GetView()->GetNativeView()) : NULL; - select_file_dialog_->SelectFile( - ui::SelectFileDialog::SELECT_SAVEAS_FILE, - string16(), - suggested_path_, - &file_type_info, - 0, - FILE_PATH_LITERAL(""), - owning_window, - NULL); + select_file_dialog_->SelectFile(ui::SelectFileDialog::SELECT_SAVEAS_FILE, + string16(), + suggested_path_, + &file_type_info, + 0, + FILE_PATH_LITERAL(std::string()), + owning_window, + NULL); } DownloadFilePicker::~DownloadFilePicker() { diff --git a/chrome/browser/download/download_prefs.cc b/chrome/browser/download/download_prefs.cc index 2bfb792..4aba528 100644 --- a/chrome/browser/download/download_prefs.cc +++ b/chrome/browser/download/download_prefs.cc @@ -86,7 +86,7 @@ void DownloadPrefs::RegisterUserPrefs(PrefRegistrySyncable* registry) { false, PrefRegistrySyncable::SYNCABLE_PREF); registry->RegisterStringPref(prefs::kDownloadExtensionsToOpen, - "", + std::string(), PrefRegistrySyncable::UNSYNCABLE_PREF); registry->RegisterBooleanPref(prefs::kDownloadDirUpgraded, false, diff --git a/chrome/browser/extensions/activity_log.cc b/chrome/browser/extensions/activity_log.cc index 34f820b..dcf8e8f 100644 --- a/chrome/browser/extensions/activity_log.cc +++ b/chrome/browser/extensions/activity_log.cc @@ -27,7 +27,7 @@ namespace { // Concatenate arguments. std::string MakeArgList(const ListValue* args) { - std::string call_signature = ""; + std::string call_signature; ListValue::const_iterator it = args->begin(); for (; it != args->end(); ++it) { std::string arg; @@ -395,9 +395,10 @@ void ActivityLog::OnScriptsExecuted( // of content scripts will be empty. We don't want to log it because // the call to tabs.executeScript will have already been logged anyway. if (!it->second.empty()) { - std::string ext_scripts_str = ""; + std::string ext_scripts_str; for (std::set<std::string>::const_iterator it2 = it->second.begin(); - it2 != it->second.end(); ++it2) { + it2 != it->second.end(); + ++it2) { ext_scripts_str += *it2; ext_scripts_str += " "; } @@ -406,9 +407,9 @@ void ActivityLog::OnScriptsExecuted( LogDOMActionInternal(extension, on_url, web_contents->GetTitle(), - "", // no api call here + std::string(), // no api call here script_names.get(), - "", // no extras either + std::string(), // no extras either DOMAction::INSERTED); } } diff --git a/chrome/browser/extensions/activity_log_unittest.cc b/chrome/browser/extensions/activity_log_unittest.cc index f678d7b..a5ecc95 100644 --- a/chrome/browser/extensions/activity_log_unittest.cc +++ b/chrome/browser/extensions/activity_log_unittest.cc @@ -93,10 +93,8 @@ TEST_F(ActivityLogTest, Construct) { extension_service_->AddExtension(extension); scoped_ptr<ListValue> args(new ListValue()); ASSERT_TRUE(ActivityLog::IsLogEnabled()); - activity_log->LogAPIAction(extension, - std::string("tabs.testMethod"), - args.get(), - ""); + activity_log->LogAPIAction( + extension, std::string("tabs.testMethod"), args.get(), std::string()); } TEST_F(ActivityLogTest, LogAndFetchActions) { @@ -113,10 +111,8 @@ TEST_F(ActivityLogTest, LogAndFetchActions) { ASSERT_TRUE(ActivityLog::IsLogEnabled()); // Write some API calls - activity_log->LogAPIAction(extension, - std::string("tabs.testMethod"), - args.get(), - ""); + activity_log->LogAPIAction( + extension, std::string("tabs.testMethod"), args.get(), std::string()); activity_log->LogDOMAction(extension, GURL("http://www.google.com"), string16(), @@ -144,14 +140,10 @@ TEST_F(ActivityLogTest, LogWithoutArguments) { scoped_ptr<ListValue> args(new ListValue()); args->Set(0, new base::StringValue("hello")); args->Set(1, new base::StringValue("world")); - activity_log->LogAPIAction(extension, - std::string("tabs.testMethod"), - args.get(), - ""); + activity_log->LogAPIAction( + extension, std::string("tabs.testMethod"), args.get(), std::string()); activity_log->GetActions( - extension->id(), - 0, - base::Bind(ActivityLogTest::Arguments_Missing)); + extension->id(), 0, base::Bind(ActivityLogTest::Arguments_Missing)); } TEST_F(ActivityLogTest, LogWithArguments) { @@ -169,14 +161,10 @@ TEST_F(ActivityLogTest, LogWithArguments) { scoped_ptr<ListValue> args(new ListValue()); args->Set(0, new base::StringValue("hello")); args->Set(1, new base::StringValue("world")); - activity_log->LogAPIAction(extension, - std::string("extension.connect"), - args.get(), - ""); + activity_log->LogAPIAction( + extension, std::string("extension.connect"), args.get(), std::string()); activity_log->GetActions( - extension->id(), - 0, - base::Bind(ActivityLogTest::Arguments_Present)); + extension->id(), 0, base::Bind(ActivityLogTest::Arguments_Present)); } } // namespace extensions diff --git a/chrome/browser/extensions/api/alarms/alarms_api_unittest.cc b/chrome/browser/extensions/api/alarms/alarms_api_unittest.cc index 60c367a..34b4187 100644 --- a/chrome/browser/extensions/api/alarms/alarms_api_unittest.cc +++ b/chrome/browser/extensions/api/alarms/alarms_api_unittest.cc @@ -151,7 +151,7 @@ TEST_F(ExtensionAlarmsTest, Create) { CreateAlarm("[null, {\"delayInMinutes\": 0}]"); const Alarm* alarm = - alarm_manager_->GetAlarm(extension_->id(), ""); + alarm_manager_->GetAlarm(extension_->id(), std::string()); ASSERT_TRUE(alarm); EXPECT_EQ("", alarm->js_alarm->name); EXPECT_DOUBLE_EQ(10000, alarm->js_alarm->scheduled_time); @@ -179,7 +179,7 @@ TEST_F(ExtensionAlarmsTest, CreateRepeating) { CreateAlarm("[null, {\"periodInMinutes\": 0.001}]"); const Alarm* alarm = - alarm_manager_->GetAlarm(extension_->id(), ""); + alarm_manager_->GetAlarm(extension_->id(), std::string()); ASSERT_TRUE(alarm); EXPECT_EQ("", alarm->js_alarm->name); EXPECT_DOUBLE_EQ(10060, alarm->js_alarm->scheduled_time); @@ -205,7 +205,7 @@ TEST_F(ExtensionAlarmsTest, CreateAbsolute) { CreateAlarm("[null, {\"when\": 10001}]"); const Alarm* alarm = - alarm_manager_->GetAlarm(extension_->id(), ""); + alarm_manager_->GetAlarm(extension_->id(), std::string()); ASSERT_TRUE(alarm); EXPECT_EQ("", alarm->js_alarm->name); EXPECT_DOUBLE_EQ(10001, alarm->js_alarm->scheduled_time); @@ -217,7 +217,7 @@ TEST_F(ExtensionAlarmsTest, CreateAbsolute) { // MessageLoop when that happens. MessageLoop::current()->Run(); - ASSERT_FALSE(alarm_manager_->GetAlarm(extension_->id(), "")); + ASSERT_FALSE(alarm_manager_->GetAlarm(extension_->id(), std::string())); ASSERT_EQ(1u, alarm_delegate_->alarms_seen.size()); EXPECT_EQ("", alarm_delegate_->alarms_seen[0]); @@ -228,7 +228,7 @@ TEST_F(ExtensionAlarmsTest, CreateRepeatingWithQuickFirstCall) { CreateAlarm("[null, {\"when\": 10001, \"periodInMinutes\": 0.001}]"); const Alarm* alarm = - alarm_manager_->GetAlarm(extension_->id(), ""); + alarm_manager_->GetAlarm(extension_->id(), std::string()); ASSERT_TRUE(alarm); EXPECT_EQ("", alarm->js_alarm->name); EXPECT_DOUBLE_EQ(10001, alarm->js_alarm->scheduled_time); @@ -240,13 +240,13 @@ TEST_F(ExtensionAlarmsTest, CreateRepeatingWithQuickFirstCall) { // MessageLoop when that happens. MessageLoop::current()->Run(); - ASSERT_TRUE(alarm_manager_->GetAlarm(extension_->id(), "")); + ASSERT_TRUE(alarm_manager_->GetAlarm(extension_->id(), std::string())); EXPECT_THAT(alarm_delegate_->alarms_seen, testing::ElementsAre("")); test_clock_.SetNow(base::Time::FromDoubleT(10.7)); MessageLoop::current()->Run(); - ASSERT_TRUE(alarm_manager_->GetAlarm(extension_->id(), "")); + ASSERT_TRUE(alarm_manager_->GetAlarm(extension_->id(), std::string())); EXPECT_THAT(alarm_delegate_->alarms_seen, testing::ElementsAre("", "")); } diff --git a/chrome/browser/extensions/api/bookmarks/bookmarks_api.cc b/chrome/browser/extensions/api/bookmarks/bookmarks_api.cc index 0470b78..af98260 100644 --- a/chrome/browser/extensions/api/bookmarks/bookmarks_api.cc +++ b/chrome/browser/extensions/api/bookmarks/bookmarks_api.cc @@ -946,7 +946,7 @@ void BookmarksIOFunction::ShowSelectFileDialog( default_path, &file_type_info, 0, - FILE_PATH_LITERAL(""), + FILE_PATH_LITERAL(std::string()), NULL, NULL); } diff --git a/chrome/browser/extensions/api/content_settings/content_settings_apitest.cc b/chrome/browser/extensions/api/content_settings/content_settings_apitest.cc index a424f83..dd20fba1 100644 --- a/chrome/browser/extensions/api/content_settings/content_settings_apitest.cc +++ b/chrome/browser/extensions/api/content_settings/content_settings_apitest.cc @@ -74,16 +74,16 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentSettings) { EXPECT_FALSE(cookie_settings->IsReadingCookieAllowed(url, url)); EXPECT_EQ(CONTENT_SETTING_ALLOW, map->GetContentSetting( - url, url, CONTENT_SETTINGS_TYPE_IMAGES, "")); + url, url, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); EXPECT_EQ(CONTENT_SETTING_BLOCK, map->GetContentSetting( - url, url, CONTENT_SETTINGS_TYPE_JAVASCRIPT, "")); + url, url, CONTENT_SETTINGS_TYPE_JAVASCRIPT, std::string())); EXPECT_EQ(CONTENT_SETTING_BLOCK, map->GetContentSetting( - url, url, CONTENT_SETTINGS_TYPE_PLUGINS, "")); + url, url, CONTENT_SETTINGS_TYPE_PLUGINS, std::string())); EXPECT_EQ(CONTENT_SETTING_ALLOW, map->GetContentSetting( - url, url, CONTENT_SETTINGS_TYPE_POPUPS, "")); + url, url, CONTENT_SETTINGS_TYPE_POPUPS, std::string())); #if 0 EXPECT_EQ(CONTENT_SETTING_BLOCK, map->GetContentSetting( @@ -91,7 +91,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentSettings) { #endif EXPECT_EQ(CONTENT_SETTING_BLOCK, map->GetContentSetting( - url, url, CONTENT_SETTINGS_TYPE_NOTIFICATIONS, "")); + url, url, CONTENT_SETTINGS_TYPE_NOTIFICATIONS, std::string())); } // Flaky on the trybots. See http://crbug.com/96725. diff --git a/chrome/browser/extensions/api/content_settings/content_settings_helpers.cc b/chrome/browser/extensions/api/content_settings/content_settings_helpers.cc index 8ee0fbf..537d08f 100644 --- a/chrome/browser/extensions/api/content_settings/content_settings_helpers.cc +++ b/chrome/browser/extensions/api/content_settings/content_settings_helpers.cc @@ -48,7 +48,7 @@ std::string GetDefaultPort(const std::string& scheme) { if (scheme == chrome::kHttpsScheme) return "443"; NOTREACHED(); - return ""; + return std::string(); } } // namespace diff --git a/chrome/browser/extensions/api/content_settings/content_settings_store_unittest.cc b/chrome/browser/extensions/api/content_settings/content_settings_store_unittest.cc index 5e13633..bedd2ea 100644 --- a/chrome/browser/extensions/api/content_settings/content_settings_store_unittest.cc +++ b/chrome/browser/extensions/api/content_settings/content_settings_store_unittest.cc @@ -101,73 +101,76 @@ TEST_F(ContentSettingsStoreTest, RegisterUnregister) { GURL url("http://www.youtube.com"); EXPECT_EQ(CONTENT_SETTING_DEFAULT, - GetContentSettingFromStore( - store(), url, url, CONTENT_SETTINGS_TYPE_COOKIES, "", false)); + GetContentSettingFromStore(store(), + url, + url, + CONTENT_SETTINGS_TYPE_COOKIES, + std::string(), + false)); // Register first extension std::string ext_id("my_extension"); RegisterExtension(ext_id); EXPECT_EQ(CONTENT_SETTING_DEFAULT, - GetContentSettingFromStore( - store(), url, url, CONTENT_SETTINGS_TYPE_COOKIES, "", false)); + GetContentSettingFromStore(store(), + url, + url, + CONTENT_SETTINGS_TYPE_COOKIES, + std::string(), + false)); // Set setting ContentSettingsPattern pattern = ContentSettingsPattern::FromURL(GURL("http://www.youtube.com")); EXPECT_CALL(observer, OnContentSettingChanged(ext_id, false)); - store()->SetExtensionContentSetting( - ext_id, - pattern, - pattern, - CONTENT_SETTINGS_TYPE_COOKIES, - "", - CONTENT_SETTING_ALLOW, - kExtensionPrefsScopeRegular); + store()->SetExtensionContentSetting(ext_id, + pattern, + pattern, + CONTENT_SETTINGS_TYPE_COOKIES, + std::string(), + CONTENT_SETTING_ALLOW, + kExtensionPrefsScopeRegular); Mock::VerifyAndClear(&observer); EXPECT_EQ(CONTENT_SETTING_ALLOW, - GetContentSettingFromStore( - store(), - url, - url, - CONTENT_SETTINGS_TYPE_COOKIES, - "", - false)); + GetContentSettingFromStore(store(), + url, + url, + CONTENT_SETTINGS_TYPE_COOKIES, + std::string(), + false)); // Register second extension. std::string ext_id_2("my_second_extension"); RegisterExtension(ext_id_2); EXPECT_CALL(observer, OnContentSettingChanged(ext_id_2, false)); - store()->SetExtensionContentSetting( - ext_id_2, - pattern, - pattern, - CONTENT_SETTINGS_TYPE_COOKIES, - "", - CONTENT_SETTING_BLOCK, - kExtensionPrefsScopeRegular); + store()->SetExtensionContentSetting(ext_id_2, + pattern, + pattern, + CONTENT_SETTINGS_TYPE_COOKIES, + std::string(), + CONTENT_SETTING_BLOCK, + kExtensionPrefsScopeRegular); EXPECT_EQ(CONTENT_SETTING_BLOCK, - GetContentSettingFromStore( - store(), - url, - url, - CONTENT_SETTINGS_TYPE_COOKIES, - "", - false)); + GetContentSettingFromStore(store(), + url, + url, + CONTENT_SETTINGS_TYPE_COOKIES, + std::string(), + false)); // Unregister first extension. This shouldn't change the setting. EXPECT_CALL(observer, OnContentSettingChanged(ext_id, false)); store()->UnregisterExtension(ext_id); EXPECT_EQ(CONTENT_SETTING_BLOCK, - GetContentSettingFromStore( - store(), - url, - url, - CONTENT_SETTINGS_TYPE_COOKIES, - "", - false)); + GetContentSettingFromStore(store(), + url, + url, + CONTENT_SETTINGS_TYPE_COOKIES, + std::string(), + false)); Mock::VerifyAndClear(&observer); // Unregister second extension. This should reset the setting to its default @@ -175,13 +178,12 @@ TEST_F(ContentSettingsStoreTest, RegisterUnregister) { EXPECT_CALL(observer, OnContentSettingChanged(ext_id_2, false)); store()->UnregisterExtension(ext_id_2); EXPECT_EQ(CONTENT_SETTING_DEFAULT, - GetContentSettingFromStore( - store(), - url, - url, - CONTENT_SETTINGS_TYPE_COOKIES, - "", - false)); + GetContentSettingFromStore(store(), + url, + url, + CONTENT_SETTINGS_TYPE_COOKIES, + std::string(), + false)); store()->RemoveObserver(&observer); } @@ -190,7 +192,7 @@ TEST_F(ContentSettingsStoreTest, GetAllSettings) { bool incognito = false; std::vector<content_settings::Rule> rules; GetSettingsForOneTypeFromStore( - store(), CONTENT_SETTINGS_TYPE_COOKIES, "", incognito, &rules); + store(), CONTENT_SETTINGS_TYPE_COOKIES, std::string(), incognito, &rules); ASSERT_EQ(0u, rules.size()); // Register first extension. @@ -198,17 +200,16 @@ TEST_F(ContentSettingsStoreTest, GetAllSettings) { RegisterExtension(ext_id); ContentSettingsPattern pattern = ContentSettingsPattern::FromURL(GURL("http://www.youtube.com")); - store()->SetExtensionContentSetting( - ext_id, - pattern, - pattern, - CONTENT_SETTINGS_TYPE_COOKIES, - "", - CONTENT_SETTING_ALLOW, - kExtensionPrefsScopeRegular); + store()->SetExtensionContentSetting(ext_id, + pattern, + pattern, + CONTENT_SETTINGS_TYPE_COOKIES, + std::string(), + CONTENT_SETTING_ALLOW, + kExtensionPrefsScopeRegular); GetSettingsForOneTypeFromStore( - store(), CONTENT_SETTINGS_TYPE_COOKIES, "", incognito, &rules); + store(), CONTENT_SETTINGS_TYPE_COOKIES, std::string(), incognito, &rules); ASSERT_EQ(1u, rules.size()); CheckRule(rules[0], pattern, pattern, CONTENT_SETTING_ALLOW); @@ -217,20 +218,16 @@ TEST_F(ContentSettingsStoreTest, GetAllSettings) { RegisterExtension(ext_id_2); ContentSettingsPattern pattern_2 = ContentSettingsPattern::FromURL(GURL("http://www.example.com")); - store()->SetExtensionContentSetting( - ext_id_2, - pattern_2, - pattern_2, - CONTENT_SETTINGS_TYPE_COOKIES, - "", - CONTENT_SETTING_BLOCK, - kExtensionPrefsScopeRegular); - - GetSettingsForOneTypeFromStore(store(), - CONTENT_SETTINGS_TYPE_COOKIES, - "", - incognito, - &rules); + store()->SetExtensionContentSetting(ext_id_2, + pattern_2, + pattern_2, + CONTENT_SETTINGS_TYPE_COOKIES, + std::string(), + CONTENT_SETTING_BLOCK, + kExtensionPrefsScopeRegular); + + GetSettingsForOneTypeFromStore( + store(), CONTENT_SETTINGS_TYPE_COOKIES, std::string(), incognito, &rules); ASSERT_EQ(2u, rules.size()); // Rules appear in the reverse installation order of the extensions. CheckRule(rules[0], pattern_2, pattern_2, CONTENT_SETTING_BLOCK); @@ -240,7 +237,7 @@ TEST_F(ContentSettingsStoreTest, GetAllSettings) { store()->SetExtensionState(ext_id, false); GetSettingsForOneTypeFromStore( - store(), CONTENT_SETTINGS_TYPE_COOKIES, "", incognito, &rules); + store(), CONTENT_SETTINGS_TYPE_COOKIES, std::string(), incognito, &rules); ASSERT_EQ(1u, rules.size()); CheckRule(rules[0], pattern_2, pattern_2, CONTENT_SETTING_BLOCK); @@ -248,7 +245,7 @@ TEST_F(ContentSettingsStoreTest, GetAllSettings) { store()->UnregisterExtension(ext_id_2); GetSettingsForOneTypeFromStore( - store(), CONTENT_SETTINGS_TYPE_COOKIES, "", incognito, &rules); + store(), CONTENT_SETTINGS_TYPE_COOKIES, std::string(), incognito, &rules); ASSERT_EQ(0u, rules.size()); } diff --git a/chrome/browser/extensions/api/cookies/cookies_api.cc b/chrome/browser/extensions/api/cookies/cookies_api.cc index f3a4a35..c35b830 100644 --- a/chrome/browser/extensions/api/cookies/cookies_api.cc +++ b/chrome/browser/extensions/api/cookies/cookies_api.cc @@ -203,8 +203,9 @@ bool CookiesGetFunction::RunImpl() { if (!ParseUrl(parsed_args_->details.url, &url_, true)) return false; - std::string store_id = parsed_args_->details.store_id.get() ? - *parsed_args_->details.store_id : ""; + std::string store_id = + parsed_args_->details.store_id.get() ? *parsed_args_->details.store_id + : std::string(); net::URLRequestContextGetter* store_context = NULL; if (!ParseStoreContext(&store_id, &store_context)) return false; @@ -276,8 +277,9 @@ bool CookiesGetAllFunction::RunImpl() { return false; } - std::string store_id = parsed_args_->details.store_id.get() ? - *parsed_args_->details.store_id : ""; + std::string store_id = + parsed_args_->details.store_id.get() ? *parsed_args_->details.store_id + : std::string(); net::URLRequestContextGetter* store_context = NULL; if (!ParseStoreContext(&store_id, &store_context)) return false; @@ -339,8 +341,9 @@ bool CookiesSetFunction::RunImpl() { if (!ParseUrl(parsed_args_->details.url, &url_, true)) return false; - std::string store_id = parsed_args_->details.store_id.get() ? - *parsed_args_->details.store_id : ""; + std::string store_id = + parsed_args_->details.store_id.get() ? *parsed_args_->details.store_id + : std::string(); net::URLRequestContextGetter* store_context = NULL; if (!ParseStoreContext(&store_id, &store_context)) return false; @@ -374,17 +377,19 @@ void CookiesSetFunction::SetCookieOnIOThread() { cookie_monster->SetCookieWithDetailsAsync( url_, - parsed_args_->details.name.get() ? *parsed_args_->details.name : "", - parsed_args_->details.value.get() ? *parsed_args_->details.value : "", - parsed_args_->details.domain.get() ? *parsed_args_->details.domain : "", - parsed_args_->details.path.get() ? *parsed_args_->details.path : "", + parsed_args_->details.name.get() ? *parsed_args_->details.name + : std::string(), + parsed_args_->details.value.get() ? *parsed_args_->details.value + : std::string(), + parsed_args_->details.domain.get() ? *parsed_args_->details.domain + : std::string(), + parsed_args_->details.path.get() ? *parsed_args_->details.path + : std::string(), expiration_time, - parsed_args_->details.secure.get() ? - *parsed_args_->details.secure.get() : - false, - parsed_args_->details.http_only.get() ? - *parsed_args_->details.http_only : - false, + parsed_args_->details.secure.get() ? *parsed_args_->details.secure.get() + : false, + parsed_args_->details.http_only.get() ? *parsed_args_->details.http_only + : false, base::Bind(&CookiesSetFunction::PullCookie, this)); } @@ -406,8 +411,9 @@ void CookiesSetFunction::PullCookieCallback( // Return the first matching cookie. Relies on the fact that the // CookieMonster returns them in canonical order (longest path, then // earliest creation time). - std::string name = parsed_args_->details.name.get() ? - *parsed_args_->details.name : ""; + std::string name = + parsed_args_->details.name.get() ? *parsed_args_->details.name + : std::string(); if (it->Name() == name) { scoped_ptr<Cookie> cookie( cookies_helpers::CreateCookie(*it, *parsed_args_->details.store_id)); @@ -425,10 +431,10 @@ void CookiesSetFunction::PullCookieCallback( void CookiesSetFunction::RespondOnUIThread() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); if (!success_) { - std::string name = parsed_args_->details.name.get() ? - *parsed_args_->details.name : ""; - error_ = ErrorUtils::FormatErrorMessage( - keys::kCookieSetFailedError, name); + std::string name = + parsed_args_->details.name.get() ? *parsed_args_->details.name + : std::string(); + error_ = ErrorUtils::FormatErrorMessage(keys::kCookieSetFailedError, name); } SendResponse(success_); } @@ -447,8 +453,9 @@ bool CookiesRemoveFunction::RunImpl() { if (!ParseUrl(parsed_args_->details.url, &url_, true)) return false; - std::string store_id = parsed_args_->details.store_id.get() ? - *parsed_args_->details.store_id : ""; + std::string store_id = + parsed_args_->details.store_id.get() ? *parsed_args_->details.store_id + : std::string(); net::URLRequestContextGetter* store_context = NULL; if (!ParseStoreContext(&store_id, &store_context)) return false; diff --git a/chrome/browser/extensions/api/cookies/cookies_helpers.cc b/chrome/browser/extensions/api/cookies/cookies_helpers.cc index d9866f2..c61e729 100644 --- a/chrome/browser/extensions/api/cookies/cookies_helpers.cc +++ b/chrome/browser/extensions/api/cookies/cookies_helpers.cc @@ -74,8 +74,8 @@ scoped_ptr<Cookie> CreateCookie( cookie->host_only = net::cookie_util::DomainIsHostOnly( canonical_cookie.Domain()); // A non-UTF8 path is invalid, so we just replace it with an empty string. - cookie->path = IsStringUTF8(canonical_cookie.Path()) ? - canonical_cookie.Path() : ""; + cookie->path = IsStringUTF8(canonical_cookie.Path()) ? canonical_cookie.Path() + : std::string(); cookie->secure = canonical_cookie.IsSecure(); cookie->http_only = canonical_cookie.IsHttpOnly(); cookie->session = !canonical_cookie.IsPersistent(); diff --git a/chrome/browser/extensions/api/cookies/cookies_unittest.cc b/chrome/browser/extensions/api/cookies/cookies_unittest.cc index f1bd93d..0844b83 100644 --- a/chrome/browser/extensions/api/cookies/cookies_unittest.cc +++ b/chrome/browser/extensions/api/cookies/cookies_unittest.cc @@ -195,22 +195,36 @@ TEST_F(ExtensionCookiesTest, DomainMatching) { scoped_ptr<GetAll::Params> params(GetAll::Params::Create(args)); cookies_helpers::MatchFilter filter(¶ms->details); - net::CanonicalCookie cookie(GURL(), "", "", tests[i].domain,"", - base::Time(), base::Time(), base::Time(), - false, false); + net::CanonicalCookie cookie(GURL(), + std::string(), + std::string(), + tests[i].domain, + std::string(), + base::Time(), + base::Time(), + base::Time(), + false, + false); EXPECT_EQ(tests[i].matches, filter.MatchesCookie(cookie)); } } TEST_F(ExtensionCookiesTest, DecodeUTF8WithErrorHandling) { - net::CanonicalCookie canonical_cookie( - GURL(), "", "011Q255bNX_1!yd\203e+", "test.com", "/path\203", - base::Time(), base::Time(), base::Time(), false, false); + net::CanonicalCookie canonical_cookie(GURL(), + std::string(), + "011Q255bNX_1!yd\203e+", + "test.com", + "/path\203", + base::Time(), + base::Time(), + base::Time(), + false, + false); scoped_ptr<Cookie> cookie( cookies_helpers::CreateCookie( canonical_cookie, "some cookie store")); EXPECT_EQ(std::string("011Q255bNX_1!yd\xEF\xBF\xBD" "e+"), cookie->value); - EXPECT_EQ(std::string(""), cookie->path); + EXPECT_EQ(std::string(), cookie->path); } } // namespace extensions diff --git a/chrome/browser/extensions/api/declarative/initializing_rules_registry.cc b/chrome/browser/extensions/api/declarative/initializing_rules_registry.cc index 0074233..d209bed 100644 --- a/chrome/browser/extensions/api/declarative/initializing_rules_registry.cc +++ b/chrome/browser/extensions/api/declarative/initializing_rules_registry.cc @@ -39,7 +39,7 @@ std::string InitializingRulesRegistry::RemoveRules( if (!error.empty()) return error; RemoveUsedRuleIdentifiers(extension_id, rule_identifiers); - return ""; + return std::string(); } std::string InitializingRulesRegistry::RemoveAllRules( @@ -48,7 +48,7 @@ std::string InitializingRulesRegistry::RemoveAllRules( if (!error.empty()) return error; RemoveAllUsedRuleIdentifiers(extension_id); - return ""; + return std::string(); } std::string InitializingRulesRegistry::GetRules( @@ -122,7 +122,7 @@ std::string InitializingRulesRegistry::CheckAndFillInOptionalRules( used_rule_identifiers_[extension_id].insert(*(rule->id)); } } - return ""; + return std::string(); } void InitializingRulesRegistry::FillInOptionalPriorities( diff --git a/chrome/browser/extensions/api/declarative/rules_registry_with_cache_unittest.cc b/chrome/browser/extensions/api/declarative/rules_registry_with_cache_unittest.cc index 4f49f36..1be1983 100644 --- a/chrome/browser/extensions/api/declarative/rules_registry_with_cache_unittest.cc +++ b/chrome/browser/extensions/api/declarative/rules_registry_with_cache_unittest.cc @@ -69,7 +69,7 @@ TEST_F(RulesRegistryWithCacheTest, AddRules) { registry_->SetResult("Error"); EXPECT_EQ("Error", AddRule(extension_id, rule_id)); EXPECT_EQ(0, GetNumberOfRules(extension_id)); - registry_->SetResult(""); + registry_->SetResult(std::string()); // Check that rules can be inserted. EXPECT_EQ("", AddRule(extension_id, rule_id)); @@ -97,7 +97,7 @@ TEST_F(RulesRegistryWithCacheTest, RemoveRules) { registry_->SetResult("Error"); EXPECT_EQ("Error", RemoveRule(extension_id, rule_id)); EXPECT_EQ(1, GetNumberOfRules(extension_id)); - registry_->SetResult(""); + registry_->SetResult(std::string()); // Check that nothing happens if a rule does not exist. EXPECT_EQ("", RemoveRule(extension_id, "unknown_rule")); @@ -122,7 +122,7 @@ TEST_F(RulesRegistryWithCacheTest, RemoveAllRules) { registry_->SetResult("Error"); EXPECT_EQ("Error", registry_->RemoveAllRules(extension_id)); EXPECT_EQ(2, GetNumberOfRules(extension_id)); - registry_->SetResult(""); + registry_->SetResult(std::string()); // Check that rules may be removed and only for the correct extension. EXPECT_EQ("", registry_->RemoveAllRules(extension_id)); diff --git a/chrome/browser/extensions/api/declarative_content/content_condition.cc b/chrome/browser/extensions/api/declarative_content/content_condition.cc index 4a88e17..6c00b80 100644 --- a/chrome/browser/extensions/api/declarative_content/content_condition.cc +++ b/chrome/browser/extensions/api/declarative_content/content_condition.cc @@ -129,7 +129,8 @@ scoped_ptr<ContentCondition> ContentCondition::Create( if (!url_matcher_condition_set) { URLMatcherConditionSet::Conditions url_matcher_conditions; url_matcher_conditions.insert( - url_matcher_condition_factory->CreateHostPrefixCondition("")); + url_matcher_condition_factory->CreateHostPrefixCondition( + std::string())); url_matcher_condition_set = new URLMatcherConditionSet(++g_next_id, url_matcher_conditions); } diff --git a/chrome/browser/extensions/api/declarative_content/content_rules_registry.cc b/chrome/browser/extensions/api/declarative_content/content_rules_registry.cc index c9ed31e..eb95b47 100644 --- a/chrome/browser/extensions/api/declarative_content/content_rules_registry.cc +++ b/chrome/browser/extensions/api/declarative_content/content_rules_registry.cc @@ -176,7 +176,7 @@ std::string ContentRulesRegistry::AddRulesImpl( UpdateConditionCache(); - return ""; + return std::string(); } std::string ContentRulesRegistry::RemoveRulesImpl( @@ -221,7 +221,7 @@ std::string ContentRulesRegistry::RemoveRulesImpl( UpdateConditionCache(); - return ""; + return std::string(); } std::string ContentRulesRegistry::RemoveAllRulesImpl( diff --git a/chrome/browser/extensions/api/declarative_content/declarative_content_apitest.cc b/chrome/browser/extensions/api/declarative_content/declarative_content_apitest.cc index 813b6b9..dc3bead 100644 --- a/chrome/browser/extensions/api/declarative_content/declarative_content_apitest.cc +++ b/chrome/browser/extensions/api/declarative_content/declarative_content_apitest.cc @@ -56,7 +56,7 @@ IN_PROC_BROWSER_TEST_F(DeclarativeContentApiTest, Overview) { tab, "document.body.innerHTML = '<input type=\"password\">';")); // Give the mutation observer a chance to run and send back the // matching-selector update. - ASSERT_TRUE(content::ExecuteScript(tab, "")); + ASSERT_TRUE(content::ExecuteScript(tab, std::string())); EXPECT_TRUE(page_action->GetIsVisible(tab_id)); // Remove it again to make sure that reverts the action. @@ -64,7 +64,7 @@ IN_PROC_BROWSER_TEST_F(DeclarativeContentApiTest, Overview) { tab, "document.body.innerHTML = 'Hello world';")); // Give the mutation observer a chance to run and send back the // matching-selector update. - ASSERT_TRUE(content::ExecuteScript(tab, "")); + ASSERT_TRUE(content::ExecuteScript(tab, std::string())); EXPECT_FALSE(page_action->GetIsVisible(tab_id)); } diff --git a/chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_registry.cc b/chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_registry.cc index c8cae51..695edac 100644 --- a/chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_registry.cc +++ b/chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_registry.cc @@ -184,7 +184,7 @@ std::string WebRequestRulesRegistry::AddRulesImpl( ClearCacheOnNavigation(); - return ""; + return std::string(); } std::string WebRequestRulesRegistry::RemoveRulesImpl( @@ -223,7 +223,7 @@ std::string WebRequestRulesRegistry::RemoveRulesImpl( ClearCacheOnNavigation(); - return ""; + return std::string(); } std::string WebRequestRulesRegistry::RemoveAllRulesImpl( diff --git a/chrome/browser/extensions/api/developer_private/entry_picker.cc b/chrome/browser/extensions/api/developer_private/entry_picker.cc index c2b3d78..d305f4f 100644 --- a/chrome/browser/extensions/api/developer_private/entry_picker.cc +++ b/chrome/browser/extensions/api/developer_private/entry_picker.cc @@ -64,8 +64,9 @@ EntryPicker::EntryPicker(EntryPickerClient* client, last_directory, &info, file_type_index, - FILE_PATH_LITERAL(""), - owning_window, NULL); + FILE_PATH_LITERAL(std::string()), + owning_window, + NULL); } EntryPicker::~EntryPicker() {} diff --git a/chrome/browser/extensions/api/dial/dial_device_data_unittest.cc b/chrome/browser/extensions/api/dial/dial_device_data_unittest.cc index 447efca..4ccc470 100644 --- a/chrome/browser/extensions/api/dial/dial_device_data_unittest.cc +++ b/chrome/browser/extensions/api/dial/dial_device_data_unittest.cc @@ -96,9 +96,9 @@ TEST(DialDeviceDataTest, TestIsDeviceDescriptionUrl) { GURL("https://192.168.1.1:1234/dd.xml"))); EXPECT_FALSE(DialDeviceData::IsDeviceDescriptionUrl(GURL())); - EXPECT_FALSE(DialDeviceData::IsDeviceDescriptionUrl(GURL(""))); - EXPECT_FALSE(DialDeviceData::IsDeviceDescriptionUrl( - GURL("file://path/to/file"))); + EXPECT_FALSE(DialDeviceData::IsDeviceDescriptionUrl(GURL(std::string()))); + EXPECT_FALSE( + DialDeviceData::IsDeviceDescriptionUrl(GURL("file://path/to/file"))); } } // namespace extensions diff --git a/chrome/browser/extensions/api/dial/dial_service_unittest.cc b/chrome/browser/extensions/api/dial/dial_service_unittest.cc index da1cc7b..b378589 100644 --- a/chrome/browser/extensions/api/dial/dial_service_unittest.cc +++ b/chrome/browser/extensions/api/dial/dial_service_unittest.cc @@ -116,9 +116,7 @@ TEST_F(DialServiceTest, TestResponseParsing) { DialDeviceData not_parsed; // Empty, garbage - EXPECT_FALSE(DialServiceImpl::ParseResponse( - "", - now, ¬_parsed)); + EXPECT_FALSE(DialServiceImpl::ParseResponse(std::string(), now, ¬_parsed)); EXPECT_FALSE(DialServiceImpl::ParseResponse( "\r\n\r\n", now, ¬_parsed)); diff --git a/chrome/browser/extensions/api/downloads/downloads_api.cc b/chrome/browser/extensions/api/downloads/downloads_api.cc index 44e7f29..6a126aa 100644 --- a/chrome/browser/extensions/api/downloads/downloads_api.cc +++ b/chrome/browser/extensions/api/downloads/downloads_api.cc @@ -218,9 +218,9 @@ scoped_ptr<base::DictionaryValue> DownloadItemToJSON( json->SetBoolean(kExistsKey, !download_item->GetFileExternallyRemoved()); json->SetInteger(kIdKey, download_item->GetId()); const GURL& url = download_item->GetOriginalUrl(); - json->SetString(kUrlKey, (url.is_valid() ? url.spec() : "")); - json->SetString( - kFilenameKey, download_item->GetFullPath().LossyDisplayName()); + json->SetString(kUrlKey, (url.is_valid() ? url.spec() : std::string())); + json->SetString(kFilenameKey, + download_item->GetFullPath().LossyDisplayName()); json->SetString(kDangerKey, DangerString(download_item->GetDangerType())); if (download_item->GetDangerType() != content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS) diff --git a/chrome/browser/extensions/api/downloads/downloads_api_unittest.cc b/chrome/browser/extensions/api/downloads/downloads_api_unittest.cc index 23a1131..e403cd5 100644 --- a/chrome/browser/extensions/api/downloads/downloads_api_unittest.cc +++ b/chrome/browser/extensions/api/downloads/downloads_api_unittest.cc @@ -737,7 +737,8 @@ class HTML5FileWriter { ~HTML5FileWriter() { CHECK(BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, base::Bind( &HTML5FileWriter::TearDownURLRequestContext, base::Unretained(this)))); - events_listener_->WaitFor(profile_, kURLRequestContextToreDown, ""); + events_listener_->WaitFor( + profile_, kURLRequestContextToreDown, std::string()); } bool WriteFile() { @@ -1071,8 +1072,10 @@ IN_PROC_BROWSER_TEST_F(DownloadExtensionTest, // Simulate an error during icon load by invoking the mock with an empty // result string. - std::string error = RunFunctionAndReturnError(MockedGetFileIconFunction( - download_item->GetTargetFilePath(), IconLoader::NORMAL, ""), + std::string error = RunFunctionAndReturnError( + MockedGetFileIconFunction(download_item->GetTargetFilePath(), + IconLoader::NORMAL, + std::string()), args32); EXPECT_STREQ(download_extension_errors::kIconNotFoundError, error.c_str()); diff --git a/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc b/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc index 0a5497f..07845e4 100644 --- a/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc +++ b/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc @@ -692,11 +692,9 @@ IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, TestTriggerBrowserAction) { "window.domAutomationController.send(document.body.style." "backgroundColor);"; std::string result; - const std::string frame_xpath = ""; - EXPECT_TRUE(content::ExecuteScriptInFrameAndExtractString(tab, - frame_xpath, - script, - &result)); + const std::string frame_xpath; + EXPECT_TRUE(content::ExecuteScriptInFrameAndExtractString( + tab, frame_xpath, script, &result)); EXPECT_EQ(result, "red"); } diff --git a/chrome/browser/extensions/api/extension_action/page_action_apitest.cc b/chrome/browser/extensions/api/extension_action/page_action_apitest.cc index 232280a..cad5250 100644 --- a/chrome/browser/extensions/api/extension_action/page_action_apitest.cc +++ b/chrome/browser/extensions/api/extension_action/page_action_apitest.cc @@ -63,7 +63,7 @@ IN_PROC_BROWSER_TEST_F(PageActionApiTest, Basic) { ExtensionService* service = extensions::ExtensionSystem::Get( browser()->profile())->extension_service(); service->browser_event_router()->PageActionExecuted( - browser()->profile(), *action, tab_id, "", 0); + browser()->profile(), *action, tab_id, std::string(), 0); EXPECT_TRUE(catcher.GetNextResult()); } @@ -108,7 +108,7 @@ IN_PROC_BROWSER_TEST_F(PageActionApiTest, AddPopup) { ExtensionService* service = extensions::ExtensionSystem::Get( browser()->profile())->extension_service(); service->browser_event_router()->PageActionExecuted( - browser()->profile(), *page_action, tab_id, "", 1); + browser()->profile(), *page_action, tab_id, std::string(), 1); ASSERT_TRUE(catcher.GetNextResult()); } @@ -188,7 +188,7 @@ IN_PROC_BROWSER_TEST_F(PageActionApiTest, OldPageActions) { browser()->profile())->extension_service(); ExtensionAction* page_action = GetPageAction(*extension); service->browser_event_router()->PageActionExecuted( - browser()->profile(), *page_action, tab_id, "", 1); + browser()->profile(), *page_action, tab_id, std::string(), 1); EXPECT_TRUE(catcher.GetNextResult()); } } @@ -260,7 +260,7 @@ IN_PROC_BROWSER_TEST_F(PageActionApiTest, TestTriggerPageAction) { ExtensionService* service = extensions::ExtensionSystem::Get( browser()->profile())->extension_service(); service->browser_event_router()->PageActionExecuted( - browser()->profile(), *page_action, tab_id, "", 0); + browser()->profile(), *page_action, tab_id, std::string(), 0); EXPECT_TRUE(catcher.GetNextResult()); } @@ -273,11 +273,9 @@ IN_PROC_BROWSER_TEST_F(PageActionApiTest, TestTriggerPageAction) { "window.domAutomationController.send(document.body.style." "backgroundColor);"; std::string result; - const std::string frame_xpath = ""; - EXPECT_TRUE(content::ExecuteScriptInFrameAndExtractString(tab, - frame_xpath, - script, - &result)); + const std::string frame_xpath; + EXPECT_TRUE(content::ExecuteScriptInFrameAndExtractString( + tab, frame_xpath, script, &result)); EXPECT_EQ(result, "red"); } diff --git a/chrome/browser/extensions/api/extension_action/script_badge_apitest.cc b/chrome/browser/extensions/api/extension_action/script_badge_apitest.cc index fd32e96..ff7fae7 100644 --- a/chrome/browser/extensions/api/extension_action/script_badge_apitest.cc +++ b/chrome/browser/extensions/api/extension_action/script_badge_apitest.cc @@ -88,7 +88,8 @@ IN_PROC_BROWSER_TEST_F(ScriptBadgeApiTest, Basics) { ResultCatcher catcher; // Visit a non-extension page so the extension can run a content script and // cause the script badge to be animated in. - ui_test_utils::NavigateToURL(browser(), test_server()->GetURL("")); + ui_test_utils::NavigateToURL(browser(), + test_server()->GetURL(std::string())); ASSERT_TRUE(catcher.GetNextResult()); } EXPECT_TRUE(script_badge->GetIsVisible(tab_id)); diff --git a/chrome/browser/extensions/api/file_system/file_system_api.cc b/chrome/browser/extensions/api/file_system/file_system_api.cc index 3bb588a..3b4e6f7 100644 --- a/chrome/browser/extensions/api/file_system/file_system_api.cc +++ b/chrome/browser/extensions/api/file_system/file_system_api.cc @@ -435,8 +435,11 @@ class FileSystemChooseEntryFunction::FilePicker select_file_dialog_->SelectFile(picker_type, string16(), suggested_name, - &file_type_info, 0, FILE_PATH_LITERAL(""), - owning_window, NULL); + &file_type_info, + 0, + FILE_PATH_LITERAL(std::string()), + owning_window, + NULL); } virtual ~FilePicker() {} 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 96da293..570c0fb 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 @@ -70,8 +70,8 @@ TEST_F(FileSystemApiUnitTest, FileSystemChooseEntryFunctionFileTypeInfoTest) { // Test grouping of multiple types. file_type_info = ui::SelectFileDialog::FileTypeInfo(); std::vector<linked_ptr<AcceptOption> > options; - options.push_back(linked_ptr<AcceptOption>( - BuildAcceptOption("", "application/x-chrome-extension", "jso"))); + options.push_back(linked_ptr<AcceptOption>(BuildAcceptOption( + 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("", "", "unrelated"))); + BuildAcceptOption(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("", "", "jso,js"))); + BuildAcceptOption(std::string(), std::string(), "jso,js"))); options.push_back(linked_ptr<AcceptOption>( - BuildAcceptOption("", "", "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("", "image/*", "html"))); + BuildAcceptOption(std::string(), "image/*", "html"))); acceptsAllTypes = false; FileSystemChooseEntryFunction::BuildFileTypeInfo(&file_type_info, base::FilePath::StringType(), &options, &acceptsAllTypes); @@ -134,8 +134,8 @@ TEST_F(FileSystemApiUnitTest, FileSystemChooseEntryFunctionFileTypeInfoTest) { // still present the default. file_type_info = ui::SelectFileDialog::FileTypeInfo(); options.clear(); - options.push_back(linked_ptr<AcceptOption>( - BuildAcceptOption("", "image/*,audio/*,video/*", ""))); + options.push_back(linked_ptr<AcceptOption>(BuildAcceptOption( + 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", ""))); + 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/api/identity/identity_apitest.cc b/chrome/browser/extensions/api/identity/identity_apitest.cc index b6fec79d..174f922 100644 --- a/chrome/browser/extensions/api/identity/identity_apitest.cc +++ b/chrome/browser/extensions/api/identity/identity_apitest.cc @@ -508,7 +508,7 @@ class LaunchWebAuthFlowFunctionTest : public ExtensionBrowserTest { }; IN_PROC_BROWSER_TEST_F(LaunchWebAuthFlowFunctionTest, Bounds) { - RunAndCheckBounds("", 0, 0, 0, 0); + RunAndCheckBounds(std::string(), 0, 0, 0, 0); RunAndCheckBounds("\"width\": 100, \"height\": 200", 0, 0, 100, 200); RunAndCheckBounds("\"left\": 100, \"top\": 200", 100, 200, 0, 0); RunAndCheckBounds( diff --git a/chrome/browser/extensions/api/management/management_api_browsertest.cc b/chrome/browser/extensions/api/management/management_api_browsertest.cc index f475e81..5b6b04d 100644 --- a/chrome/browser/extensions/api/management/management_api_browsertest.cc +++ b/chrome/browser/extensions/api/management/management_api_browsertest.cc @@ -257,15 +257,15 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementApiEscalationTest, // This should succeed when user accepts dialog. CommandLine::ForCurrentProcess()->AppendSwitchASCII( switches::kAppsGalleryInstallAutoConfirmForTests, "accept"); - SetEnabled(true, true, ""); + SetEnabled(true, true, std::string()); // Crash the extension. Mock a reload by disabling and then enabling. The // extension should be reloaded and enabled. ASSERT_TRUE(CrashEnabledExtension(kId)); - SetEnabled(false, true, ""); - SetEnabled(true, true, ""); - const Extension* extension = ExtensionSystem::Get(browser()->profile())-> - extension_service()->GetExtensionById(kId, false); + SetEnabled(false, true, std::string()); + SetEnabled(true, true, std::string()); + const Extension* extension = ExtensionSystem::Get(browser()->profile()) + ->extension_service()->GetExtensionById(kId, false); EXPECT_TRUE(extension); } diff --git a/chrome/browser/extensions/api/messaging/message_service.cc b/chrome/browser/extensions/api/messaging/message_service.cc index aae6a25..e3075f9 100644 --- a/chrome/browser/extensions/api/messaging/message_service.cc +++ b/chrome/browser/extensions/api/messaging/message_service.cc @@ -216,7 +216,7 @@ void MessageService::OpenChannelToNativeApp( } if (!has_permission) { - ExtensionMessagePort port(source, MSG_ROUTING_CONTROL, ""); + ExtensionMessagePort port(source, MSG_ROUTING_CONTROL, std::string()); port.DispatchOnDisconnect(GET_OPPOSITE_PORT_ID(receiver_port_id), kMissingPermissionError); return; @@ -247,7 +247,7 @@ void MessageService::OpenChannelToNativeApp( if (!native_process.get()) { LOG(ERROR) << "Failed to create native process."; // Treat it as a disconnect. - ExtensionMessagePort port(source, MSG_ROUTING_CONTROL, ""); + ExtensionMessagePort port(source, MSG_ROUTING_CONTROL, std::string()); port.DispatchOnDisconnect(GET_OPPOSITE_PORT_ID(receiver_port_id), kReceivingEndDoesntExistError); return; @@ -320,7 +320,8 @@ bool MessageService::OpenChannelImpl(scoped_ptr<OpenChannelParams> params) { if (!params->receiver.get() || !params->receiver->GetRenderProcessHost()) { // Treat it as a disconnect. - ExtensionMessagePort port(params->source, MSG_ROUTING_CONTROL, ""); + ExtensionMessagePort port( + params->source, MSG_ROUTING_CONTROL, std::string()); port.DispatchOnDisconnect(GET_OPPOSITE_PORT_ID(params->receiver_port_id), kReceivingEndDoesntExistError); return false; diff --git a/chrome/browser/extensions/api/proxy/proxy_api.cc b/chrome/browser/extensions/api/proxy/proxy_api.cc index ff945d3..5e811bd 100644 --- a/chrome/browser/extensions/api/proxy/proxy_api.cc +++ b/chrome/browser/extensions/api/proxy/proxy_api.cc @@ -41,7 +41,7 @@ void ProxyEventRouter::OnProxyError( DictionaryValue* dict = new DictionaryValue(); dict->SetBoolean(keys::kProxyEventFatal, true); dict->SetString(keys::kProxyEventError, net::ErrorToString(error_code)); - dict->SetString(keys::kProxyEventDetails, ""); + dict->SetString(keys::kProxyEventDetails, std::string()); args->Append(dict); if (profile) { diff --git a/chrome/browser/extensions/api/proxy/proxy_api_helpers_unittest.cc b/chrome/browser/extensions/api/proxy/proxy_api_helpers_unittest.cc index 116f85a..ff3cd32 100644 --- a/chrome/browser/extensions/api/proxy/proxy_api_helpers_unittest.cc +++ b/chrome/browser/extensions/api/proxy/proxy_api_helpers_unittest.cc @@ -222,41 +222,71 @@ TEST(ExtensionProxyApiHelpers, CreateProxyConfigDict) { std::string error; scoped_ptr<DictionaryValue> exp_direct(ProxyConfigDictionary::CreateDirect()); scoped_ptr<DictionaryValue> out_direct( - CreateProxyConfigDict(ProxyPrefs::MODE_DIRECT, false, "", "", "", "", + CreateProxyConfigDict(ProxyPrefs::MODE_DIRECT, + false, + std::string(), + std::string(), + std::string(), + std::string(), &error)); EXPECT_TRUE(Value::Equals(exp_direct.get(), out_direct.get())); scoped_ptr<DictionaryValue> exp_auto( ProxyConfigDictionary::CreateAutoDetect()); scoped_ptr<DictionaryValue> out_auto( - CreateProxyConfigDict(ProxyPrefs::MODE_AUTO_DETECT, false, "", "", "", "", + CreateProxyConfigDict(ProxyPrefs::MODE_AUTO_DETECT, + false, + std::string(), + std::string(), + std::string(), + std::string(), &error)); EXPECT_TRUE(Value::Equals(exp_auto.get(), out_auto.get())); scoped_ptr<DictionaryValue> exp_pac_url( ProxyConfigDictionary::CreatePacScript(kSamplePacScriptUrl, false)); scoped_ptr<DictionaryValue> out_pac_url( - CreateProxyConfigDict(ProxyPrefs::MODE_PAC_SCRIPT, false, - kSamplePacScriptUrl, "", "", "", &error)); + CreateProxyConfigDict(ProxyPrefs::MODE_PAC_SCRIPT, + false, + kSamplePacScriptUrl, + std::string(), + std::string(), + std::string(), + &error)); EXPECT_TRUE(Value::Equals(exp_pac_url.get(), out_pac_url.get())); scoped_ptr<DictionaryValue> exp_pac_data( ProxyConfigDictionary::CreatePacScript(kSamplePacScriptAsDataUrl, false)); scoped_ptr<DictionaryValue> out_pac_data( - CreateProxyConfigDict(ProxyPrefs::MODE_PAC_SCRIPT, false, "", - kSamplePacScript, "", "", &error)); + CreateProxyConfigDict(ProxyPrefs::MODE_PAC_SCRIPT, + false, + std::string(), + kSamplePacScript, + std::string(), + std::string(), + &error)); EXPECT_TRUE(Value::Equals(exp_pac_data.get(), out_pac_data.get())); scoped_ptr<DictionaryValue> exp_fixed( ProxyConfigDictionary::CreateFixedServers("foo:80", "localhost")); scoped_ptr<DictionaryValue> out_fixed( - CreateProxyConfigDict(ProxyPrefs::MODE_FIXED_SERVERS, false, "", "", - "foo:80", "localhost", &error)); + CreateProxyConfigDict(ProxyPrefs::MODE_FIXED_SERVERS, + false, + std::string(), + std::string(), + "foo:80", + "localhost", + &error)); EXPECT_TRUE(Value::Equals(exp_fixed.get(), out_fixed.get())); scoped_ptr<DictionaryValue> exp_system(ProxyConfigDictionary::CreateSystem()); scoped_ptr<DictionaryValue> out_system( - CreateProxyConfigDict(ProxyPrefs::MODE_SYSTEM, false, "", "", "", "", + CreateProxyConfigDict(ProxyPrefs::MODE_SYSTEM, + false, + std::string(), + std::string(), + std::string(), + std::string(), &error)); EXPECT_TRUE(Value::Equals(exp_system.get(), out_system.get())); diff --git a/chrome/browser/extensions/api/socket/udp_socket.cc b/chrome/browser/extensions/api/socket/udp_socket.cc index a2b5f97..b9a804c 100644 --- a/chrome/browser/extensions/api/socket/udp_socket.cc +++ b/chrome/browser/extensions/api/socket/udp_socket.cc @@ -108,7 +108,7 @@ void UDPSocket::RecvFrom(int count, DCHECK(!callback.is_null()); if (!recv_from_callback_.is_null()) { - callback.Run(net::ERR_IO_PENDING, NULL, "", 0); + callback.Run(net::ERR_IO_PENDING, NULL, std::string(), 0); return; } else { recv_from_callback_ = callback; diff --git a/chrome/browser/extensions/api/storage/settings_sync_unittest.cc b/chrome/browser/extensions/api/storage/settings_sync_unittest.cc index ec530e8..fcfcdc8 100644 --- a/chrome/browser/extensions/api/storage/settings_sync_unittest.cc +++ b/chrome/browser/extensions/api/storage/settings_sync_unittest.cc @@ -130,9 +130,10 @@ class MockSyncChangeProcessor : public syncer::SyncChangeProcessor { if (matching_changes.empty()) { ADD_FAILURE() << "No matching changes for " << extension_id << "/" << key << " (out of " << changes_.size() << ")"; - return SettingSyncData( - syncer::SyncChange::ACTION_INVALID, "", "", - scoped_ptr<Value>(new DictionaryValue())); + return SettingSyncData(syncer::SyncChange::ACTION_INVALID, + std::string(), + std::string(), + scoped_ptr<Value>(new DictionaryValue())); } if (matching_changes.size() != 1u) { ADD_FAILURE() << matching_changes.size() << " matching changes for " << diff --git a/chrome/browser/extensions/api/web_request/web_request_api.cc b/chrome/browser/extensions/api/web_request/web_request_api.cc index a17684e..56a8403 100644 --- a/chrome/browser/extensions/api/web_request/web_request_api.cc +++ b/chrome/browser/extensions/api/web_request/web_request_api.cc @@ -316,7 +316,7 @@ ListValue* GetRequestHeadersList(const net::HttpRequestHeaders& headers) { // Creates a StringValue with the status line of |headers|. If |headers| is // NULL, an empty string is returned. Ownership is passed to the caller. StringValue* GetStatusLine(net::HttpResponseHeaders* headers) { - return new StringValue(headers ? headers->GetStatusLine() : ""); + return new StringValue(headers ? headers->GetStatusLine() : std::string()); } void NotifyWebRequestAPIUsed(void* profile_id, const Extension* extension) { diff --git a/chrome/browser/extensions/api/web_request/web_request_api_helpers.cc b/chrome/browser/extensions/api/web_request/web_request_api_helpers.cc index a9f1319..0d2a3d6 100644 --- a/chrome/browser/extensions/api/web_request/web_request_api_helpers.cc +++ b/chrome/browser/extensions/api/web_request/web_request_api_helpers.cc @@ -621,7 +621,7 @@ static std::string FindSetRequestHeader( return (*delta)->extension_id; } } - return ""; + return std::string(); } // Returns the extension ID of the first extension in |deltas| that removes the @@ -639,7 +639,7 @@ static std::string FindRemoveRequestHeader( return (*delta)->extension_id; } } - return ""; + return std::string(); } void MergeOnBeforeSendHeadersResponses( @@ -816,22 +816,26 @@ static bool DoesResponseCookieMatchFilter(net::ParsedCookie* cookie, if (filter->name.get() && cookie->Name() != *filter->name) return false; if (filter->value.get() && cookie->Value() != *filter->value) return false; if (filter->expires.get()) { - std::string actual_value = cookie->HasExpires() ? cookie->Expires() : ""; + std::string actual_value = + cookie->HasExpires() ? cookie->Expires() : std::string(); if (actual_value != *filter->expires) return false; } if (filter->max_age.get()) { - std::string actual_value = cookie->HasMaxAge() ? cookie->MaxAge() : ""; + std::string actual_value = + cookie->HasMaxAge() ? cookie->MaxAge() : std::string(); if (actual_value != base::IntToString(*filter->max_age)) return false; } if (filter->domain.get()) { - std::string actual_value = cookie->HasDomain() ? cookie->Domain() : ""; + std::string actual_value = + cookie->HasDomain() ? cookie->Domain() : std::string(); if (actual_value != *filter->domain) return false; } if (filter->path.get()) { - std::string actual_value = cookie->HasPath() ? cookie->Path() : ""; + std::string actual_value = + cookie->HasPath() ? cookie->Path() : std::string(); if (actual_value != *filter->path) return false; } @@ -880,7 +884,8 @@ static bool MergeAddResponseCookieModifications( continue; // Cookie names are not unique in response cookies so we always append // and never override. - linked_ptr<net::ParsedCookie> cookie(new net::ParsedCookie("")); + linked_ptr<net::ParsedCookie> cookie( + new net::ParsedCookie(std::string())); ApplyResponseCookieModification((*mod)->modification.get(), cookie.get()); cookies->push_back(cookie); modified = true; @@ -1008,7 +1013,7 @@ static std::string FindRemoveResponseHeader( return (*delta)->extension_id; } } - return ""; + return std::string(); } void MergeOnHeadersReceivedResponses( diff --git a/chrome/browser/extensions/api/web_request/web_request_api_unittest.cc b/chrome/browser/extensions/api/web_request/web_request_api_unittest.cc index 91e3dd9..fc78860 100644 --- a/chrome/browser/extensions/api/web_request/web_request_api_unittest.cc +++ b/chrome/browser/extensions/api/web_request/web_request_api_unittest.cc @@ -574,9 +574,10 @@ TEST_F(ExtensionWebRequestTest, AccessRequestBodyData) { keys::kRequestBodyRawBytesKey, BinaryValue::CreateWithCopiedBuffer(kPlainBlock1, kPlainBlock1Length), &raw); - extensions::subtle::AppendKeyValuePair(keys::kRequestBodyRawFileKey, - Value::CreateStringValue(""), - &raw); + extensions::subtle::AppendKeyValuePair( + keys::kRequestBodyRawFileKey, + Value::CreateStringValue(std::string()), + &raw); extensions::subtle::AppendKeyValuePair( keys::kRequestBodyRawBytesKey, BinaryValue::CreateWithCopiedBuffer(kPlainBlock2, kPlainBlock2Length), @@ -962,7 +963,7 @@ void TestInitFromValue(const std::string& values, bool expected_return_code, } TEST_F(ExtensionWebRequestTest, InitFromValue) { - TestInitFromValue("", true, 0); + TestInitFromValue(std::string(), true, 0); // Single valid values. TestInitFromValue( diff --git a/chrome/browser/extensions/api/web_socket_proxy_private/web_socket_proxy_private_api.cc b/chrome/browser/extensions/api/web_socket_proxy_private/web_socket_proxy_private_api.cc index 237941c..91483c5 100644 --- a/chrome/browser/extensions/api/web_socket_proxy_private/web_socket_proxy_private_api.cc +++ b/chrome/browser/extensions/api/web_socket_proxy_private/web_socket_proxy_private_api.cc @@ -95,7 +95,7 @@ void WebSocketProxyPrivate::ResolveHostIOPart(IOThread* io_thread) { bool WebSocketProxyPrivate::RunImpl() { AddRef(); - SetResult(Value::CreateStringValue("")); + SetResult(Value::CreateStringValue(std::string())); #if defined(OS_CHROMEOS) bool delay_response = false; diff --git a/chrome/browser/extensions/api/webstore_private/webstore_private_api.cc b/chrome/browser/extensions/api/webstore_private/webstore_private_api.cc index 0264c36..8cb59aa 100644 --- a/chrome/browser/extensions/api/webstore_private/webstore_private_api.cc +++ b/chrome/browser/extensions/api/webstore_private/webstore_private_api.cc @@ -295,7 +295,7 @@ bool BeginInstallWithManifestFunction::RunImpl() { void BeginInstallWithManifestFunction::SetResultCode(ResultCode code) { switch (code) { case ERROR_NONE: - SetResult(Value::CreateStringValue("")); + SetResult(Value::CreateStringValue(std::string())); break; case UNKNOWN_ERROR: SetResult(Value::CreateStringValue("unknown_error")); @@ -338,7 +338,7 @@ void BeginInstallWithManifestFunction::OnWebstoreParseSuccess( Extension::FROM_WEBSTORE, id, localized_name_, - "", + std::string(), &error); if (!dummy_extension_) { diff --git a/chrome/browser/extensions/api/webstore_private/webstore_private_apitest.cc b/chrome/browser/extensions/api/webstore_private/webstore_private_apitest.cc index 81a63d1..1a39317 100644 --- a/chrome/browser/extensions/api/webstore_private/webstore_private_apitest.cc +++ b/chrome/browser/extensions/api/webstore_private/webstore_private_apitest.cc @@ -248,7 +248,7 @@ class ExtensionWebstoreGetWebGLStatusTest : public InProcessBrowserTest { function.get(), kEmptyArgs, browser())); ASSERT_TRUE(result); EXPECT_EQ(base::Value::TYPE_STRING, result->GetType()); - std::string webgl_status = ""; + std::string webgl_status; EXPECT_TRUE(result->GetAsString(&webgl_status)); EXPECT_STREQ(webgl_allowed ? kWebGLStatusAllowed : kWebGLStatusBlocked, webgl_status.c_str()); diff --git a/chrome/browser/extensions/bundle_installer.cc b/chrome/browser/extensions/bundle_installer.cc index 97005be..7cf66d3 100644 --- a/chrome/browser/extensions/bundle_installer.cc +++ b/chrome/browser/extensions/bundle_installer.cc @@ -215,7 +215,7 @@ void BundleInstaller::ParseManifests() { for (ItemMap::iterator i = items_.begin(); i != items_.end(); ++i) { scoped_refptr<WebstoreInstallHelper> helper = new WebstoreInstallHelper( - this, i->first, i->second.manifest, "", GURL(), NULL); + this, i->first, i->second.manifest, std::string(), GURL(), NULL); helper->Start(); } } diff --git a/chrome/browser/extensions/component_loader.cc b/chrome/browser/extensions/component_loader.cc index 58c53b7..82a6883 100644 --- a/chrome/browser/extensions/component_loader.cc +++ b/chrome/browser/extensions/component_loader.cc @@ -137,7 +137,7 @@ std::string ComponentLoader::Add(const std::string& manifest_contents, DictionaryValue* manifest = ParseManifest(manifest_contents); if (manifest) return Add(manifest, root_directory); - return ""; + return std::string(); } std::string ComponentLoader::Add(const DictionaryValue* parsed_manifest, diff --git a/chrome/browser/extensions/component_loader_unittest.cc b/chrome/browser/extensions/component_loader_unittest.cc index bedcfee..4b2b52a 100644 --- a/chrome/browser/extensions/component_loader_unittest.cc +++ b/chrome/browser/extensions/component_loader_unittest.cc @@ -141,7 +141,7 @@ TEST_F(ComponentLoaderTest, ParseManifest) { // 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("")); + manifest.reset(component_loader_.ParseManifest(std::string())); EXPECT_FALSE(manifest.get()); manifest.reset(component_loader_.ParseManifest("[{ \"foo\": 3 }]")); diff --git a/chrome/browser/extensions/event_router.cc b/chrome/browser/extensions/event_router.cc index 4a75636..72e0f52 100644 --- a/chrome/browser/extensions/event_router.cc +++ b/chrome/browser/extensions/event_router.cc @@ -119,7 +119,7 @@ void EventRouter::LogExtensionEventMessage(void* profile_id, LOG(WARNING) << "Extension " << extension_id << " not found!"; } else { extensions::ActivityLog::GetInstance(profile)->LogEventAction( - extension, event_name, event_args.get(), ""); + extension, event_name, event_args.get(), std::string()); } } } @@ -243,10 +243,8 @@ void EventRouter::OnListenerAdded(const EventListener* listener) { scoped_ptr<ListValue> args(new ListValue()); if (listener->filter) args->Append(listener->filter->DeepCopy()); - activity_log_->LogAPIAction(extension, - event_name + ".addListener", - args.get(), - ""); + activity_log_->LogAPIAction( + extension, event_name + ".addListener", args.get(), std::string()); } } @@ -271,10 +269,8 @@ void EventRouter::OnListenerRemoved(const EventListener* listener) { ExtensionService::INCLUDE_ENABLED); if (extension) { scoped_ptr<ListValue> args(new ListValue()); - activity_log_->LogAPIAction(extension, - event_name + ".removeListener", - args.get(), - ""); + activity_log_->LogAPIAction( + extension, event_name + ".removeListener", args.get(), std::string()); } } @@ -384,7 +380,7 @@ bool EventRouter::HasEventListenerImpl(const ListenerMap& listener_map, } void EventRouter::BroadcastEvent(scoped_ptr<Event> event) { - DispatchEventImpl("", linked_ptr<Event>(event.release())); + DispatchEventImpl(std::string(), linked_ptr<Event>(event.release())); } void EventRouter::DispatchEventToExtension(const std::string& extension_id, diff --git a/chrome/browser/extensions/event_router_forwarder.cc b/chrome/browser/extensions/event_router_forwarder.cc index 15b7e97..f094608 100644 --- a/chrome/browser/extensions/event_router_forwarder.cc +++ b/chrome/browser/extensions/event_router_forwarder.cc @@ -26,7 +26,7 @@ void EventRouterForwarder::BroadcastEventToRenderers( const std::string& event_name, scoped_ptr<base::ListValue> event_args, const GURL& event_url) { - HandleEvent("", event_name, event_args.Pass(), 0, true, event_url); + HandleEvent(std::string(), event_name, event_args.Pass(), 0, true, event_url); } void EventRouterForwarder::DispatchEventToRenderers( @@ -37,8 +37,12 @@ void EventRouterForwarder::DispatchEventToRenderers( const GURL& event_url) { if (!profile) return; - HandleEvent("", event_name, event_args.Pass(), profile, - use_profile_to_restrict_events, event_url); + HandleEvent(std::string(), + event_name, + event_args.Pass(), + profile, + use_profile_to_restrict_events, + event_url); } void EventRouterForwarder::BroadcastEventToExtension( diff --git a/chrome/browser/extensions/extension_action_unittest.cc b/chrome/browser/extensions/extension_action_unittest.cc index 9a5c3ff..6c2ca63 100644 --- a/chrome/browser/extensions/extension_action_unittest.cc +++ b/chrome/browser/extensions/extension_action_unittest.cc @@ -15,7 +15,7 @@ using extensions::ActionInfo; TEST(ExtensionActionTest, Title) { ActionInfo action_info; action_info.default_title = "Initial Title"; - ExtensionAction action("", ActionInfo::TYPE_PAGE, action_info); + ExtensionAction action(std::string(), ActionInfo::TYPE_PAGE, action_info); ASSERT_EQ("Initial Title", action.GetTitle(1)); action.SetTitle(ExtensionAction::kDefaultTabId, "foo"); @@ -31,8 +31,7 @@ TEST(ExtensionActionTest, Title) { } TEST(ExtensionActionTest, Visibility) { - ExtensionAction action("", ActionInfo::TYPE_PAGE, - ActionInfo()); + ExtensionAction action(std::string(), ActionInfo::TYPE_PAGE, ActionInfo()); ASSERT_FALSE(action.GetIsVisible(1)); action.SetAppearance(ExtensionAction::kDefaultTabId, ExtensionAction::ACTIVE); @@ -53,8 +52,8 @@ TEST(ExtensionActionTest, Visibility) { ASSERT_FALSE(action.GetIsVisible(1)); ASSERT_FALSE(action.GetIsVisible(100)); - ExtensionAction browser_action("", ActionInfo::TYPE_BROWSER, - ActionInfo()); + ExtensionAction browser_action( + std::string(), ActionInfo::TYPE_BROWSER, ActionInfo()); ASSERT_TRUE(browser_action.GetIsVisible(1)); } @@ -62,8 +61,8 @@ TEST(ExtensionActionTest, ScriptBadgeAnimation) { // Supports the icon animation. MessageLoop message_loop; - ExtensionAction script_badge("", ActionInfo::TYPE_SCRIPT_BADGE, - ActionInfo()); + ExtensionAction script_badge( + std::string(), ActionInfo::TYPE_SCRIPT_BADGE, ActionInfo()); EXPECT_FALSE(script_badge.GetIconAnimation(ExtensionAction::kDefaultTabId)); script_badge.SetAppearance(ExtensionAction::kDefaultTabId, ExtensionAction::ACTIVE); @@ -86,8 +85,8 @@ TEST(ExtensionActionTest, GetAttention) { // Supports the icon animation. scoped_ptr<MessageLoop> message_loop(new MessageLoop); - ExtensionAction script_badge("", ActionInfo::TYPE_SCRIPT_BADGE, - ActionInfo()); + ExtensionAction script_badge( + std::string(), ActionInfo::TYPE_SCRIPT_BADGE, ActionInfo()); EXPECT_FALSE(script_badge.GetIsVisible(1)); EXPECT_FALSE(script_badge.GetIconAnimation(1)); script_badge.SetAppearance(1, ExtensionAction::WANTS_ATTENTION); @@ -107,8 +106,8 @@ TEST(ExtensionActionTest, GetAttention) { TEST(ExtensionActionTest, Icon) { ActionInfo action_info; action_info.default_icon.Add(16, "icon16.png"); - ExtensionAction page_action("", ActionInfo::TYPE_PAGE, - action_info); + ExtensionAction page_action( + std::string(), ActionInfo::TYPE_PAGE, action_info); ASSERT_TRUE(page_action.default_icon()); EXPECT_EQ("icon16.png", page_action.default_icon()->Get( @@ -119,8 +118,7 @@ TEST(ExtensionActionTest, Icon) { } TEST(ExtensionActionTest, Badge) { - ExtensionAction action("", ActionInfo::TYPE_PAGE, - ActionInfo()); + ExtensionAction action(std::string(), ActionInfo::TYPE_PAGE, ActionInfo()); ASSERT_EQ("", action.GetBadgeText(1)); action.SetBadgeText(ExtensionAction::kDefaultTabId, "foo"); ASSERT_EQ("foo", action.GetBadgeText(1)); @@ -135,8 +133,7 @@ TEST(ExtensionActionTest, Badge) { } TEST(ExtensionActionTest, BadgeTextColor) { - ExtensionAction action("", ActionInfo::TYPE_PAGE, - ActionInfo()); + ExtensionAction action(std::string(), ActionInfo::TYPE_PAGE, ActionInfo()); ASSERT_EQ(0x00000000u, action.GetBadgeTextColor(1)); action.SetBadgeTextColor(ExtensionAction::kDefaultTabId, 0xFFFF0000u); ASSERT_EQ(0xFFFF0000u, action.GetBadgeTextColor(1)); @@ -151,8 +148,7 @@ TEST(ExtensionActionTest, BadgeTextColor) { } TEST(ExtensionActionTest, BadgeBackgroundColor) { - ExtensionAction action("", ActionInfo::TYPE_PAGE, - ActionInfo()); + ExtensionAction action(std::string(), ActionInfo::TYPE_PAGE, ActionInfo()); ASSERT_EQ(0x00000000u, action.GetBadgeBackgroundColor(1)); action.SetBadgeBackgroundColor(ExtensionAction::kDefaultTabId, 0xFFFF0000u); @@ -176,7 +172,7 @@ TEST(ExtensionActionTest, PopupUrl) { ActionInfo action_info; action_info.default_popup_url = url_foo; - ExtensionAction action("", ActionInfo::TYPE_PAGE, action_info); + ExtensionAction action(std::string(), ActionInfo::TYPE_PAGE, action_info); ASSERT_EQ(url_foo, action.GetPopupUrl(1)); ASSERT_EQ(url_foo, action.GetPopupUrl(100)); diff --git a/chrome/browser/extensions/extension_apitest.cc b/chrome/browser/extensions/extension_apitest.cc index e3534e4..8d072ae 100644 --- a/chrome/browser/extensions/extension_apitest.cc +++ b/chrome/browser/extensions/extension_apitest.cc @@ -80,7 +80,7 @@ void ExtensionApiTest::ResultCatcher::Observe( case chrome::NOTIFICATION_EXTENSION_TEST_PASSED: VLOG(1) << "Got EXTENSION_TEST_PASSED notification."; results_.push_back(true); - messages_.push_back(""); + messages_.push_back(std::string()); if (waiting_) MessageLoopForUI::current()->Quit(); break; @@ -114,41 +114,45 @@ void ExtensionApiTest::TearDownInProcessBrowserTestFixture() { } bool ExtensionApiTest::RunExtensionTest(const char* extension_name) { - return RunExtensionTestImpl(extension_name, "", kFlagEnableFileAccess); + return RunExtensionTestImpl( + extension_name, std::string(), kFlagEnableFileAccess); } bool ExtensionApiTest::RunExtensionTestIncognito(const char* extension_name) { - return RunExtensionTestImpl( - extension_name, "", kFlagEnableIncognito | kFlagEnableFileAccess); + return RunExtensionTestImpl(extension_name, + std::string(), + kFlagEnableIncognito | kFlagEnableFileAccess); } bool ExtensionApiTest::RunExtensionTestIgnoreManifestWarnings( const char* extension_name) { return RunExtensionTestImpl( - extension_name, "", kFlagIgnoreManifestWarnings); + extension_name, std::string(), kFlagIgnoreManifestWarnings); } bool ExtensionApiTest::RunExtensionTestAllowOldManifestVersion( const char* extension_name) { return RunExtensionTestImpl( extension_name, - "", + std::string(), kFlagEnableFileAccess | kFlagAllowOldManifestVersions); } bool ExtensionApiTest::RunComponentExtensionTest(const char* extension_name) { - return RunExtensionTestImpl( - extension_name, "", kFlagEnableFileAccess | kFlagLoadAsComponent); + return RunExtensionTestImpl(extension_name, + std::string(), + kFlagEnableFileAccess | kFlagLoadAsComponent); } bool ExtensionApiTest::RunExtensionTestNoFileAccess( const char* extension_name) { - return RunExtensionTestImpl(extension_name, "", kFlagNone); + return RunExtensionTestImpl(extension_name, std::string(), kFlagNone); } bool ExtensionApiTest::RunExtensionTestIncognitoNoFileAccess( const char* extension_name) { - return RunExtensionTestImpl(extension_name, "", kFlagEnableIncognito); + return RunExtensionTestImpl( + extension_name, std::string(), kFlagEnableIncognito); } bool ExtensionApiTest::RunExtensionSubtest(const char* extension_name, @@ -174,7 +178,8 @@ bool ExtensionApiTest::RunPageTest(const std::string& page_url, } bool ExtensionApiTest::RunPlatformAppTest(const char* extension_name) { - return RunExtensionTestImpl(extension_name, "", kFlagLaunchPlatformApp); + return RunExtensionTestImpl( + extension_name, std::string(), kFlagLaunchPlatformApp); } // Load |extension_name| extension and/or |page_url| and wait for diff --git a/chrome/browser/extensions/extension_browsertest.cc b/chrome/browser/extensions/extension_browsertest.cc index b051df9..cfad60e 100644 --- a/chrome/browser/extensions/extension_browsertest.cc +++ b/chrome/browser/extensions/extension_browsertest.cc @@ -337,9 +337,13 @@ class MockAutoConfirmExtensionInstallPrompt : public ExtensionInstallPrompt { const Extension* ExtensionBrowserTest::InstallExtensionFromWebstore( const base::FilePath& path, int expected_change) { - return InstallOrUpdateExtension("", path, INSTALL_UI_TYPE_NONE, - expected_change, Manifest::INTERNAL, - browser(), true); + return InstallOrUpdateExtension(std::string(), + path, + INSTALL_UI_TYPE_NONE, + expected_change, + Manifest::INTERNAL, + browser(), + true); } const Extension* ExtensionBrowserTest::InstallOrUpdateExtension( diff --git a/chrome/browser/extensions/extension_browsertest.h b/chrome/browser/extensions/extension_browsertest.h index 9d1203c..9d79f56 100644 --- a/chrome/browser/extensions/extension_browsertest.h +++ b/chrome/browser/extensions/extension_browsertest.h @@ -112,8 +112,8 @@ class ExtensionBrowserTest : virtual public InProcessBrowserTest, // you expect a failed upgrade. const extensions::Extension* InstallExtension(const base::FilePath& path, int expected_change) { - return InstallOrUpdateExtension("", path, INSTALL_UI_TYPE_NONE, - expected_change); + return InstallOrUpdateExtension( + std::string(), path, INSTALL_UI_TYPE_NONE, expected_change); } // Same as above, but an install source other than Manifest::INTERNAL can be @@ -122,8 +122,11 @@ class ExtensionBrowserTest : virtual public InProcessBrowserTest, const base::FilePath& path, int expected_change, extensions::Manifest::Location install_source) { - return InstallOrUpdateExtension("", path, INSTALL_UI_TYPE_NONE, - expected_change, install_source); + return InstallOrUpdateExtension(std::string(), + path, + INSTALL_UI_TYPE_NONE, + expected_change, + install_source); } // Installs extension as if it came from the Chrome Webstore. @@ -144,22 +147,27 @@ class ExtensionBrowserTest : virtual public InProcessBrowserTest, const extensions::Extension* InstallExtensionWithUI( const base::FilePath& path, int expected_change) { - return InstallOrUpdateExtension("", path, INSTALL_UI_TYPE_NORMAL, - expected_change); + return InstallOrUpdateExtension( + std::string(), path, INSTALL_UI_TYPE_NORMAL, expected_change); } const extensions::Extension* InstallExtensionWithUIAutoConfirm( const base::FilePath& path, int expected_change, Browser* browser) { - return InstallOrUpdateExtension("", path, INSTALL_UI_TYPE_AUTO_CONFIRM, - expected_change, browser, false); + return InstallOrUpdateExtension(std::string(), + path, + INSTALL_UI_TYPE_AUTO_CONFIRM, + expected_change, + browser, + false); } // Begins install process but simulates a user cancel. const extensions::Extension* StartInstallButCancel( const base::FilePath& path) { - return InstallOrUpdateExtension("", path, INSTALL_UI_TYPE_CANCEL, 0); + return InstallOrUpdateExtension( + std::string(), path, INSTALL_UI_TYPE_CANCEL, 0); } void ReloadExtension(const std::string& extension_id); diff --git a/chrome/browser/extensions/extension_function_dispatcher.cc b/chrome/browser/extensions/extension_function_dispatcher.cc index 00a1f39..c15ba6f 100644 --- a/chrome/browser/extensions/extension_function_dispatcher.cc +++ b/chrome/browser/extensions/extension_function_dispatcher.cc @@ -63,7 +63,7 @@ void LogSuccess(const Extension* extension, } else { extensions::ActivityLog* activity_log = extensions::ActivityLog::GetInstance(profile); - activity_log->LogAPIAction(extension, api_name, args.get(), ""); + activity_log->LogAPIAction(extension, api_name, args.get(), std::string()); } } @@ -86,11 +86,8 @@ void LogFailure(const Extension* extension, } else { extensions::ActivityLog* activity_log = extensions::ActivityLog::GetInstance(profile); - activity_log->LogBlockedAction(extension, - api_name, - args.get(), - reason, - ""); + activity_log->LogBlockedAction( + extension, api_name, args.get(), reason, std::string()); } } diff --git a/chrome/browser/extensions/extension_pref_value_map_unittest.cc b/chrome/browser/extensions/extension_pref_value_map_unittest.cc index bfa573f..7f1b2d5 100644 --- a/chrome/browser/extensions/extension_pref_value_map_unittest.cc +++ b/chrome/browser/extensions/extension_pref_value_map_unittest.cc @@ -45,7 +45,7 @@ class ExtensionPrefValueMapTestBase : public BASECLASS { // Returns an empty string if the key is not set. std::string GetValue(const char * key, bool incognito) const { const Value *value = epvm_.GetEffectivePrefValue(key, incognito, NULL); - std::string string_value = ""; + std::string string_value; if (value) value->GetAsString(&string_value); return string_value; diff --git a/chrome/browser/extensions/extension_prefs.cc b/chrome/browser/extensions/extension_prefs.cc index 0f1d743..b24e0e7 100644 --- a/chrome/browser/extensions/extension_prefs.cc +++ b/chrome/browser/extensions/extension_prefs.cc @@ -1670,7 +1670,8 @@ void ExtensionPrefs::SetDelayedInstallInfo( if (extension->RequiresSortOrdinal()) { extension_dict->SetString( kPrefSuggestedPageOrdinal, - page_ordinal.IsValid() ? page_ordinal.ToInternalValue() : ""); + page_ordinal.IsValid() ? page_ordinal.ToInternalValue() + : std::string()); } UpdateExtensionPref(extension->id(), kDelayedInstallInfo, extension_dict); diff --git a/chrome/browser/extensions/extension_process_manager.cc b/chrome/browser/extensions/extension_process_manager.cc index a4cb67f..09fc245 100644 --- a/chrome/browser/extensions/extension_process_manager.cc +++ b/chrome/browser/extensions/extension_process_manager.cc @@ -63,7 +63,7 @@ std::string GetExtensionID(RenderViewHost* render_view_host) { // This works for both apps and extensions because the site has been // normalized to the extension URL for apps. if (!render_view_host->GetSiteInstance()) - return ""; + return std::string(); return render_view_host->GetSiteInstance()->GetSiteURL().host(); } diff --git a/chrome/browser/extensions/extension_protocols.cc b/chrome/browser/extensions/extension_protocols.cc index 049d813..503b2ad 100644 --- a/chrome/browser/extensions/extension_protocols.cc +++ b/chrome/browser/extensions/extension_protocols.cc @@ -320,7 +320,8 @@ bool AllowExtensionResourceLoad(net::URLRequest* request, // some extensions want to be able to do things like create their own // launchers. std::string resource_root_relative_path = - request->url().path().empty() ? "" : request->url().path().substr(1); + request->url().path().empty() ? std::string() + : request->url().path().substr(1); if (extension->is_hosted_app() && !extensions::IconsInfo::GetIcons(extension) .ContainsPath(resource_root_relative_path)) { diff --git a/chrome/browser/extensions/extension_service_unittest.cc b/chrome/browser/extensions/extension_service_unittest.cc index a6068b5..368d048 100644 --- a/chrome/browser/extensions/extension_service_unittest.cc +++ b/chrome/browser/extensions/extension_service_unittest.cc @@ -1192,7 +1192,7 @@ TEST_F(ExtensionServiceTest, LoadAllExtensionsFromDirectorySuccess) { EXPECT_EQ(std::string(good1), loaded_[1]->id()); EXPECT_EQ(std::string("My extension 2"), loaded_[1]->name()); - EXPECT_EQ(std::string(""), loaded_[1]->description()); + EXPECT_EQ(std::string(), loaded_[1]->description()); EXPECT_EQ(loaded_[1]->GetResourceURL("background.html"), extensions::BackgroundInfo::GetBackgroundURL(loaded_[1])); EXPECT_EQ( @@ -1220,7 +1220,7 @@ TEST_F(ExtensionServiceTest, LoadAllExtensionsFromDirectorySuccess) { int index = expected_num_extensions - 1; EXPECT_EQ(std::string(good2), loaded_[index]->id()); EXPECT_EQ(std::string("My extension 3"), loaded_[index]->name()); - EXPECT_EQ(std::string(""), loaded_[index]->description()); + EXPECT_EQ(std::string(), loaded_[index]->description()); EXPECT_EQ( 0u, extensions::ContentScriptsInfo::GetContentScripts(loaded_[index]).size()); @@ -3313,8 +3313,8 @@ TEST_F(ExtensionServiceTest, ManagementPolicyProhibitsLoadFromPrefs) { // UNPACKED is for extensions loaded from a directory. We use it here, even // though we're testing loading from prefs, so that we don't need to provide // an extension key. - extensions::ExtensionInfo extension_info(&manifest, "", path, - Manifest::UNPACKED); + extensions::ExtensionInfo extension_info( + &manifest, std::string(), path, Manifest::UNPACKED); // Ensure we can load it with no management policy in place. management_policy_->UnregisterAllProviders(); diff --git a/chrome/browser/extensions/extension_test_message_listener.cc b/chrome/browser/extensions/extension_test_message_listener.cc index 90aa01a..e892ba1 100644 --- a/chrome/browser/extensions/extension_test_message_listener.cc +++ b/chrome/browser/extensions/extension_test_message_listener.cc @@ -17,7 +17,6 @@ ExtensionTestMessageListener::ExtensionTestMessageListener( satisfied_(false), waiting_(false), will_reply_(will_reply), - failure_message_(""), failed_(false) { registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_TEST_MESSAGE, content::NotificationService::AllSources()); @@ -59,7 +58,7 @@ void ExtensionTestMessageListener::Observe( satisfied_ = true; registrar_.RemoveAll(); // Stop listening for more messages. if (!will_reply_) { - function_->Reply(""); + function_->Reply(std::string()); function_ = NULL; } if (waiting_) { diff --git a/chrome/browser/extensions/extensions_quota_service.cc b/chrome/browser/extensions/extensions_quota_service.cc index c01b9e3..6b267a5 100644 --- a/chrome/browser/extensions/extensions_quota_service.cc +++ b/chrome/browser/extensions/extensions_quota_service.cc @@ -42,7 +42,7 @@ std::string ExtensionsQuotaService::Assess( DCHECK(CalledOnValidThread()); if (function->ShouldSkipQuotaLimiting()) - return ""; + return std::string(); // Lookup function list for extension. FunctionHeuristicsMap& functions = function_heuristics_[extension_id]; @@ -53,7 +53,7 @@ std::string ExtensionsQuotaService::Assess( function->GetQuotaLimitHeuristics(&heuristics); if (heuristics.empty()) - return ""; // No heuristic implies no limit. + return std::string(); // No heuristic implies no limit. ViolationErrorMap::iterator violation_error = violation_errors_.find(extension_id); @@ -71,7 +71,7 @@ std::string ExtensionsQuotaService::Assess( } if (!failed_heuristic) - return ""; + return std::string(); std::string error = failed_heuristic->GetError(); DCHECK_GT(error.length(), 0u); diff --git a/chrome/browser/extensions/external_policy_loader_unittest.cc b/chrome/browser/extensions/external_policy_loader_unittest.cc index 5f8943c..75bd788 100644 --- a/chrome/browser/extensions/external_policy_loader_unittest.cc +++ b/chrome/browser/extensions/external_policy_loader_unittest.cc @@ -139,7 +139,8 @@ TEST_F(ExternalPolicyLoaderTest, InvalidEntriesIgnored) { // Add invalid entries. forced_extensions.SetString("invalid", "http://www.example.com/crx"); - forced_extensions.SetString("dddddddddddddddddddddddddddddddd", ""); + forced_extensions.SetString("dddddddddddddddddddddddddddddddd", + std::string()); forced_extensions.SetString("invalid", "bad"); MockExternalPolicyProviderVisitor mv; diff --git a/chrome/browser/extensions/isolated_app_browsertest.cc b/chrome/browser/extensions/isolated_app_browsertest.cc index b7717bb..ec55a4c 100644 --- a/chrome/browser/extensions/isolated_app_browsertest.cc +++ b/chrome/browser/extensions/isolated_app_browsertest.cc @@ -328,7 +328,7 @@ IN_PROC_BROWSER_TEST_F(IsolatedAppTest, MAYBE_SubresourceCookieIsolation) { // The app under test acts on URLs whose host is "localhost", // so the URLs we navigate to must have host "localhost". - GURL root_url = test_server()->GetURL(""); + GURL root_url = test_server()->GetURL(std::string()); GURL base_url = test_server()->GetURL("files/extensions/isolated_apps/"); GURL::Replacements replace_host; std::string host_str("localhost"); // Must stay in scope with replace_host. diff --git a/chrome/browser/extensions/menu_manager.cc b/chrome/browser/extensions/menu_manager.cc index 0335866..4256c61 100644 --- a/chrome/browser/extensions/menu_manager.cc +++ b/chrome/browser/extensions/menu_manager.cc @@ -833,14 +833,10 @@ void MenuManager::RemoveAllIncognitoContextItems() { RemoveContextMenuItem(*remove_iter); } -MenuItem::Id::Id() - : incognito(false), extension_id(""), uid(0), string_uid("") { -} +MenuItem::Id::Id() : incognito(false), uid(0) {} MenuItem::Id::Id(bool incognito, const std::string& extension_id) - : incognito(incognito), extension_id(extension_id), uid(0), - string_uid("") { -} + : incognito(incognito), extension_id(extension_id), uid(0) {} MenuItem::Id::~Id() { } diff --git a/chrome/browser/extensions/pending_extension_info.cc b/chrome/browser/extensions/pending_extension_info.cc index 6fc0adc..a1e93d8 100644 --- a/chrome/browser/extensions/pending_extension_info.cc +++ b/chrome/browser/extensions/pending_extension_info.cc @@ -25,8 +25,7 @@ PendingExtensionInfo::PendingExtensionInfo( install_source_(install_source) {} PendingExtensionInfo::PendingExtensionInfo() - : id_(""), - update_url_(), + : update_url_(), should_allow_install_(NULL), is_from_sync_(true), install_silently_(false), diff --git a/chrome/browser/extensions/platform_app_browsertest_util.cc b/chrome/browser/extensions/platform_app_browsertest_util.cc index 62f8545..58c2548 100644 --- a/chrome/browser/extensions/platform_app_browsertest_util.cc +++ b/chrome/browser/extensions/platform_app_browsertest_util.cc @@ -142,13 +142,13 @@ ShellWindow* PlatformAppBrowserTest::CreateShellWindow( const Extension* extension) { ShellWindow::CreateParams params; return ShellWindow::Create( - browser()->profile(), extension, GURL(""), params); + browser()->profile(), extension, GURL(std::string()), params); } ShellWindow* PlatformAppBrowserTest::CreateShellWindowFromParams( const Extension* extension, const ShellWindow::CreateParams& params) { return ShellWindow::Create( - browser()->profile(), extension, GURL(""), params); + browser()->profile(), extension, GURL(std::string()), params); } void PlatformAppBrowserTest::CloseShellWindow(ShellWindow* window) { diff --git a/chrome/browser/extensions/platform_app_launcher.cc b/chrome/browser/extensions/platform_app_launcher.cc index a883e66..46daa89 100644 --- a/chrome/browser/extensions/platform_app_launcher.cc +++ b/chrome/browser/extensions/platform_app_launcher.cc @@ -107,10 +107,7 @@ class PlatformAppPathLauncher PlatformAppPathLauncher(Profile* profile, const Extension* extension, const base::FilePath& file_path) - : profile_(profile), - extension_(extension), - file_path_(file_path), - handler_id_("") {} + : profile_(profile), extension_(extension), file_path_(file_path) {} void Launch() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); diff --git a/chrome/browser/extensions/script_badge_controller_unittest.cc b/chrome/browser/extensions/script_badge_controller_unittest.cc index d2cf6bc..cb773f8 100644 --- a/chrome/browser/extensions/script_badge_controller_unittest.cc +++ b/chrome/browser/extensions/script_badge_controller_unittest.cc @@ -138,7 +138,7 @@ TEST_F(ScriptBadgeControllerTest, ExecutionMakesBadgeVisible) { web_contents(), id_map, web_contents()->GetController().GetActiveEntry()->GetPageID(), - GURL("")); + GURL(std::string())); EXPECT_THAT(script_badge_controller_->GetCurrentActions(), testing::ElementsAre(GetScriptBadge(*extension))); EXPECT_THAT(location_bar_updated.events, testing::Gt(0)); @@ -167,7 +167,7 @@ TEST_F(ScriptBadgeControllerTest, FragmentNavigation) { web_contents(), id_map, web_contents()->GetController().GetActiveEntry()->GetPageID(), - GURL("")); + GURL(std::string())); EXPECT_THAT(script_badge_controller_->GetCurrentActions(), testing::ElementsAre(GetScriptBadge(*extension))); diff --git a/chrome/browser/extensions/script_executor.cc b/chrome/browser/extensions/script_executor.cc index c5ed09f..b35b776 100644 --- a/chrome/browser/extensions/script_executor.cc +++ b/chrome/browser/extensions/script_executor.cc @@ -66,7 +66,7 @@ class Handler : public content::WebContentsObserver { virtual void WebContentsDestroyed(content::WebContents* tab) OVERRIDE { base::ListValue val; - callback_.Run(kRendererDestroyed, -1, GURL(""), val); + callback_.Run(kRendererDestroyed, -1, GURL(std::string()), val); delete this; } diff --git a/chrome/browser/extensions/subscribe_page_action_browsertest.cc b/chrome/browser/extensions/subscribe_page_action_browsertest.cc index 471ad5c..02449a1 100644 --- a/chrome/browser/extensions/subscribe_page_action_browsertest.cc +++ b/chrome/browser/extensions/subscribe_page_action_browsertest.cc @@ -114,10 +114,8 @@ void NavigateToFeedAndValidate(net::TestServer* server, GetFeedUrl(server, url, true, extension_id)); WebContents* tab = browser->tab_strip_model()->GetActiveWebContents(); - ASSERT_TRUE(ValidatePageElement(tab, - "", - kScriptFeedTitle, - expected_feed_title)); + ASSERT_TRUE(ValidatePageElement( + tab, std::string(), kScriptFeedTitle, expected_feed_title)); ASSERT_TRUE(ValidatePageElement(tab, "//html/body/div/iframe[1]", kScriptAnchor, diff --git a/chrome/browser/extensions/tab_helper.cc b/chrome/browser/extensions/tab_helper.cc index cdcec02..cd420ad 100644 --- a/chrome/browser/extensions/tab_helper.cc +++ b/chrome/browser/extensions/tab_helper.cc @@ -413,7 +413,7 @@ void TabHelper::OnInlineInstallComplete(int install_id, const std::string& error) { if (success) { Send(new ExtensionMsg_InlineWebstoreInstallResponse( - return_route_id, install_id, true, "")); + return_route_id, install_id, true, std::string())); } else { Send(new ExtensionMsg_InlineWebstoreInstallResponse( return_route_id, install_id, false, error)); diff --git a/chrome/browser/extensions/updater/extension_downloader.cc b/chrome/browser/extensions/updater/extension_downloader.cc index 0c04a89..f165732 100644 --- a/chrome/browser/extensions/updater/extension_downloader.cc +++ b/chrome/browser/extensions/updater/extension_downloader.cc @@ -153,12 +153,7 @@ UpdateDetails::UpdateDetails(const std::string& id, const Version& version) UpdateDetails::~UpdateDetails() {} - -ExtensionDownloader::ExtensionFetch::ExtensionFetch() - : id(""), - url(), - package_hash(""), - version("") {} +ExtensionDownloader::ExtensionFetch::ExtensionFetch() : url() {} ExtensionDownloader::ExtensionFetch::ExtensionFetch( const std::string& id, @@ -220,7 +215,11 @@ bool ExtensionDownloader::AddPendingExtension(const std::string& id, Version version("0.0.0.0"); DCHECK(version.IsValid()); - return AddExtensionData(id, version, Manifest::TYPE_UNKNOWN, update_url, "", + return AddExtensionData(id, + version, + Manifest::TYPE_UNKNOWN, + update_url, + std::string(), request_id); } @@ -249,7 +248,10 @@ void ExtensionDownloader::StartBlacklistUpdate( new ManifestFetchData(extension_urls::GetWebstoreUpdateUrl(), request_id)); DCHECK(blacklist_fetch->base_url().SchemeIsSecure()); - blacklist_fetch->AddExtension(kBlacklistAppID, version, &ping_data, "", + blacklist_fetch->AddExtension(kBlacklistAppID, + version, + &ping_data, + std::string(), kDefaultInstallSource); StartUpdateCheck(blacklist_fetch.Pass()); } diff --git a/chrome/browser/extensions/updater/extension_updater.cc b/chrome/browser/extensions/updater/extension_updater.cc index feadf5a..130da8f 100644 --- a/chrome/browser/extensions/updater/extension_updater.cc +++ b/chrome/browser/extensions/updater/extension_updater.cc @@ -106,10 +106,7 @@ ExtensionUpdater::FetchedCRXFile::FetchedCRXFile( download_url(u), request_ids(request_ids) {} -ExtensionUpdater::FetchedCRXFile::FetchedCRXFile() - : extension_id(""), - path(), - download_url() {} +ExtensionUpdater::FetchedCRXFile::FetchedCRXFile() : path(), download_url() {} ExtensionUpdater::FetchedCRXFile::~FetchedCRXFile() {} diff --git a/chrome/browser/extensions/updater/extension_updater_unittest.cc b/chrome/browser/extensions/updater/extension_updater_unittest.cc index 4921d9e..3481c0c 100644 --- a/chrome/browser/extensions/updater/extension_updater_unittest.cc +++ b/chrome/browser/extensions/updater/extension_updater_unittest.cc @@ -432,7 +432,7 @@ static void ExtractParameters(const std::string& params, if (!key_val.empty()) { std::string key = key_val[0]; EXPECT_TRUE(result->find(key) == result->end()); - (*result)[key] = (key_val.size() == 2) ? key_val[1] : ""; + (*result)[key] = (key_val.size() == 2) ? key_val[1] : std::string(); } else { NOTREACHED(); } @@ -637,7 +637,8 @@ class ExtensionUpdaterTest : public testing::Test { // Make sure that an empty update URL data string does not cause a ap= // option to appear in the x= parameter. ManifestFetchData fetch_data(GURL("http://localhost/foo"), 0); - fetch_data.AddExtension(id, version, &kNeverPingedData, "", ""); + fetch_data.AddExtension( + id, version, &kNeverPingedData, std::string(), std::string()); std::map<std::string, std::string> params; VerifyQueryAndExtractParameters(fetch_data.full_url().query(), ¶ms); @@ -653,7 +654,8 @@ class ExtensionUpdaterTest : public testing::Test { // Make sure that an update URL data string causes an appropriate ap= // option to appear in the x= parameter. ManifestFetchData fetch_data(GURL("http://localhost/foo"), 0); - fetch_data.AddExtension(id, version, &kNeverPingedData, "bar", ""); + fetch_data.AddExtension( + id, version, &kNeverPingedData, "bar", std::string()); std::map<std::string, std::string> params; VerifyQueryAndExtractParameters(fetch_data.full_url().query(), ¶ms); EXPECT_EQ(id, params["id"]); @@ -668,7 +670,8 @@ class ExtensionUpdaterTest : public testing::Test { // Make sure that an update URL data string causes an appropriate ap= // option to appear in the x= parameter. ManifestFetchData fetch_data(GURL("http://localhost/foo"), 0); - fetch_data.AddExtension(id, version, &kNeverPingedData, "a=1&b=2&c", ""); + fetch_data.AddExtension( + id, version, &kNeverPingedData, "a=1&b=2&c", std::string()); std::map<std::string, std::string> params; VerifyQueryAndExtractParameters(fetch_data.full_url().query(), ¶ms); EXPECT_EQ(id, params["id"]); @@ -738,14 +741,12 @@ class ExtensionUpdaterTest : public testing::Test { // installed and available at v2.0). const std::string id1 = id_util::GenerateId("1"); const std::string id2 = id_util::GenerateId("2"); - fetch_data.AddExtension(id1, "1.0.0.0", - &kNeverPingedData, kEmptyUpdateUrlData, ""); - AddParseResult(id1, "1.1", - "http://localhost/e1_1.1.crx", &updates); - fetch_data.AddExtension(id2, "2.0.0.0", - &kNeverPingedData, kEmptyUpdateUrlData, ""); - AddParseResult(id2, "2.0.0.0", - "http://localhost/e2_2.0.crx", &updates); + fetch_data.AddExtension( + id1, "1.0.0.0", &kNeverPingedData, kEmptyUpdateUrlData, std::string()); + AddParseResult(id1, "1.1", "http://localhost/e1_1.1.crx", &updates); + fetch_data.AddExtension( + id2, "2.0.0.0", &kNeverPingedData, kEmptyUpdateUrlData, std::string()); + AddParseResult(id2, "2.0.0.0", "http://localhost/e2_2.0.crx", &updates); EXPECT_CALL(delegate, IsExtensionPending(_)).WillRepeatedly(Return(false)); EXPECT_CALL(delegate, GetExtensionExistingVersion(id1, _)) @@ -782,8 +783,11 @@ class ExtensionUpdaterTest : public testing::Test { std::list<std::string>::const_iterator it; for (it = ids_for_update_check.begin(); it != ids_for_update_check.end(); ++it) { - fetch_data.AddExtension(*it, "1.0.0.0", - &kNeverPingedData, kEmptyUpdateUrlData, ""); + fetch_data.AddExtension(*it, + "1.0.0.0", + &kNeverPingedData, + kEmptyUpdateUrlData, + std::string()); AddParseResult(*it, "1.1", "http://localhost/e1_1.1.crx", &updates); } @@ -816,10 +820,14 @@ class ExtensionUpdaterTest : public testing::Test { scoped_ptr<ManifestFetchData> fetch3(new ManifestFetchData(kUpdateUrl, 0)); scoped_ptr<ManifestFetchData> fetch4(new ManifestFetchData(kUpdateUrl, 0)); ManifestFetchData::PingData zeroDays(0, 0, true); - fetch1->AddExtension("1111", "1.0", &zeroDays, kEmptyUpdateUrlData, ""); - fetch2->AddExtension("2222", "2.0", &zeroDays, kEmptyUpdateUrlData, ""); - fetch3->AddExtension("3333", "3.0", &zeroDays, kEmptyUpdateUrlData, ""); - fetch4->AddExtension("4444", "4.0", &zeroDays, kEmptyUpdateUrlData, ""); + fetch1->AddExtension( + "1111", "1.0", &zeroDays, kEmptyUpdateUrlData, std::string()); + fetch2->AddExtension( + "2222", "2.0", &zeroDays, kEmptyUpdateUrlData, std::string()); + fetch3->AddExtension( + "3333", "3.0", &zeroDays, kEmptyUpdateUrlData, std::string()); + fetch4->AddExtension( + "4444", "4.0", &zeroDays, kEmptyUpdateUrlData, std::string()); // This will start the first fetcher and queue the others. The next in queue // is started as each fetcher receives its response. @@ -927,7 +935,8 @@ class ExtensionUpdaterTest : public testing::Test { scoped_ptr<ManifestFetchData> fetch(new ManifestFetchData(kUpdateUrl, 0)); ManifestFetchData::PingData zeroDays(0, 0, true); - fetch->AddExtension("1111", "1.0", &zeroDays, kEmptyUpdateUrlData, ""); + fetch->AddExtension( + "1111", "1.0", &zeroDays, kEmptyUpdateUrlData, std::string()); // This will start the first fetcher. downloader.StartUpdateCheck(fetch.Pass()); @@ -954,7 +963,8 @@ class ExtensionUpdaterTest : public testing::Test { // For response codes that are not in the 5xx range ExtensionDownloader // should not retry. fetch.reset(new ManifestFetchData(kUpdateUrl, 0)); - fetch->AddExtension("1111", "1.0", &zeroDays, kEmptyUpdateUrlData, ""); + fetch->AddExtension( + "1111", "1.0", &zeroDays, kEmptyUpdateUrlData, std::string()); // This will start the first fetcher. downloader.StartUpdateCheck(fetch.Pass()); @@ -1006,7 +1016,7 @@ class ExtensionUpdaterTest : public testing::Test { GURL test_url("http://localhost/extension.crx"); std::string id = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; - std::string hash = ""; + std::string hash; Version version("0.0.1"); std::set<int> requests; requests.insert(0); @@ -1142,8 +1152,8 @@ class ExtensionUpdaterTest : public testing::Test { std::string id1 = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; std::string id2 = "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"; - std::string hash1 = ""; - std::string hash2 = ""; + std::string hash1; + std::string hash2; std::string version1 = "0.1"; std::string version2 = "0.1"; @@ -1357,7 +1367,7 @@ class ExtensionUpdaterTest : public testing::Test { fetcher->set_url(fetched_urls[0]); fetcher->set_status(net::URLRequestStatus()); fetcher->set_response_code(500); - fetcher->SetResponseString(""); + fetcher->SetResponseString(std::string()); fetcher->delegate()->OnURLFetchComplete(fetcher); fetcher = factory.GetFetcherByID(ExtensionDownloader::kManifestFetcherId); @@ -1442,8 +1452,11 @@ class ExtensionUpdaterTest : public testing::Test { ManifestFetchData fetch_data(update_url, 0); const Extension* extension = tmp[0]; - fetch_data.AddExtension(extension->id(), extension->VersionString(), - &kNeverPingedData, kEmptyUpdateUrlData, ""); + fetch_data.AddExtension(extension->id(), + extension->VersionString(), + &kNeverPingedData, + kEmptyUpdateUrlData, + std::string()); UpdateManifest::Results results; results.daystart_elapsed_seconds = 750; @@ -1647,7 +1660,7 @@ TEST_F(ExtensionUpdaterTest, TestManifestFetchesBuilderAddExtension) { EXPECT_EQ(1u, ManifestFetchersCount(downloader.get())); // Extensions with empty IDs should be rejected. - EXPECT_FALSE(downloader->AddPendingExtension("", GURL(), 0)); + EXPECT_FALSE(downloader->AddPendingExtension(std::string(), GURL(), 0)); downloader->StartAllPending(); EXPECT_EQ(1u, ManifestFetchersCount(downloader.get())); diff --git a/chrome/browser/extensions/webstore_installer.cc b/chrome/browser/extensions/webstore_installer.cc index 81db7ed..f5f4d68 100644 --- a/chrome/browser/extensions/webstore_installer.cc +++ b/chrome/browser/extensions/webstore_installer.cc @@ -125,7 +125,8 @@ void GetDownloadFilePath( base::FilePath file = directory.AppendASCII(id + "_" + random_number + ".crx"); - int uniquifier = file_util::GetUniquePathNumber(file, FILE_PATH_LITERAL("")); + int uniquifier = + file_util::GetUniquePathNumber(file, FILE_PATH_LITERAL(std::string())); if (uniquifier > 0) { file = file.InsertBeforeExtensionASCII( base::StringPrintf(" (%d)", uniquifier)); diff --git a/chrome/browser/extensions/webstore_standalone_installer.cc b/chrome/browser/extensions/webstore_standalone_installer.cc index cadce50..7df550f 100644 --- a/chrome/browser/extensions/webstore_standalone_installer.cc +++ b/chrome/browser/extensions/webstore_standalone_installer.cc @@ -80,7 +80,7 @@ void WebstoreStandaloneInstaller::OnWebstoreRequestFailure() { void WebstoreStandaloneInstaller::OnWebstoreResponseParseSuccess( DictionaryValue* webstore_data) { if (!CheckRequestorAlive()) { - CompleteInstall(""); + CompleteInstall(std::string()); return; } @@ -141,13 +141,13 @@ void WebstoreStandaloneInstaller::OnWebstoreResponseParseSuccess( // Assume ownership of webstore_data. webstore_data_.reset(webstore_data); - scoped_refptr<WebstoreInstallHelper> helper = new WebstoreInstallHelper( - this, - id_, - manifest, - "", // We don't have any icon data. - icon_url, - profile_->GetRequestContext()); + scoped_refptr<WebstoreInstallHelper> helper = + new WebstoreInstallHelper(this, + id_, + manifest, + std::string(), // We don't have any icon data. + icon_url, + profile_->GetRequestContext()); // The helper will call us back via OnWebstoreParseSucces or // OnWebstoreParseFailure. helper->Start(); @@ -165,7 +165,7 @@ void WebstoreStandaloneInstaller::OnWebstoreParseSuccess( CHECK_EQ(id_, id); if (!CheckRequestorAlive()) { - CompleteInstall(""); + CompleteInstall(std::string()); return; } @@ -190,7 +190,7 @@ void WebstoreStandaloneInstaller::OnWebstoreParseFailure( void WebstoreStandaloneInstaller::InstallUIProceed() { if (!CheckRequestorAlive()) { - CompleteInstall(""); + CompleteInstall(std::string()); return; } @@ -219,7 +219,7 @@ void WebstoreStandaloneInstaller::InstallUIAbort(bool user_initiated) { void WebstoreStandaloneInstaller::OnExtensionInstallSuccess( const std::string& id) { CHECK_EQ(id_, id); - CompleteInstall(""); + CompleteInstall(std::string()); } void WebstoreStandaloneInstaller::OnExtensionInstallFailure( diff --git a/chrome/browser/feedback/feedback_util.cc b/chrome/browser/feedback/feedback_util.cc index 7133c60..f892a87 100644 --- a/chrome/browser/feedback/feedback_util.cc +++ b/chrome/browser/feedback/feedback_util.cc @@ -283,7 +283,7 @@ void FeedbackUtil::SendReport(scoped_refptr<FeedbackData> data) { // CHROMEOS_RELEASE_VERSION from /etc/lsb-release #if !defined(OS_CHROMEOS) // Add OS version (eg, for WinXP SP2: "5.1.2600 Service Pack 2"). - std::string os_version = ""; + std::string os_version; SetOSVersion(&os_version); AddFeedbackData(&feedback_data, std::string(kOsVersionTag), os_version); #endif diff --git a/chrome/browser/file_select_helper.cc b/chrome/browser/file_select_helper.cc index 15e4a05..3d07ff2 100644 --- a/chrome/browser/file_select_helper.cc +++ b/chrome/browser/file_select_helper.cc @@ -423,9 +423,10 @@ void FileSelectHelper::RunFileChooserOnUIThread( params.title, default_file_name, select_file_types_.get(), - select_file_types_.get() && !select_file_types_->extensions.empty() ? - 1 : 0, // 1-based index of default extension to show. - FILE_PATH_LITERAL(""), + select_file_types_.get() && !select_file_types_->extensions.empty() + ? 1 + : 0, // 1-based index of default extension to show. + FILE_PATH_LITERAL(std::string()), owning_window, #if defined(OS_ANDROID) &accept_types); diff --git a/chrome/browser/google/google_util.cc b/chrome/browser/google/google_util.cc index d66a585..50900bd 100644 --- a/chrome/browser/google/google_util.cc +++ b/chrome/browser/google/google_util.cc @@ -32,7 +32,7 @@ #endif #ifndef LINKDOCTOR_SERVER_REQUEST_URL -#define LINKDOCTOR_SERVER_REQUEST_URL "" +#define LINKDOCTOR_SERVER_REQUEST_URL std::string() #endif namespace { diff --git a/chrome/browser/google/google_util_unittest.cc b/chrome/browser/google/google_util_unittest.cc index cf4c610..75b7067 100644 --- a/chrome/browser/google/google_util_unittest.cc +++ b/chrome/browser/google/google_util_unittest.cc @@ -53,7 +53,7 @@ TEST(GoogleUtilTest, GoodHomePagesSecure) { } TEST(GoogleUtilTest, BadHomePages) { - EXPECT_FALSE(IsGoogleHomePageUrl("")); + EXPECT_FALSE(IsGoogleHomePageUrl(std::string())); // If specified, only the "www" subdomain is OK. EXPECT_FALSE(IsGoogleHomePageUrl("http://maps.google.com")); @@ -237,7 +237,7 @@ TEST(GoogleUtilTest, BadSearches) { "http://www.google.com/search/nogood?q=something")); EXPECT_FALSE(IsGoogleSearchUrl( "http://www.google.com/webhp/nogood#q=something")); - EXPECT_FALSE(IsGoogleSearchUrl("")); + EXPECT_FALSE(IsGoogleSearchUrl(std::string())); // Case sensitive paths. EXPECT_FALSE(IsGoogleSearchUrl( diff --git a/chrome/browser/google_apis/base_operations.cc b/chrome/browser/google_apis/base_operations.cc index c6f425c..6692a8a 100644 --- a/chrome/browser/google_apis/base_operations.cc +++ b/chrome/browser/google_apis/base_operations.cc @@ -186,7 +186,7 @@ void UrlFetchOperationBase::Start(const std::string& access_token, request_type == URLFetcher::PATCH) { // Set empty upload content-type and upload content, so that // the request will have no "Content-type: " header and no content. - url_fetcher_->SetUploadData("", ""); + url_fetcher_->SetUploadData(std::string(), std::string()); } } diff --git a/chrome/browser/google_apis/base_operations_unittest.cc b/chrome/browser/google_apis/base_operations_unittest.cc index 2f7e01a..047e5c2 100644 --- a/chrome/browser/google_apis/base_operations_unittest.cc +++ b/chrome/browser/google_apis/base_operations_unittest.cc @@ -66,9 +66,9 @@ class BaseOperationsTest : public testing::Test { virtual void SetUp() OVERRIDE { profile_.reset(new TestingProfile); runner_.reset(new OperationRunner(profile_.get(), - NULL /* url_request_context_getter */, - std::vector<std::string>() /* scopes */, - "" /* custom user agent */)); + NULL /* url_request_context_getter */, + std::vector<std::string>() /* scopes */, + std::string() /* custom user agent */)); runner_->Initialize(); LOG(ERROR) << "Initialized."; } diff --git a/chrome/browser/google_apis/drive_api_operations.cc b/chrome/browser/google_apis/drive_api_operations.cc index 7bab455..1206743 100644 --- a/chrome/browser/google_apis/drive_api_operations.cc +++ b/chrome/browser/google_apis/drive_api_operations.cc @@ -200,7 +200,7 @@ GURL CreateDirectoryOperation::GetURL() const { if (parent_resource_id_.empty() || directory_name_.empty()) { return GURL(); } - return url_generator_.GetFilelistUrl(GURL(), ""); + return url_generator_.GetFilelistUrl(GURL(), std::string()); } net::URLFetcher::RequestType CreateDirectoryOperation::GetRequestType() const { diff --git a/chrome/browser/google_apis/drive_api_operations_unittest.cc b/chrome/browser/google_apis/drive_api_operations_unittest.cc index 36c2c89..b6a0f61 100644 --- a/chrome/browser/google_apis/drive_api_operations_unittest.cc +++ b/chrome/browser/google_apis/drive_api_operations_unittest.cc @@ -867,7 +867,7 @@ TEST_F(DriveApiOperationsTest, UploadExistingFileOperation) { kTestContentType, kTestContent.size(), "resource_id", // The resource id of the file to be overwritten. - "", // No etag. + std::string(), // No etag. CreateComposedCallback( base::Bind(&test_util::RunAndQuit), test_util::CreateCopyResultCallback(&error, &upload_url))); diff --git a/chrome/browser/google_apis/drive_api_url_generator_unittest.cc b/chrome/browser/google_apis/drive_api_url_generator_unittest.cc index 818fb2d..bcb6c6d 100644 --- a/chrome/browser/google_apis/drive_api_url_generator_unittest.cc +++ b/chrome/browser/google_apis/drive_api_url_generator_unittest.cc @@ -69,7 +69,7 @@ TEST_F(DriveApiUrlGeneratorTest, GetFilelistUrl) { // Use default URL, if |override_url| is empty. // Do not add q parameter if |search_string| is empty. EXPECT_EQ("https://www.googleapis.com/drive/v2/files", - url_generator_.GetFilelistUrl(GURL(), "").spec()); + url_generator_.GetFilelistUrl(GURL(), std::string()).spec()); // Set q parameter if non-empty |search_string| is given. EXPECT_EQ("https://www.googleapis.com/drive/v2/files?q=query", @@ -77,9 +77,10 @@ TEST_F(DriveApiUrlGeneratorTest, GetFilelistUrl) { // Use the |override_url| for the base URL if given. // The behavior for the |search_string| should be as same as above cases. - EXPECT_EQ("https://localhost/drive/v2/files", - url_generator_.GetFilelistUrl( - GURL("https://localhost/drive/v2/files"), "").spec()); + EXPECT_EQ( + "https://localhost/drive/v2/files", + url_generator_.GetFilelistUrl(GURL("https://localhost/drive/v2/files"), + std::string()).spec()); EXPECT_EQ("https://localhost/drive/v2/files?q=query", url_generator_.GetFilelistUrl( GURL("https://localhost/drive/v2/files"), "query").spec()); diff --git a/chrome/browser/google_apis/drive_uploader_unittest.cc b/chrome/browser/google_apis/drive_uploader_unittest.cc index 5f3bb62..f522a87 100644 --- a/chrome/browser/google_apis/drive_uploader_unittest.cc +++ b/chrome/browser/google_apis/drive_uploader_unittest.cc @@ -298,7 +298,7 @@ TEST_F(DriveUploaderTest, UploadExisting0KB) { base::FilePath::FromUTF8Unsafe(kTestDrivePath), local_path, kTestMimeType, - "", // etag + std::string(), // etag test_util::CreateCopyResultCallback( &error, &drive_path, &file_path, &resource_entry)); test_util::RunBlockingPoolTask(); @@ -330,7 +330,7 @@ TEST_F(DriveUploaderTest, UploadExisting512KB) { base::FilePath::FromUTF8Unsafe(kTestDrivePath), local_path, kTestMimeType, - "", // etag + std::string(), // etag test_util::CreateCopyResultCallback( &error, &drive_path, &file_path, &resource_entry)); test_util::RunBlockingPoolTask(); @@ -363,7 +363,7 @@ TEST_F(DriveUploaderTest, UploadExisting1234KB) { base::FilePath::FromUTF8Unsafe(kTestDrivePath), local_path, kTestMimeType, - "", // etag + std::string(), // etag test_util::CreateCopyResultCallback( &error, &drive_path, &file_path, &resource_entry)); test_util::RunBlockingPoolTask(); @@ -429,7 +429,7 @@ TEST_F(DriveUploaderTest, InitiateUploadFail) { base::FilePath::FromUTF8Unsafe(kTestDrivePath), local_path, kTestMimeType, - "", // etag + std::string(), // etag test_util::CreateCopyResultCallback( &error, &drive_path, &file_path, &resource_entry)); test_util::RunBlockingPoolTask(); @@ -508,7 +508,7 @@ TEST_F(DriveUploaderTest, ResumeUploadFail) { base::FilePath::FromUTF8Unsafe(kTestDrivePath), local_path, kTestMimeType, - "", // etag + std::string(), // etag test_util::CreateCopyResultCallback( &error, &drive_path, &file_path, &resource_entry)); test_util::RunBlockingPoolTask(); @@ -528,7 +528,7 @@ TEST_F(DriveUploaderTest, NonExistingSourceFile) { base::FilePath::FromUTF8Unsafe(kTestDrivePath), temp_dir_.path().AppendASCII("_this_path_should_not_exist_"), kTestMimeType, - "", // etag + std::string(), // etag test_util::CreateCopyResultCallback( &error, &drive_path, &file_path, &resource_entry)); test_util::RunBlockingPoolTask(); diff --git a/chrome/browser/google_apis/fake_drive_service.cc b/chrome/browser/google_apis/fake_drive_service.cc index d91aced..d5cb4ad 100644 --- a/chrome/browser/google_apis/fake_drive_service.cc +++ b/chrome/browser/google_apis/fake_drive_service.cc @@ -340,10 +340,10 @@ void FakeDriveService::GetAllResourceList( DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); - GetResourceList(GURL(), // no next feed - 0, // start changestamp - "", // empty search query - "", // no directory resource id, + GetResourceList(GURL(), // no next feed + 0, // start changestamp + std::string(), // empty search query + std::string(), // no directory resource id, callback); } @@ -354,9 +354,9 @@ void FakeDriveService::GetResourceListInDirectory( DCHECK(!directory_resource_id.empty()); DCHECK(!callback.is_null()); - GetResourceList(GURL(), // no next feed - 0, // start changestamp - "", // empty search query + GetResourceList(GURL(), // no next feed + 0, // start changestamp + std::string(), // empty search query directory_resource_id, callback); } @@ -367,10 +367,10 @@ void FakeDriveService::Search(const std::string& search_query, DCHECK(!search_query.empty()); DCHECK(!callback.is_null()); - GetResourceList(GURL(), // no next feed - 0, // start changestamp + GetResourceList(GURL(), // no next feed + 0, // start changestamp search_query, - "", // no directory resource id, + std::string(), // no directory resource id, callback); } @@ -395,10 +395,10 @@ void FakeDriveService::GetChangeList(int64 start_changestamp, DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); - GetResourceList(GURL(), // no next feed + GetResourceList(GURL(), // no next feed start_changestamp, - "", // empty search query - "", // no directory resource id, + std::string(), // empty search query + std::string(), // no directory resource id, callback); } diff --git a/chrome/browser/google_apis/fake_drive_service_unittest.cc b/chrome/browser/google_apis/fake_drive_service_unittest.cc index e89ed15..2f94ba5 100644 --- a/chrome/browser/google_apis/fake_drive_service_unittest.cc +++ b/chrome/browser/google_apis/fake_drive_service_unittest.cc @@ -96,9 +96,9 @@ TEST_F(FakeDriveServiceTest, GetResourceList_All) { scoped_ptr<ResourceList> resource_list; fake_service_.GetResourceList( GURL(), - 0, // start_changestamp - "", // search_query - "", // directory_resource_id + 0, // start_changestamp + std::string(), // search_query + std::string(), // directory_resource_id test_util::CreateCopyResultCallback(&error, &resource_list)); message_loop_.RunUntilIdle(); @@ -117,9 +117,9 @@ TEST_F(FakeDriveServiceTest, GetResourceList_WithStartIndex) { scoped_ptr<ResourceList> resource_list; fake_service_.GetResourceList( GURL("http://dummyurl/?start-offset=2"), - 0, // start_changestamp - "", // search_query - "", // directory_resource_id + 0, // start_changestamp + std::string(), // search_query + std::string(), // directory_resource_id test_util::CreateCopyResultCallback(&error, &resource_list)); message_loop_.RunUntilIdle(); @@ -139,9 +139,9 @@ TEST_F(FakeDriveServiceTest, GetResourceList_WithStartIndexAndMaxResults) { scoped_ptr<ResourceList> resource_list; fake_service_.GetResourceList( GURL("http://localhost/?start-offset=2&max-results=5"), - 0, // start_changestamp - "", // search_query - "", // directory_resource_id + 0, // start_changestamp + std::string(), // search_query + std::string(), // directory_resource_id test_util::CreateCopyResultCallback(&error, &resource_list)); message_loop_.RunUntilIdle(); @@ -168,9 +168,9 @@ TEST_F(FakeDriveServiceTest, GetResourceList_WithDefaultMaxResultsChanged) { scoped_ptr<ResourceList> resource_list; fake_service_.GetResourceList( GURL(), - 0, // start_changestamp - "", // search_query - "", // directory_resource_id + 0, // start_changestamp + std::string(), // search_query + std::string(), // directory_resource_id test_util::CreateCopyResultCallback(&error, &resource_list)); message_loop_.RunUntilIdle(); @@ -196,8 +196,8 @@ TEST_F(FakeDriveServiceTest, GetResourceList_InRootDirectory) { scoped_ptr<ResourceList> resource_list; fake_service_.GetResourceList( GURL(), - 0, // start_changestamp - "", // search_query + 0, // start_changestamp + std::string(), // search_query fake_service_.GetRootResourceId(), // directory_resource_id test_util::CreateCopyResultCallback(&error, &resource_list)); message_loop_.RunUntilIdle(); @@ -217,9 +217,9 @@ TEST_F(FakeDriveServiceTest, GetResourceList_Search) { scoped_ptr<ResourceList> resource_list; fake_service_.GetResourceList( GURL(), - 0, // start_changestamp - "File", // search_query - "", // directory_resource_id + 0, // start_changestamp + "File", // search_query + std::string(), // directory_resource_id test_util::CreateCopyResultCallback(&error, &resource_list)); message_loop_.RunUntilIdle(); @@ -239,9 +239,9 @@ TEST_F(FakeDriveServiceTest, GetResourceList_SearchWithAttribute) { scoped_ptr<ResourceList> resource_list; fake_service_.GetResourceList( GURL(), - 0, // start_changestamp + 0, // start_changestamp "title:1.txt", // search_query - "", // directory_resource_id + std::string(), // directory_resource_id test_util::CreateCopyResultCallback(&error, &resource_list)); message_loop_.RunUntilIdle(); @@ -261,9 +261,9 @@ TEST_F(FakeDriveServiceTest, GetResourceList_SearchMultipleQueries) { scoped_ptr<ResourceList> resource_list; fake_service_.GetResourceList( GURL(), - 0, // start_changestamp + 0, // start_changestamp "Directory 1", // search_query - "", // directory_resource_id + std::string(), // directory_resource_id test_util::CreateCopyResultCallback(&error, &resource_list)); message_loop_.RunUntilIdle(); @@ -274,9 +274,9 @@ TEST_F(FakeDriveServiceTest, GetResourceList_SearchMultipleQueries) { fake_service_.GetResourceList( GURL(), - 0, // start_changestamp + 0, // start_changestamp "\"Directory 1\"", // search_query - "", // directory_resource_id + std::string(), // directory_resource_id test_util::CreateCopyResultCallback(&error, &resource_list)); message_loop_.RunUntilIdle(); @@ -299,9 +299,9 @@ TEST_F(FakeDriveServiceTest, GetResourceList_NoNewEntries) { scoped_ptr<ResourceList> resource_list; fake_service_.GetResourceList( GURL(), - 654321 + 1, // start_changestamp - "", // search_query - "", // directory_resource_id + 654321 + 1, // start_changestamp + std::string(), // search_query + std::string(), // directory_resource_id test_util::CreateCopyResultCallback(&error, &resource_list)); message_loop_.RunUntilIdle(); @@ -331,9 +331,9 @@ TEST_F(FakeDriveServiceTest, GetResourceList_WithNewEntry) { scoped_ptr<ResourceList> resource_list; fake_service_.GetResourceList( GURL(), - 654321 + 1, // start_changestamp - "", // search_query - "", // directory_resource_id + 654321 + 1, // start_changestamp + std::string(), // search_query + std::string(), // directory_resource_id test_util::CreateCopyResultCallback(&error, &resource_list)); message_loop_.RunUntilIdle(); @@ -354,9 +354,9 @@ TEST_F(FakeDriveServiceTest, GetResourceList_Offline) { scoped_ptr<ResourceList> resource_list; fake_service_.GetResourceList( GURL(), - 0, // start_changestamp - "", // search_query - "", // directory_resource_id + 0, // start_changestamp + std::string(), // search_query + std::string(), // directory_resource_id test_util::CreateCopyResultCallback(&error, &resource_list)); message_loop_.RunUntilIdle(); @@ -845,7 +845,7 @@ TEST_F(FakeDriveServiceTest, DeleteResource_ExistingFile) { GDataErrorCode error = GDATA_OTHER_ERROR; fake_service_.DeleteResource("file:2_file_resource_id", - "", // etag + std::string(), // etag test_util::CreateCopyResultCallback(&error)); message_loop_.RunUntilIdle(); @@ -860,7 +860,7 @@ TEST_F(FakeDriveServiceTest, DeleteResource_NonexistingFile) { GDataErrorCode error = GDATA_OTHER_ERROR; fake_service_.DeleteResource("file:nonexisting_resource_id", - "", // etag + std::string(), // etag test_util::CreateCopyResultCallback(&error)); message_loop_.RunUntilIdle(); @@ -874,7 +874,7 @@ TEST_F(FakeDriveServiceTest, DeleteResource_Offline) { GDataErrorCode error = GDATA_OTHER_ERROR; fake_service_.DeleteResource("file:2_file_resource_id", - "", // etag + std::string(), // etag test_util::CreateCopyResultCallback(&error)); message_loop_.RunUntilIdle(); @@ -1506,7 +1506,7 @@ TEST_F(FakeDriveServiceTest, InitiateUploadExistingFile_Offline) { "test/foo", 13, "file:2_file_resource_id", - "", // etag + std::string(), // etag test_util::CreateCopyResultCallback(&error, &upload_location)); message_loop_.RunUntilIdle(); @@ -1525,7 +1525,7 @@ TEST_F(FakeDriveServiceTest, InitiateUploadExistingFile_NotFound) { "test/foo", 13, "non_existent", - "", // etag + std::string(), // etag test_util::CreateCopyResultCallback(&error, &upload_location)); message_loop_.RunUntilIdle(); diff --git a/chrome/browser/google_apis/gdata_wapi_operations_unittest.cc b/chrome/browser/google_apis/gdata_wapi_operations_unittest.cc index 1a15c62..7f2395d 100644 --- a/chrome/browser/google_apis/gdata_wapi_operations_unittest.cc +++ b/chrome/browser/google_apis/gdata_wapi_operations_unittest.cc @@ -325,10 +325,10 @@ TEST_F(GDataWapiOperationsTest, GetResourceListOperation_DefaultFeed) { &operation_registry_, request_context_getter_.get(), *url_generator_, - GURL(), // Pass an empty URL to use the default feed - 0, // start changestamp - "", // search string - "", // directory resource ID + GURL(), // Pass an empty URL to use the default feed + 0, // start changestamp + std::string(), // search string + std::string(), // directory resource ID CreateComposedCallback( base::Bind(&test_util::RunAndQuit), test_util::CreateCopyResultCallback(&result_code, &result_data))); @@ -360,9 +360,9 @@ TEST_F(GDataWapiOperationsTest, GetResourceListOperation_ValidFeed) { request_context_getter_.get(), *url_generator_, test_server_.GetURL("/files/chromeos/gdata/root_feed.json"), - 0, // start changestamp - "", // search string - "", // directory resource ID + 0, // start changestamp + std::string(), // search string + std::string(), // directory resource ID CreateComposedCallback( base::Bind(&test_util::RunAndQuit), test_util::CreateCopyResultCallback(&result_code, &result_data))); @@ -395,9 +395,9 @@ TEST_F(GDataWapiOperationsTest, GetResourceListOperation_InvalidFeed) { request_context_getter_.get(), *url_generator_, test_server_.GetURL("/files/chromeos/gdata/testfile.txt"), - 0, // start changestamp - "", // search string - "", // directory resource ID + 0, // start changestamp + std::string(), // search string + std::string(), // directory resource ID CreateComposedCallback( base::Bind(&test_util::RunAndQuit), test_util::CreateCopyResultCallback(&result_code, &result_data))); @@ -548,11 +548,10 @@ TEST_F(GDataWapiOperationsTest, DeleteResourceOperation) { &operation_registry_, request_context_getter_.get(), *url_generator_, - CreateComposedCallback( - base::Bind(&test_util::RunAndQuit), - test_util::CreateCopyResultCallback(&result_code)), + CreateComposedCallback(base::Bind(&test_util::RunAndQuit), + test_util::CreateCopyResultCallback(&result_code)), "file:2_file_resource_id", - ""); + std::string()); operation->Start(kTestGDataAuthToken, kTestUserAgent, base::Bind(&test_util::DoNothingForReAuthenticateCallback)); @@ -1135,7 +1134,7 @@ TEST_F(GDataWapiOperationsTest, UploadNewLargeFile) { // The test is almost identical to UploadNewFile. The only difference is the // expectation for the Content-Range header. TEST_F(GDataWapiOperationsTest, UploadNewEmptyFile) { - const std::string kUploadContent = ""; + const std::string kUploadContent; GDataErrorCode result_code = GDATA_OTHER_ERROR; GURL upload_url; @@ -1244,7 +1243,7 @@ TEST_F(GDataWapiOperationsTest, UploadExistingFile) { "text/plain", kUploadContent.size(), "file:foo", - "" /* etag */); + std::string() /* etag */); initiate_operation->Start( kTestGDataAuthToken, kTestUserAgent, diff --git a/chrome/browser/google_apis/gdata_wapi_parser_unittest.cc b/chrome/browser/google_apis/gdata_wapi_parser_unittest.cc index f85d325..d4fbba4 100644 --- a/chrome/browser/google_apis/gdata_wapi_parser_unittest.cc +++ b/chrome/browser/google_apis/gdata_wapi_parser_unittest.cc @@ -324,7 +324,7 @@ TEST(GDataWAPIParserTest, ResourceEntryHasDocumentExtension) { EXPECT_FALSE(ResourceEntry::HasHostedDocumentExtension( base::FilePath(FILE_PATH_LITERAL("Test")))); EXPECT_FALSE(ResourceEntry::HasHostedDocumentExtension( - base::FilePath(FILE_PATH_LITERAL("")))); + base::FilePath(FILE_PATH_LITERAL(std::string())))); } TEST(GDataWAPIParserTest, ResourceEntryClassifyEntryKind) { diff --git a/chrome/browser/google_apis/gdata_wapi_service.cc b/chrome/browser/google_apis/gdata_wapi_service.cc index 47edcf6..2649049 100644 --- a/chrome/browser/google_apis/gdata_wapi_service.cc +++ b/chrome/browser/google_apis/gdata_wapi_service.cc @@ -199,15 +199,14 @@ void GDataWapiService::GetAllResourceList( DCHECK(!callback.is_null()); runner_->StartOperationWithRetry( - new GetResourceListOperation( - operation_registry(), - url_request_context_getter_, - url_generator_, - GURL(), // No override url - 0, // start changestamp - "", // empty search query - "", // no directory resource id - callback)); + new GetResourceListOperation(operation_registry(), + url_request_context_getter_, + url_generator_, + GURL(), // No override url + 0, // start changestamp + std::string(), // empty search query + std::string(), // no directory resource id + callback)); } void GDataWapiService::GetResourceListInDirectory( @@ -218,15 +217,14 @@ void GDataWapiService::GetResourceListInDirectory( DCHECK(!callback.is_null()); runner_->StartOperationWithRetry( - new GetResourceListOperation( - operation_registry(), - url_request_context_getter_, - url_generator_, - GURL(), // No override url - 0, // start changestamp - "", // empty search query - directory_resource_id, - callback)); + new GetResourceListOperation(operation_registry(), + url_request_context_getter_, + url_generator_, + GURL(), // No override url + 0, // start changestamp + std::string(), // empty search query + directory_resource_id, + callback)); } void GDataWapiService::Search(const std::string& search_query, @@ -236,15 +234,14 @@ void GDataWapiService::Search(const std::string& search_query, DCHECK(!callback.is_null()); runner_->StartOperationWithRetry( - new GetResourceListOperation( - operation_registry(), - url_request_context_getter_, - url_generator_, - GURL(), // No override url - 0, // start changestamp - search_query, - "", // no directory resource id - callback)); + new GetResourceListOperation(operation_registry(), + url_request_context_getter_, + url_generator_, + GURL(), // No override url + 0, // start changestamp + search_query, + std::string(), // no directory resource id + callback)); } void GDataWapiService::SearchInDirectory( @@ -274,15 +271,14 @@ void GDataWapiService::GetChangeList(int64 start_changestamp, DCHECK(!callback.is_null()); runner_->StartOperationWithRetry( - new GetResourceListOperation( - operation_registry(), - url_request_context_getter_, - url_generator_, - GURL(), // No override url - start_changestamp, - "", // empty search query - "", // no directory resource id - callback)); + new GetResourceListOperation(operation_registry(), + url_request_context_getter_, + url_generator_, + GURL(), // No override url + start_changestamp, + std::string(), // empty search query + std::string(), // no directory resource id + callback)); } void GDataWapiService::ContinueGetResourceList( @@ -293,15 +289,14 @@ void GDataWapiService::ContinueGetResourceList( DCHECK(!callback.is_null()); runner_->StartOperationWithRetry( - new GetResourceListOperation( - operation_registry(), - url_request_context_getter_, - url_generator_, - override_url, - 0, // start changestamp - "", // empty search query - "", // no directory resource id - callback)); + new GetResourceListOperation(operation_registry(), + url_request_context_getter_, + url_generator_, + override_url, + 0, // start changestamp + std::string(), // empty search query + std::string(), // no directory resource id + callback)); } void GDataWapiService::GetResourceEntry( diff --git a/chrome/browser/google_apis/gdata_wapi_url_generator_unittest.cc b/chrome/browser/google_apis/gdata_wapi_url_generator_unittest.cc index 571a661..de80699 100644 --- a/chrome/browser/google_apis/gdata_wapi_url_generator_unittest.cc +++ b/chrome/browser/google_apis/gdata_wapi_url_generator_unittest.cc @@ -32,29 +32,29 @@ TEST_F(GDataWapiUrlGeneratorTest, AddInitiateUploadUrlParams) { } TEST_F(GDataWapiUrlGeneratorTest, AddFeedUrlParams) { - EXPECT_EQ("http://www.example.com/?v=3&alt=json&showroot=true&" - "showfolders=true" - "&include-shared=true" - "&max-results=100" - "&include-installed-apps=true", - GDataWapiUrlGenerator::AddFeedUrlParams( - GURL("http://www.example.com"), - 100, // num_items_to_fetch - 0, // changestamp - "" // search_string - ).spec()); - EXPECT_EQ("http://www.example.com/?v=3&alt=json&showroot=true&" - "showfolders=true" - "&include-shared=true" - "&max-results=100" - "&include-installed-apps=true" - "&start-index=123", - GDataWapiUrlGenerator::AddFeedUrlParams( - GURL("http://www.example.com"), - 100, // num_items_to_fetch - 123, // changestamp - "" // search_string - ).spec()); + EXPECT_EQ( + "http://www.example.com/?v=3&alt=json&showroot=true&" + "showfolders=true" + "&include-shared=true" + "&max-results=100" + "&include-installed-apps=true", + GDataWapiUrlGenerator::AddFeedUrlParams(GURL("http://www.example.com"), + 100, // num_items_to_fetch + 0, // changestamp + std::string() // search_string + ).spec()); + EXPECT_EQ( + "http://www.example.com/?v=3&alt=json&showroot=true&" + "showfolders=true" + "&include-shared=true" + "&max-results=100" + "&include-installed-apps=true" + "&start-index=123", + GDataWapiUrlGenerator::AddFeedUrlParams(GURL("http://www.example.com"), + 100, // num_items_to_fetch + 123, // changestamp + std::string() // search_string + ).spec()); EXPECT_EQ("http://www.example.com/?v=3&alt=json&showroot=true&" "showfolders=true" "&include-shared=true" @@ -72,53 +72,52 @@ TEST_F(GDataWapiUrlGeneratorTest, AddFeedUrlParams) { TEST_F(GDataWapiUrlGeneratorTest, GenerateResourceListUrl) { // This is the very basic URL for the GetResourceList operation. - EXPECT_EQ( - "https://docs.google.com/feeds/default/private/full" - "?v=3&alt=json&showroot=true&showfolders=true&include-shared=true" - "&max-results=500&include-installed-apps=true", - url_generator_.GenerateResourceListUrl(GURL(), // override_url, - 0, // start_changestamp, - "", // search_string, - "" // directory resource ID - ).spec()); + EXPECT_EQ("https://docs.google.com/feeds/default/private/full" + "?v=3&alt=json&showroot=true&showfolders=true&include-shared=true" + "&max-results=500&include-installed-apps=true", + url_generator_.GenerateResourceListUrl( + GURL(), // override_url, + 0, // start_changestamp, + std::string(), // search_string, + std::string() // directory resource ID + ).spec()); // With an override URL provided, the base URL is changed, but the default // parameters remain as-is. - EXPECT_EQ( - "http://localhost/" - "?v=3&alt=json&showroot=true&showfolders=true&include-shared=true" - "&max-results=500&include-installed-apps=true", - url_generator_.GenerateResourceListUrl( - GURL("http://localhost/"), // override_url, - 0, // start_changestamp, - "", // search_string, - "" // directory resource ID - ).spec()); + EXPECT_EQ("http://localhost/" + "?v=3&alt=json&showroot=true&showfolders=true&include-shared=true" + "&max-results=500&include-installed-apps=true", + url_generator_.GenerateResourceListUrl( + GURL("http://localhost/"), // override_url, + 0, // start_changestamp, + std::string(), // search_string, + std::string() // directory resource ID + ).spec()); // With a non-zero start_changestamp provided, the base URL is changed from // "full" to "changes", and "start-index" parameter is added. - EXPECT_EQ( - "https://docs.google.com/feeds/default/private/changes" - "?v=3&alt=json&showroot=true&showfolders=true&include-shared=true" - "&max-results=500&include-installed-apps=true" - "&start-index=100", - url_generator_.GenerateResourceListUrl(GURL(), // override_url, - 100, // start_changestamp, - "", // search_string, - "" // directory resource ID - ).spec()); + EXPECT_EQ("https://docs.google.com/feeds/default/private/changes" + "?v=3&alt=json&showroot=true&showfolders=true&include-shared=true" + "&max-results=500&include-installed-apps=true" + "&start-index=100", + url_generator_.GenerateResourceListUrl( + GURL(), // override_url, + 100, // start_changestamp, + std::string(), // search_string, + std::string() // directory resource ID + ).spec()); // With a non-empty search string provided, "max-results" value is changed, // and "q" parameter is added. - EXPECT_EQ( - "https://docs.google.com/feeds/default/private/full" - "?v=3&alt=json&showroot=true&showfolders=true&include-shared=true" - "&max-results=50&include-installed-apps=true&q=foo", - url_generator_.GenerateResourceListUrl(GURL(), // override_url, - 0, // start_changestamp, - "foo", // search_string, - "" // directory resource ID - ).spec()); + EXPECT_EQ("https://docs.google.com/feeds/default/private/full" + "?v=3&alt=json&showroot=true&showfolders=true&include-shared=true" + "&max-results=50&include-installed-apps=true&q=foo", + url_generator_.GenerateResourceListUrl( + GURL(), // override_url, + 0, // start_changestamp, + "foo", // search_string, + std::string() // directory resource ID + ).spec()); // With a non-empty directory resource ID provided, the base URL is // changed, but the default parameters remain. @@ -127,24 +126,23 @@ TEST_F(GDataWapiUrlGeneratorTest, GenerateResourceListUrl) { "?v=3&alt=json&showroot=true&showfolders=true&include-shared=true" "&max-results=500&include-installed-apps=true", url_generator_.GenerateResourceListUrl(GURL(), // override_url, - 0, // start_changestamp, - "", // search_string, + 0, // start_changestamp, + std::string(), // search_string, "XXX" // directory resource ID ).spec()); // With a non-empty override_url provided, the base URL is changed, but // the default parameters remain. Note that start-index should not be // overridden. - EXPECT_EQ( - "http://example.com/" - "?start-index=123&v=3&alt=json&showroot=true&showfolders=true" - "&include-shared=true&max-results=500&include-installed-apps=true", - url_generator_.GenerateResourceListUrl( - GURL("http://example.com/?start-index=123"), // override_url, - 100, // start_changestamp, - "", // search_string, - "XXX" // directory resource ID - ).spec()); + EXPECT_EQ("http://example.com/" + "?start-index=123&v=3&alt=json&showroot=true&showfolders=true" + "&include-shared=true&max-results=500&include-installed-apps=true", + url_generator_.GenerateResourceListUrl( + GURL("http://example.com/?start-index=123"), // override_url, + 100, // start_changestamp, + std::string(), // search_string, + "XXX" // directory resource ID + ).spec()); } TEST_F(GDataWapiUrlGeneratorTest, GenerateEditUrl) { diff --git a/chrome/browser/google_apis/operation_util_unittest.cc b/chrome/browser/google_apis/operation_util_unittest.cc index 8a8ffe4..14e4c5dd 100644 --- a/chrome/browser/google_apis/operation_util_unittest.cc +++ b/chrome/browser/google_apis/operation_util_unittest.cc @@ -11,7 +11,7 @@ namespace util { TEST(GenerateIfMatchHeaderTest, GenerateIfMatchHeader) { // The header matched to all etag should be returned for empty etag. - EXPECT_EQ("If-Match: *", GenerateIfMatchHeader("")); + EXPECT_EQ("If-Match: *", GenerateIfMatchHeader(std::string())); // Otherwise, the returned header should be matched to the given etag. EXPECT_EQ("If-Match: abcde", GenerateIfMatchHeader("abcde")); diff --git a/chrome/browser/google_apis/test_server/http_server_unittest.cc b/chrome/browser/google_apis/test_server/http_server_unittest.cc index e242098..d837baf 100644 --- a/chrome/browser/google_apis/test_server/http_server_unittest.cc +++ b/chrome/browser/google_apis/test_server/http_server_unittest.cc @@ -38,7 +38,7 @@ std::string GetContentTypeFromFetcher(const net::URLFetcher& fetcher) { if (headers->GetMimeType(&content_type)) return content_type; } - return ""; + return std::string(); } } // namespace diff --git a/chrome/browser/history/history_querying_unittest.cc b/chrome/browser/history/history_querying_unittest.cc index c1355dd..ed138e8 100644 --- a/chrome/browser/history/history_querying_unittest.cc +++ b/chrome/browser/history/history_querying_unittest.cc @@ -468,7 +468,7 @@ TEST_F(HistoryQueryTest, Paging) { // Since results are fetched 1 and 2 at a time, entry #0 and #6 will not // be de-duplicated. int expected_results[] = { 4, 2, 3, 1, 7, 6, 5, 0 }; - TestPaging("", expected_results, arraysize(expected_results)); + TestPaging(std::string(), expected_results, arraysize(expected_results)); } TEST_F(HistoryQueryTest, FTSPaging) { diff --git a/chrome/browser/history/history_tab_helper.cc b/chrome/browser/history/history_tab_helper.cc index a984557..5438b97 100644 --- a/chrome/browser/history/history_tab_helper.cc +++ b/chrome/browser/history/history_tab_helper.cc @@ -53,7 +53,8 @@ void HistoryTabHelper::UpdateHistoryForNavigation( void HistoryTabHelper::UpdateHistoryPageTitle(const NavigationEntry& entry) { HistoryService* hs = GetHistoryService(); if (hs) - hs->SetPageTitle(entry.GetVirtualURL(), entry.GetTitleForDisplay("")); + hs->SetPageTitle(entry.GetVirtualURL(), + entry.GetTitleForDisplay(std::string())); } history::HistoryAddPageArgs diff --git a/chrome/browser/history/history_unittest.cc b/chrome/browser/history/history_unittest.cc index e465a80..c988e55 100644 --- a/chrome/browser/history/history_unittest.cc +++ b/chrome/browser/history/history_unittest.cc @@ -164,20 +164,19 @@ class HistoryBackendDBTest : public HistoryUnitTestBase { std::vector<GURL> url_chain; url_chain.push_back(GURL("foo-url")); - DownloadRow download( - base::FilePath(FILE_PATH_LITERAL("foo-path")), - base::FilePath(FILE_PATH_LITERAL("foo-path")), - url_chain, - GURL(""), - time, - time, - 0, - 512, - state, - content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, - content::DOWNLOAD_INTERRUPT_REASON_NONE, - 0, - 0); + DownloadRow download(base::FilePath(FILE_PATH_LITERAL("foo-path")), + base::FilePath(FILE_PATH_LITERAL("foo-path")), + url_chain, + GURL(std::string()), + time, + time, + 0, + 512, + state, + content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, + content::DOWNLOAD_INTERRUPT_REASON_NONE, + 0, + 0); return db_->CreateDownload(download); } @@ -317,7 +316,7 @@ TEST_F(HistoryBackendDBTest, MigrateDownloadsReasonPathsAndDangerType) { int64 db_handle = 0; // Null path. s.BindInt64(0, ++db_handle); - s.BindString(1, ""); + s.BindString(1, std::string()); s.BindString(2, "http://whatever.com/index.html"); s.BindInt64(3, now.ToTimeT()); s.BindInt64(4, 100); @@ -464,20 +463,19 @@ TEST_F(HistoryBackendDBTest, DownloadNukeRecordsMissingURLs) { CreateBackendAndDatabase(); base::Time now(base::Time::Now()); std::vector<GURL> url_chain; - DownloadRow download( - base::FilePath(FILE_PATH_LITERAL("foo-path")), - base::FilePath(FILE_PATH_LITERAL("foo-path")), - url_chain, - GURL(""), - now, - now, - 0, - 512, - DownloadItem::COMPLETE, - content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, - content::DOWNLOAD_INTERRUPT_REASON_NONE, - 0, - 0); + DownloadRow download(base::FilePath(FILE_PATH_LITERAL("foo-path")), + base::FilePath(FILE_PATH_LITERAL("foo-path")), + url_chain, + GURL(std::string()), + now, + now, + 0, + 512, + DownloadItem::COMPLETE, + content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, + content::DOWNLOAD_INTERRUPT_REASON_NONE, + 0, + 0); // Creating records without any urls should fail. EXPECT_EQ(DownloadDatabase::kUninitializedHandle, diff --git a/chrome/browser/history/thumbnail_database_unittest.cc b/chrome/browser/history/thumbnail_database_unittest.cc index fc92feb..de3bd33 100644 --- a/chrome/browser/history/thumbnail_database_unittest.cc +++ b/chrome/browser/history/thumbnail_database_unittest.cc @@ -414,7 +414,7 @@ TEST_F(ThumbnailDatabaseTest, UpgradeToVersion6) { EXPECT_EQ(url, GURL(statement.ColumnString(1))); EXPECT_EQ(TOUCH_ICON, statement.ColumnInt(2)); // Any previous data in sizes should be cleared. - EXPECT_EQ(std::string(""), statement.ColumnString(3)); + EXPECT_EQ(std::string(), statement.ColumnString(3)); statement.Assign(db.db_.GetCachedStatement(SQL_FROM_HERE, "SELECT icon_id, last_updated, image_data, width, height " @@ -854,7 +854,7 @@ TEST_F(ThumbnailDatabaseTest, FaviconSizesToAndFromString) { // Valid input. FaviconSizes sizes_empty; - ThumbnailDatabase::DatabaseStringToFaviconSizes("", &sizes_empty); + ThumbnailDatabase::DatabaseStringToFaviconSizes(std::string(), &sizes_empty); EXPECT_EQ(0u, sizes_empty.size()); FaviconSizes sizes_valid; diff --git a/chrome/browser/importer/firefox_importer_utils.cc b/chrome/browser/importer/firefox_importer_utils.cc index 0535cf6..8ffe8f2 100644 --- a/chrome/browser/importer/firefox_importer_utils.cc +++ b/chrome/browser/importer/firefox_importer_utils.cc @@ -255,12 +255,12 @@ std::string ReadBrowserConfigProp(const base::FilePath& app_path, const std::string& pref_key) { std::string content; if (!ReadPrefFile(app_path.AppendASCII("browserconfig.properties"), &content)) - return ""; + return std::string(); // This file has the syntax: key=value. size_t prop_index = content.find(pref_key + "="); if (prop_index == std::string::npos) - return ""; + return std::string(); size_t start = prop_index + pref_key.length(); size_t stop = std::string::npos; @@ -270,7 +270,7 @@ std::string ReadBrowserConfigProp(const base::FilePath& app_path, if (start == std::string::npos || stop == std::string::npos || (start == stop)) { LOG(WARNING) << "Firefox property " << pref_key << " could not be parsed."; - return ""; + return std::string(); } return content.substr(start + 1, stop - start - 1); @@ -280,7 +280,7 @@ std::string ReadPrefsJsValue(const base::FilePath& profile_path, const std::string& pref_key) { std::string content; if (!ReadPrefFile(profile_path.AppendASCII("prefs.js"), &content)) - return ""; + return std::string(); return GetPrefsJsValue(content, pref_key); } @@ -411,7 +411,7 @@ std::string GetPrefsJsValue(const std::string& content, if (start == std::string::npos || stop == std::string::npos || stop < start) { LOG(WARNING) << "Firefox property " << pref_key << " could not be parsed."; - return ""; + return std::string(); } // String values have double quotes we don't need to return to the caller. diff --git a/chrome/browser/internal_auth_unittest.cc b/chrome/browser/internal_auth_unittest.cc index 42080cd..da8954e 100644 --- a/chrome/browser/internal_auth_unittest.cc +++ b/chrome/browser/internal_auth_unittest.cc @@ -69,9 +69,10 @@ TEST_F(InternalAuthTest, BadGeneration) { token, long_string_, map)); // Trying empty domain. - token = InternalAuthGeneration::GeneratePassport("", map); + token = InternalAuthGeneration::GeneratePassport(std::string(), map); ASSERT_TRUE(token.empty()); - ASSERT_FALSE(InternalAuthVerification::VerifyPassport(token, "", map)); + ASSERT_FALSE( + InternalAuthVerification::VerifyPassport(token, std::string(), map)); std::string dummy("abcdefghij"); for (size_t i = 1000; i--;) { @@ -87,7 +88,7 @@ TEST_F(InternalAuthTest, BadGeneration) { ASSERT_FALSE(InternalAuthVerification::VerifyPassport(token, "zapata", map)); map.clear(); - map[""] = "value"; + map[std::string()] = "value"; // Trying empty key. token = InternalAuthGeneration::GeneratePassport("zapata", map); ASSERT_TRUE(token.empty()); diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc index 76d5df7..b0c5010 100644 --- a/chrome/browser/io_thread.cc +++ b/chrome/browser/io_thread.cc @@ -691,8 +691,10 @@ void IOThread::EnableSpdy(const std::string& mode) { const std::string& element = *it; std::vector<std::string> name_value; base::SplitString(element, '=', &name_value); - const std::string& option = name_value.size() > 0 ? name_value[0] : ""; - const std::string value = name_value.size() > 1 ? name_value[1] : ""; + const std::string& option = + name_value.size() > 0 ? name_value[0] : std::string(); + const std::string value = + name_value.size() > 1 ? name_value[1] : std::string(); if (option == kOff) { net::HttpStreamFactory::set_spdy_enabled(false); @@ -739,10 +741,11 @@ void IOThread::RegisterPrefs(PrefRegistrySimple* registry) { "spdyproxy"); registry->RegisterBooleanPref(prefs::kDisableAuthNegotiateCnameLookup, false); registry->RegisterBooleanPref(prefs::kEnableAuthNegotiatePort, false); - registry->RegisterStringPref(prefs::kAuthServerWhitelist, ""); - registry->RegisterStringPref(prefs::kAuthNegotiateDelegateWhitelist, ""); - registry->RegisterStringPref(prefs::kGSSAPILibraryName, ""); - registry->RegisterStringPref(prefs::kSpdyProxyAuthOrigin, ""); + registry->RegisterStringPref(prefs::kAuthServerWhitelist, std::string()); + registry->RegisterStringPref(prefs::kAuthNegotiateDelegateWhitelist, + std::string()); + registry->RegisterStringPref(prefs::kGSSAPILibraryName, std::string()); + registry->RegisterStringPref(prefs::kSpdyProxyAuthOrigin, std::string()); registry->RegisterBooleanPref(prefs::kEnableReferrers, true); registry->RegisterInt64Pref(prefs::kHttpReceivedContentLength, 0); registry->RegisterInt64Pref(prefs::kHttpOriginalContentLength, 0); diff --git a/chrome/browser/language_usage_metrics_unittest.cc b/chrome/browser/language_usage_metrics_unittest.cc index db6e987..e007e70 100644 --- a/chrome/browser/language_usage_metrics_unittest.cc +++ b/chrome/browser/language_usage_metrics_unittest.cc @@ -16,7 +16,7 @@ TEST(LanguageUsageMetricsTest, ParseAcceptLanguages) { EXPECT_EQ(JAPANESE, *language_set.begin()); // Empty language. - LanguageUsageMetrics::ParseAcceptLanguages("", &language_set); + LanguageUsageMetrics::ParseAcceptLanguages(std::string(), &language_set); EXPECT_EQ(0U, language_set.size()); // Country code is ignored. @@ -86,6 +86,6 @@ TEST(LanguageUsageMetricsTest, ToLanguage) { EXPECT_EQ(JAPANESE, LanguageUsageMetrics::ToLanguage("ja-JP")); // Invalid locales are considered as unknown language. - EXPECT_EQ(UNKNOWN_LANGUAGE, LanguageUsageMetrics::ToLanguage("")); + EXPECT_EQ(UNKNOWN_LANGUAGE, LanguageUsageMetrics::ToLanguage(std::string())); EXPECT_EQ(UNKNOWN_LANGUAGE, LanguageUsageMetrics::ToLanguage("xx")); } diff --git a/chrome/browser/logging_chrome_browsertest.cc b/chrome/browser/logging_chrome_browsertest.cc index 9728fd3..df32456 100644 --- a/chrome/browser/logging_chrome_browsertest.cc +++ b/chrome/browser/logging_chrome_browsertest.cc @@ -44,7 +44,7 @@ class ChromeLoggingTest : public testing::Test { // Tests the log file name getter without an environment variable. TEST_F(ChromeLoggingTest, LogFileName) { - SaveEnvironmentVariable(""); + SaveEnvironmentVariable(std::string()); base::FilePath filename = logging::GetLogFileName(); ASSERT_NE(base::FilePath::StringType::npos, diff --git a/chrome/browser/managed_mode/managed_user_service.cc b/chrome/browser/managed_mode/managed_user_service.cc index 0cc29f5..80b2bc8 100644 --- a/chrome/browser/managed_mode/managed_user_service.cc +++ b/chrome/browser/managed_mode/managed_user_service.cc @@ -154,10 +154,10 @@ void ManagedUserService::RegisterUserPrefs(PrefRegistrySyncable* registry) { ManagedModeURLFilter::BLOCK, PrefRegistrySyncable::UNSYNCABLE_PREF); registry->RegisterStringPref(prefs::kManagedModeLocalPassphrase, - "", + std::string(), PrefRegistrySyncable::UNSYNCABLE_PREF); registry->RegisterStringPref(prefs::kManagedModeLocalSalt, - "", + std::string(), PrefRegistrySyncable::UNSYNCABLE_PREF); } @@ -203,7 +203,7 @@ bool ManagedUserService::UserMayLoad(const extensions::Extension* extension, string16* error) const { string16 tmp_error; // |extension| can be NULL in unit tests. - if (ExtensionManagementPolicyImpl(extension ? extension->id() : "", + if (ExtensionManagementPolicyImpl(extension ? extension->id() : std::string(), &tmp_error)) return true; @@ -244,7 +244,8 @@ bool ManagedUserService::UserMayModifySettings( const extensions::Extension* extension, string16* error) const { // |extension| can be NULL in unit tests. - return ExtensionManagementPolicyImpl(extension ? extension->id() : "", error); + return ExtensionManagementPolicyImpl( + extension ? extension->id() : std::string(), error); } void ManagedUserService::Observe(int type, diff --git a/chrome/browser/media/media_stream_devices_controller.cc b/chrome/browser/media/media_stream_devices_controller.cc index c83e74d..2d844a4 100644 --- a/chrome/browser/media/media_stream_devices_controller.cc +++ b/chrome/browser/media/media_stream_devices_controller.cc @@ -279,11 +279,11 @@ void MediaStreamDevicesController::HandleTabMediaRequest() { if (request_.audio_type == content::MEDIA_TAB_AUDIO_CAPTURE) { devices.push_back(content::MediaStreamDevice( - content::MEDIA_TAB_AUDIO_CAPTURE, "", "")); + content::MEDIA_TAB_AUDIO_CAPTURE, std::string(), std::string())); } if (request_.video_type == content::MEDIA_TAB_VIDEO_CAPTURE) { devices.push_back(content::MediaStreamDevice( - content::MEDIA_TAB_VIDEO_CAPTURE, "", "")); + content::MEDIA_TAB_VIDEO_CAPTURE, std::string(), std::string())); } callback_.Run(devices); diff --git a/chrome/browser/media_galleries/media_galleries_dialog_controller.cc b/chrome/browser/media_galleries/media_galleries_dialog_controller.cc index 98ba8da..27b8765 100644 --- a/chrome/browser/media_galleries/media_galleries_dialog_controller.cc +++ b/chrome/browser/media_galleries/media_galleries_dialog_controller.cc @@ -147,7 +147,7 @@ string16 MediaGalleriesDialogController::GetHeader() const { } string16 MediaGalleriesDialogController::GetSubtext() const { - std::string extension_name(extension_ ? extension_->name() : ""); + std::string extension_name(extension_ ? extension_->name() : std::string()); return l10n_util::GetStringFUTF16(IDS_MEDIA_GALLERIES_DIALOG_SUBTEXT, UTF8ToUTF16(extension_name)); } @@ -184,7 +184,9 @@ void MediaGalleriesDialogController::OnAddFolderClicked() { ui::SelectFileDialog::SELECT_FOLDER, l10n_util::GetStringUTF16(IDS_MEDIA_GALLERIES_DIALOG_ADD_GALLERY_TITLE), user_data_dir, - NULL, 0, FILE_PATH_LITERAL(""), + NULL, + 0, + FILE_PATH_LITERAL(std::string()), web_contents_->GetView()->GetTopLevelNativeWindow(), NULL); } diff --git a/chrome/browser/media_galleries/media_galleries_preferences.cc b/chrome/browser/media_galleries/media_galleries_preferences.cc index 78316ef..48689ee 100644 --- a/chrome/browser/media_galleries/media_galleries_preferences.cc +++ b/chrome/browser/media_galleries/media_galleries_preferences.cc @@ -258,7 +258,7 @@ void MediaGalleriesPreferences::InitFromPrefs(bool notify_observers) { } } if (notify_observers) - NotifyChangeObservers(""); + NotifyChangeObservers(std::string()); } void MediaGalleriesPreferences::NotifyChangeObservers( diff --git a/chrome/browser/metrics/metrics_log.cc b/chrome/browser/metrics/metrics_log.cc index 72fff96..ec39326 100644 --- a/chrome/browser/metrics/metrics_log.cc +++ b/chrome/browser/metrics/metrics_log.cc @@ -969,7 +969,7 @@ void MetricsLog::RecordOmniboxOpenedURL(const AutocompleteLog& log) { // Write the XML version. OPEN_ELEMENT_FOR_SCOPE("uielement"); WriteAttribute("action", "autocomplete"); - WriteAttribute("targetidhash", ""); + WriteAttribute("targetidhash", std::string()); // TODO(kochi): Properly track windows. WriteIntAttribute("window", 0); if (log.tab_id != -1) { diff --git a/chrome/browser/metrics/metrics_service.cc b/chrome/browser/metrics/metrics_service.cc index e68d7bf..c25c8e6 100644 --- a/chrome/browser/metrics/metrics_service.cc +++ b/chrome/browser/metrics/metrics_service.cc @@ -391,13 +391,13 @@ class MetricsMemoryDetails : public MemoryDetails { // static void MetricsService::RegisterPrefs(PrefRegistrySimple* registry) { DCHECK(IsSingleThreaded()); - registry->RegisterStringPref(prefs::kMetricsClientID, ""); + registry->RegisterStringPref(prefs::kMetricsClientID, std::string()); registry->RegisterIntegerPref(prefs::kMetricsLowEntropySource, kLowEntropySourceNotSet); registry->RegisterInt64Pref(prefs::kMetricsClientIDTimestamp, 0); registry->RegisterInt64Pref(prefs::kStabilityLaunchTimeSec, 0); registry->RegisterInt64Pref(prefs::kStabilityLastTimestampSec, 0); - registry->RegisterStringPref(prefs::kStabilityStatsVersion, ""); + registry->RegisterStringPref(prefs::kStabilityStatsVersion, std::string()); registry->RegisterInt64Pref(prefs::kStabilityStatsBuildTime, 0); registry->RegisterBooleanPref(prefs::kStabilityExitedCleanly, true); registry->RegisterBooleanPref(prefs::kStabilitySessionEndCompleted, true); diff --git a/chrome/browser/nacl_host/pnacl_file_host_unittest.cc b/chrome/browser/nacl_host/pnacl_file_host_unittest.cc index eb2a74a..6e30c29 100644 --- a/chrome/browser/nacl_host/pnacl_file_host_unittest.cc +++ b/chrome/browser/nacl_host/pnacl_file_host_unittest.cc @@ -57,7 +57,7 @@ TEST(PnaclFileHostTest, TestFilenamesWithPnaclPath) { &out_path)); // Other bad files. - EXPECT_FALSE(PnaclCanOpenFile("", &out_path)); + EXPECT_FALSE(PnaclCanOpenFile(std::string(), &out_path)); EXPECT_FALSE(PnaclCanOpenFile(".", &out_path)); EXPECT_FALSE(PnaclCanOpenFile("..", &out_path)); #if defined(OS_WIN) diff --git a/chrome/browser/net/chrome_fraudulent_certificate_reporter_unittest.cc b/chrome/browser/net/chrome_fraudulent_certificate_reporter_unittest.cc index 4326fb9..f1d1714 100644 --- a/chrome/browser/net/chrome_fraudulent_certificate_reporter_unittest.cc +++ b/chrome/browser/net/chrome_fraudulent_certificate_reporter_unittest.cc @@ -123,8 +123,7 @@ class NotSendingTestReporter : public TestReporter { class MockURLRequest : public net::URLRequest { public: explicit MockURLRequest(net::URLRequestContext* context) - : net::URLRequest(GURL(""), NULL, context) { - } + : net::URLRequest(GURL(std::string()), NULL, context) {} private: }; diff --git a/chrome/browser/net/chrome_network_delegate_unittest.cc b/chrome/browser/net/chrome_network_delegate_unittest.cc index f822195..b5c8151 100644 --- a/chrome/browser/net/chrome_network_delegate_unittest.cc +++ b/chrome/browser/net/chrome_network_delegate_unittest.cc @@ -234,7 +234,7 @@ TEST_F(ChromeNetworkDelegateSafeSearchTest, SafeSearchOn) { "q=goog&" + kBothParameters); // Test that another website is not affected, without parameters. - CheckAddedParameters("http://google.com/finance", ""); + CheckAddedParameters("http://google.com/finance", std::string()); // Test that another website is not affected, with parameters. CheckAddedParameters("http://google.com/finance?q=goog", "q=goog"); @@ -255,10 +255,10 @@ TEST_F(ChromeNetworkDelegateSafeSearchTest, SafeSearchOff) { SetDelegate(delegate.get()); // Test the home page. - CheckAddedParameters("http://google.com/", ""); + CheckAddedParameters("http://google.com/", std::string()); // Test the search home page. - CheckAddedParameters("http://google.com/webhp", ""); + CheckAddedParameters("http://google.com/webhp", std::string()); // Test the home page with parameters. CheckAddedParameters("http://google.com/search?q=google", diff --git a/chrome/browser/net/dns_probe_job_unittest.cc b/chrome/browser/net/dns_probe_job_unittest.cc index 06d6965..1fe8766 100644 --- a/chrome/browser/net/dns_probe_job_unittest.cc +++ b/chrome/browser/net/dns_probe_job_unittest.cc @@ -54,7 +54,7 @@ void DnsProbeJobTest::RunProbe(MockDnsClientRule::Result good_result, const uint16 kTypeA = net::dns_protocol::kTypeA; MockDnsClientRuleList rules; rules.push_back(MockDnsClientRule("google.com", kTypeA, good_result)); - rules.push_back(MockDnsClientRule("", kTypeA, bad_result)); + rules.push_back(MockDnsClientRule(std::string(), kTypeA, bad_result)); scoped_ptr<DnsClient> dns_client = CreateMockDnsClient(config, rules); dns_client->SetConfig(config); diff --git a/chrome/browser/net/http_pipelining_compatibility_client_unittest.cc b/chrome/browser/net/http_pipelining_compatibility_client_unittest.cc index 7f33790..f582d1b 100644 --- a/chrome/browser/net/http_pipelining_compatibility_client_unittest.cc +++ b/chrome/browser/net/http_pipelining_compatibility_client_unittest.cc @@ -118,8 +118,10 @@ class HttpPipeliningCompatibilityClientTest : public testing::Test { HttpPipeliningCompatibilityClient::Options options) { HttpPipeliningCompatibilityClient client(NULL); net::TestCompletionCallback callback; - client.Start(test_server_.GetURL("").spec(), - requests, options, callback.callback(), + client.Start(test_server_.GetURL(std::string()).spec(), + requests, + options, + callback.callback(), context_->GetURLRequestContext()); callback.WaitForResult(); } diff --git a/chrome/browser/net/pref_proxy_config_tracker_impl_unittest.cc b/chrome/browser/net/pref_proxy_config_tracker_impl_unittest.cc index 3ab5d69..c69fc93 100644 --- a/chrome/browser/net/pref_proxy_config_tracker_impl_unittest.cc +++ b/chrome/browser/net/pref_proxy_config_tracker_impl_unittest.cc @@ -135,9 +135,9 @@ TEST_F(PrefProxyConfigTrackerImplTest, BaseConfiguration) { } TEST_F(PrefProxyConfigTrackerImplTest, DynamicPrefOverrides) { - pref_service_->SetManagedPref( - prefs::kProxy, - ProxyConfigDictionary::CreateFixedServers("http://example.com:3128", "")); + pref_service_->SetManagedPref(prefs::kProxy, + ProxyConfigDictionary::CreateFixedServers( + "http://example.com:3128", std::string())); loop_.RunUntilIdle(); net::ProxyConfig actual_config; diff --git a/chrome/browser/net/url_info.cc b/chrome/browser/net/url_info.cc index ddba658..1046827 100644 --- a/chrome/browser/net/url_info.cc +++ b/chrome/browser/net/url_info.cc @@ -361,7 +361,7 @@ std::string UrlInfo::GetAsciiMotivation() const { return RemoveJs(referring_url_.spec()); default: - return ""; + return std::string(); } } diff --git a/chrome/browser/page_cycler/page_cycler.cc b/chrome/browser/page_cycler/page_cycler.cc index 04086d2..b78e1fe 100644 --- a/chrome/browser/page_cycler/page_cycler.cc +++ b/chrome/browser/page_cycler/page_cycler.cc @@ -192,10 +192,12 @@ void PageCycler::PrepareResultsOnBackgroundThread() { base::ProcessId pid = base::GetCurrentProcId(); #endif // OS_WIN ChromeProcessList chrome_processes(GetRunningChromeProcesses(pid)); - output += perf_test::MemoryUsageInfoToString("", chrome_processes, pid); - output += perf_test::IOPerfInfoToString("", chrome_processes, pid); - output += perf_test::SystemCommitChargeToString("", - base::GetSystemCommitCharge(), false); + output += perf_test::MemoryUsageInfoToString( + std::string(), chrome_processes, pid); + output += + perf_test::IOPerfInfoToString(std::string(), chrome_processes, pid); + output += perf_test::SystemCommitChargeToString( + std::string(), base::GetSystemCommitCharge(), false); output.append("Pages: [" + urls_string_ + "]\n"); output.append("*RESULT times: t_ref= [" + timings_string_ + "] ms\n"); } diff --git a/chrome/browser/password_manager/native_backend_kwallet_x.cc b/chrome/browser/password_manager/native_backend_kwallet_x.cc index 74d6bb9..9c6003d 100644 --- a/chrome/browser/password_manager/native_backend_kwallet_x.cc +++ b/chrome/browser/password_manager/native_backend_kwallet_x.cc @@ -186,7 +186,7 @@ bool NativeBackendKWallet::StartKWalletd() { builder.AppendString("kwalletd"); // serviceName builder.AppendArrayOfStrings(empty); // urls builder.AppendArrayOfStrings(empty); // envs - builder.AppendString(""); // startup_id + builder.AppendString(std::string()); // startup_id builder.AppendBool(false); // blind scoped_ptr<dbus::Response> response( klauncher->CallMethodAndBlock( diff --git a/chrome/browser/password_manager/native_backend_kwallet_x_unittest.cc b/chrome/browser/password_manager/native_backend_kwallet_x_unittest.cc index ad00e11..11af55a 100644 --- a/chrome/browser/password_manager/native_backend_kwallet_x_unittest.cc +++ b/chrome/browser/password_manager/native_backend_kwallet_x_unittest.cc @@ -315,7 +315,7 @@ dbus::Response* NativeBackendKWalletTest::KLauncherMethodCall( scoped_ptr<dbus::Response> response(dbus::Response::CreateEmpty()); dbus::MessageWriter writer(response.get()); writer.AppendInt32(klauncher_ret_); - writer.AppendString(""); // dbus_name + writer.AppendString(std::string()); // dbus_name writer.AppendString(klauncher_error_); writer.AppendInt32(1234); // pid return response.release(); diff --git a/chrome/browser/plugins/plugin_finder.cc b/chrome/browser/plugins/plugin_finder.cc index 32ad157..0070387 100644 --- a/chrome/browser/plugins/plugin_finder.cc +++ b/chrome/browser/plugins/plugin_finder.cc @@ -292,9 +292,11 @@ scoped_ptr<PluginMetadata> PluginFinder::GetPluginMetadata( std::string identifier = GetIdentifier(plugin); PluginMetadata* metadata = new PluginMetadata(identifier, GetGroupName(plugin), - false, GURL(), GURL(), + false, + GURL(), + GURL(), plugin.name, - ""); + std::string()); for (size_t i = 0; i < plugin.mime_types.size(); ++i) metadata->AddMatchingMimeType(plugin.mime_types[i].mime_type); diff --git a/chrome/browser/plugins/plugin_metadata_unittest.cc b/chrome/browser/plugins/plugin_metadata_unittest.cc index 3e3bf99..b542b1b 100644 --- a/chrome/browser/plugins/plugin_metadata_unittest.cc +++ b/chrome/browser/plugins/plugin_metadata_unittest.cc @@ -34,9 +34,11 @@ TEST(PluginMetadataTest, SecurityStatus) { PluginMetadata plugin_metadata("claybrick-writer", ASCIIToUTF16("ClayBrick Writer"), - true, GURL(), GURL(), + true, + GURL(), + GURL(), ASCIIToUTF16("ClayBrick"), - ""); + std::string()); #if defined(OS_LINUX) EXPECT_EQ(kRequiresAuthorization, GetSecurityStatus(&plugin_metadata, "1.2.3")); diff --git a/chrome/browser/policy/cloud/cloud_policy_refresh_scheduler_unittest.cc b/chrome/browser/policy/cloud/cloud_policy_refresh_scheduler_unittest.cc index 269ca75..9f3c403 100644 --- a/chrome/browser/policy/cloud/cloud_policy_refresh_scheduler_unittest.cc +++ b/chrome/browser/policy/cloud/cloud_policy_refresh_scheduler_unittest.cc @@ -127,7 +127,7 @@ TEST_F(CloudPolicyRefreshSchedulerTest, InitialRefreshManagedAlreadyFetched) { } TEST_F(CloudPolicyRefreshSchedulerTest, Unregistered) { - client_.SetDMToken(""); + client_.SetDMToken(std::string()); scoped_ptr<CloudPolicyRefreshScheduler> scheduler(CreateRefreshScheduler()); client_.NotifyPolicyFetched(); client_.NotifyRegistrationStateChanged(); @@ -182,7 +182,7 @@ TEST_F(CloudPolicyRefreshSchedulerSteadyStateTest, OnRegistrationStateChanged) { EXPECT_EQ(GetLastDelay(), base::TimeDelta()); task_runner_->ClearPendingTasks(); - client_.SetDMToken(""); + client_.SetDMToken(std::string()); client_.NotifyRegistrationStateChanged(); EXPECT_TRUE(task_runner_->GetPendingTasks().empty()); } diff --git a/chrome/browser/policy/cloud/cloud_policy_service_unittest.cc b/chrome/browser/policy/cloud/cloud_policy_service_unittest.cc index 90b344b..b1c7ccb 100644 --- a/chrome/browser/policy/cloud/cloud_policy_service_unittest.cc +++ b/chrome/browser/policy/cloud/cloud_policy_service_unittest.cc @@ -118,7 +118,7 @@ TEST_F(CloudPolicyServiceTest, RefreshPolicySuccess) { TEST_F(CloudPolicyServiceTest, RefreshPolicyNotRegistered) { // Clear the token so the client is not registered. - client_.SetDMToken(""); + client_.SetDMToken(std::string()); EXPECT_CALL(client_, FetchPolicy()).Times(0); EXPECT_CALL(*this, OnPolicyRefresh(false)).Times(1); diff --git a/chrome/browser/policy/cloud/device_management_service_unittest.cc b/chrome/browser/policy/cloud/device_management_service_unittest.cc index ae84965..b83ca80 100644 --- a/chrome/browser/policy/cloud/device_management_service_unittest.cc +++ b/chrome/browser/policy/cloud/device_management_service_unittest.cc @@ -513,7 +513,7 @@ TEST_F(DeviceManagementServiceTest, CancelDuringCallback) { // Generate a callback. net::URLRequestStatus status(net::URLRequestStatus::SUCCESS, 0); - SendResponse(fetcher, status, 500, ""); + SendResponse(fetcher, status, 500, std::string()); // Job should have been reset. EXPECT_FALSE(request_job.get()); @@ -534,7 +534,7 @@ TEST_F(DeviceManagementServiceTest, RetryOnProxyError) { // Generate a callback with a proxy failure. net::URLRequestStatus status(net::URLRequestStatus::FAILED, net::ERR_PROXY_CONNECTION_FAILED); - SendResponse(fetcher, status, 200, ""); + SendResponse(fetcher, status, 200, std::string()); // Verify that a new URLFetcher was started that bypasses the proxy. fetcher = GetFetcher(); @@ -564,7 +564,7 @@ TEST_F(DeviceManagementServiceTest, RetryOnBadResponseFromProxy) { // Generate a callback with a valid http response, that was generated by // a bad/wrong proxy. net::URLRequestStatus status; - SendResponse(fetcher, status, 200, ""); + SendResponse(fetcher, status, 200, std::string()); // Verify that a new URLFetcher was started that bypasses the proxy. fetcher = GetFetcher(); diff --git a/chrome/browser/policy/cloud/mock_cloud_policy_client.cc b/chrome/browser/policy/cloud/mock_cloud_policy_client.cc index 7008ec3..92b67e7 100644 --- a/chrome/browser/policy/cloud/mock_cloud_policy_client.cc +++ b/chrome/browser/policy/cloud/mock_cloud_policy_client.cc @@ -10,7 +10,11 @@ namespace em = enterprise_management; namespace policy { MockCloudPolicyClient::MockCloudPolicyClient() - : CloudPolicyClient("", "", USER_AFFILIATION_NONE, NULL, NULL) {} + : CloudPolicyClient(std::string(), + std::string(), + USER_AFFILIATION_NONE, + NULL, + NULL) {} MockCloudPolicyClient::~MockCloudPolicyClient() {} diff --git a/chrome/browser/policy/cloud/mock_device_management_service.cc b/chrome/browser/policy/cloud/mock_device_management_service.cc index 987cf62..f7836ce 100644 --- a/chrome/browser/policy/cloud/mock_device_management_service.cc +++ b/chrome/browser/policy/cloud/mock_device_management_service.cc @@ -116,7 +116,7 @@ ACTION_P2(CreateAsyncMockDeviceManagementJob, service, mock_job) { MockDeviceManagementJob::~MockDeviceManagementJob() {} MockDeviceManagementService::MockDeviceManagementService() - : DeviceManagementService("") {} + : DeviceManagementService(std::string()) {} MockDeviceManagementService::~MockDeviceManagementService() {} diff --git a/chrome/browser/policy/configuration_policy_pref_store_unittest.cc b/chrome/browser/policy/configuration_policy_pref_store_unittest.cc index a801f83..321b3732 100644 --- a/chrome/browser/policy/configuration_policy_pref_store_unittest.cc +++ b/chrome/browser/policy/configuration_policy_pref_store_unittest.cc @@ -409,9 +409,10 @@ TEST_F(ConfigurationPolicyPrefStoreProxyTest, ManualOptions) { ProxyPolicyHandler::PROXY_MANUALLY_CONFIGURED_PROXY_SERVER_MODE)); UpdateProviderPolicy(policy); - VerifyProxyPrefs( - "chromium.org", "", "http://chromium.org/override", - ProxyPrefs::MODE_FIXED_SERVERS); + VerifyProxyPrefs("chromium.org", + std::string(), + "http://chromium.org/override", + ProxyPrefs::MODE_FIXED_SERVERS); } TEST_F(ConfigurationPolicyPrefStoreProxyTest, ManualOptionsReversedApplyOrder) { @@ -426,9 +427,10 @@ TEST_F(ConfigurationPolicyPrefStoreProxyTest, ManualOptionsReversedApplyOrder) { base::Value::CreateStringValue("chromium.org")); UpdateProviderPolicy(policy); - VerifyProxyPrefs( - "chromium.org", "", "http://chromium.org/override", - ProxyPrefs::MODE_FIXED_SERVERS); + VerifyProxyPrefs("chromium.org", + std::string(), + "http://chromium.org/override", + ProxyPrefs::MODE_FIXED_SERVERS); } TEST_F(ConfigurationPolicyPrefStoreProxyTest, ManualOptionsInvalid) { @@ -450,7 +452,8 @@ TEST_F(ConfigurationPolicyPrefStoreProxyTest, NoProxyServerMode) { base::Value::CreateIntegerValue( ProxyPolicyHandler::PROXY_SERVER_MODE)); UpdateProviderPolicy(policy); - VerifyProxyPrefs("", "", "", ProxyPrefs::MODE_DIRECT); + VerifyProxyPrefs( + std::string(), std::string(), std::string(), ProxyPrefs::MODE_DIRECT); } TEST_F(ConfigurationPolicyPrefStoreProxyTest, NoProxyModeName) { @@ -458,7 +461,8 @@ TEST_F(ConfigurationPolicyPrefStoreProxyTest, NoProxyModeName) { policy.Set(key::kProxyMode, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, base::Value::CreateStringValue(ProxyPrefs::kDirectProxyModeName)); UpdateProviderPolicy(policy); - VerifyProxyPrefs("", "", "", ProxyPrefs::MODE_DIRECT); + VerifyProxyPrefs( + std::string(), std::string(), std::string(), ProxyPrefs::MODE_DIRECT); } TEST_F(ConfigurationPolicyPrefStoreProxyTest, AutoDetectProxyServerMode) { @@ -468,7 +472,10 @@ TEST_F(ConfigurationPolicyPrefStoreProxyTest, AutoDetectProxyServerMode) { base::Value::CreateIntegerValue( ProxyPolicyHandler::PROXY_AUTO_DETECT_PROXY_SERVER_MODE)); UpdateProviderPolicy(policy); - VerifyProxyPrefs("", "", "", ProxyPrefs::MODE_AUTO_DETECT); + VerifyProxyPrefs(std::string(), + std::string(), + std::string(), + ProxyPrefs::MODE_AUTO_DETECT); } TEST_F(ConfigurationPolicyPrefStoreProxyTest, AutoDetectProxyModeName) { @@ -477,7 +484,10 @@ TEST_F(ConfigurationPolicyPrefStoreProxyTest, AutoDetectProxyModeName) { base::Value::CreateStringValue( ProxyPrefs::kAutoDetectProxyModeName)); UpdateProviderPolicy(policy); - VerifyProxyPrefs("", "", "", ProxyPrefs::MODE_AUTO_DETECT); + VerifyProxyPrefs(std::string(), + std::string(), + std::string(), + ProxyPrefs::MODE_AUTO_DETECT); } TEST_F(ConfigurationPolicyPrefStoreProxyTest, PacScriptProxyMode) { @@ -488,7 +498,9 @@ TEST_F(ConfigurationPolicyPrefStoreProxyTest, PacScriptProxyMode) { base::Value::CreateStringValue( ProxyPrefs::kPacScriptProxyModeName)); UpdateProviderPolicy(policy); - VerifyProxyPrefs("", "http://short.org/proxy.pac", "", + VerifyProxyPrefs(std::string(), + "http://short.org/proxy.pac", + std::string(), ProxyPrefs::MODE_PAC_SCRIPT); } @@ -506,15 +518,21 @@ TEST_F(ConfigurationPolicyPrefStoreProxyTest, PacScriptProxyModeInvalid) { // for unset properties. TEST_F(ConfigurationPolicyPrefStoreProxyTest, PacScriptProxyModeBug78016) { PolicyMap policy; - policy.Set(key::kProxyServer, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, - base::Value::CreateStringValue("")); - policy.Set(key::kProxyPacUrl, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, + policy.Set(key::kProxyServer, + POLICY_LEVEL_MANDATORY, + POLICY_SCOPE_USER, + base::Value::CreateStringValue(std::string())); + policy.Set(key::kProxyPacUrl, + POLICY_LEVEL_MANDATORY, + POLICY_SCOPE_USER, base::Value::CreateStringValue("http://short.org/proxy.pac")); policy.Set(key::kProxyMode, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, base::Value::CreateStringValue( ProxyPrefs::kPacScriptProxyModeName)); UpdateProviderPolicy(policy); - VerifyProxyPrefs("", "http://short.org/proxy.pac", "", + VerifyProxyPrefs(std::string(), + "http://short.org/proxy.pac", + std::string(), ProxyPrefs::MODE_PAC_SCRIPT); } @@ -524,7 +542,8 @@ TEST_F(ConfigurationPolicyPrefStoreProxyTest, UseSystemProxyServerMode) { base::Value::CreateIntegerValue( ProxyPolicyHandler::PROXY_USE_SYSTEM_PROXY_SERVER_MODE)); UpdateProviderPolicy(policy); - VerifyProxyPrefs("", "", "", ProxyPrefs::MODE_SYSTEM); + VerifyProxyPrefs( + std::string(), std::string(), std::string(), ProxyPrefs::MODE_SYSTEM); } TEST_F(ConfigurationPolicyPrefStoreProxyTest, UseSystemProxyMode) { @@ -532,7 +551,8 @@ TEST_F(ConfigurationPolicyPrefStoreProxyTest, UseSystemProxyMode) { policy.Set(key::kProxyMode, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, base::Value::CreateStringValue(ProxyPrefs::kSystemProxyModeName)); UpdateProviderPolicy(policy); - VerifyProxyPrefs("", "", "", ProxyPrefs::MODE_SYSTEM); + VerifyProxyPrefs( + std::string(), std::string(), std::string(), ProxyPrefs::MODE_SYSTEM); } TEST_F(ConfigurationPolicyPrefStoreProxyTest, @@ -545,7 +565,10 @@ TEST_F(ConfigurationPolicyPrefStoreProxyTest, base::Value::CreateStringValue( ProxyPrefs::kAutoDetectProxyModeName)); UpdateProviderPolicy(policy); - VerifyProxyPrefs("", "", "", ProxyPrefs::MODE_AUTO_DETECT); + VerifyProxyPrefs(std::string(), + std::string(), + std::string(), + ProxyPrefs::MODE_AUTO_DETECT); } TEST_F(ConfigurationPolicyPrefStoreProxyTest, ProxyInvalid) { @@ -768,7 +791,7 @@ TEST_F(ConfigurationPolicyPrefStoreDefaultSearchTest, Disabled) { base::FundamentalValue expected_enabled(false); EXPECT_TRUE(base::Value::Equals(&expected_enabled, value)); EXPECT_TRUE(store_->GetValue(prefs::kDefaultSearchProviderSearchURL, &value)); - base::StringValue expected_search_url(""); + base::StringValue expected_search_url((std::string())); EXPECT_TRUE(base::Value::Equals(&expected_search_url, value)); } @@ -908,8 +931,10 @@ TEST_F(ConfigurationPolicyPrefStorePromptDownloadTest, Default) { TEST_F(ConfigurationPolicyPrefStorePromptDownloadTest, SetDownloadDirectory) { PolicyMap policy; EXPECT_FALSE(store_->GetValue(prefs::kPromptForDownload, NULL)); - policy.Set(key::kDownloadDirectory, POLICY_LEVEL_MANDATORY, - POLICY_SCOPE_USER, base::Value::CreateStringValue("")); + policy.Set(key::kDownloadDirectory, + POLICY_LEVEL_MANDATORY, + POLICY_SCOPE_USER, + base::Value::CreateStringValue(std::string())); UpdateProviderPolicy(policy); // Setting a DownloadDirectory should disable the PromptForDownload pref. diff --git a/chrome/browser/policy/policy_map_unittest.cc b/chrome/browser/policy/policy_map_unittest.cc index a2f6207..367ce06 100644 --- a/chrome/browser/policy/policy_map_unittest.cc +++ b/chrome/browser/policy/policy_map_unittest.cc @@ -103,9 +103,13 @@ TEST(PolicyMapTest, MergeFrom) { Value::CreateBooleanValue(false)); b.Set(key::kBookmarkBarEnabled, POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_MACHINE, Value::CreateBooleanValue(true)); - b.Set(key::kDefaultSearchProviderSearchURL, POLICY_LEVEL_MANDATORY, - POLICY_SCOPE_MACHINE, Value::CreateStringValue("")); - b.Set(key::kDisableSpdy, POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_USER, + b.Set(key::kDefaultSearchProviderSearchURL, + POLICY_LEVEL_MANDATORY, + POLICY_SCOPE_MACHINE, + Value::CreateStringValue(std::string())); + b.Set(key::kDisableSpdy, + POLICY_LEVEL_RECOMMENDED, + POLICY_SCOPE_USER, Value::CreateBooleanValue(true)); a.MergeFrom(b); @@ -121,8 +125,10 @@ TEST(PolicyMapTest, MergeFrom) { c.Set(key::kBookmarkBarEnabled, POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_MACHINE, Value::CreateBooleanValue(true)); // POLICY_LEVEL_MANDATORY over POLICY_LEVEL_RECOMMENDED. - c.Set(key::kDefaultSearchProviderSearchURL, POLICY_LEVEL_MANDATORY, - POLICY_SCOPE_MACHINE, Value::CreateStringValue("")); + c.Set(key::kDefaultSearchProviderSearchURL, + POLICY_LEVEL_MANDATORY, + POLICY_SCOPE_MACHINE, + Value::CreateStringValue(std::string())); // Merge new ones. c.Set(key::kDisableSpdy, POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_USER, Value::CreateBooleanValue(true)); diff --git a/chrome/browser/policy/policy_prefs_browsertest.cc b/chrome/browser/policy/policy_prefs_browsertest.cc index bce4fe0..23173bc 100644 --- a/chrome/browser/policy/policy_prefs_browsertest.cc +++ b/chrome/browser/policy/policy_prefs_browsertest.cc @@ -519,8 +519,8 @@ IN_PROC_BROWSER_TEST_P(PolicyPrefsTest, CheckPolicyIndicators) { // set by policy. PolicyMap policies; UpdateProviderPolicy(policies); - VerifyControlledSettingIndicators(browser(), indicator_selector, - "", "", false); + VerifyControlledSettingIndicators( + browser(), indicator_selector, std::string(), std::string(), false); // Check that the appropriate controlled setting indicator is shown when a // value is enforced by policy. policies.LoadFrom(&(*indicator_test_case)->policy(), diff --git a/chrome/browser/policy/url_blacklist_manager_unittest.cc b/chrome/browser/policy/url_blacklist_manager_unittest.cc index 3e5ac0f..b1f69d1 100644 --- a/chrome/browser/policy/url_blacklist_manager_unittest.cc +++ b/chrome/browser/policy/url_blacklist_manager_unittest.cc @@ -240,31 +240,83 @@ INSTANTIATE_TEST_CASE_P( URLBlacklistFilterToComponentsTest, testing::Values( FilterTestParams("google.com", - "", ".google.com", true, 0u, ""), + std::string(), + ".google.com", + true, + 0u, + std::string()), FilterTestParams(".google.com", - "", "google.com", false, 0u, ""), + std::string(), + "google.com", + false, + 0u, + std::string()), FilterTestParams("http://google.com", - "http", ".google.com", true, 0u, ""), + "http", + ".google.com", + true, + 0u, + std::string()), FilterTestParams("google.com/", - "", ".google.com", true, 0u, "/"), + std::string(), + ".google.com", + true, + 0u, + "/"), FilterTestParams("http://google.com:8080/whatever", - "http", ".google.com", true, 8080u, "/whatever"), + "http", + ".google.com", + true, + 8080u, + "/whatever"), FilterTestParams("http://user:pass@google.com:8080/whatever", - "http", ".google.com", true, 8080u, "/whatever"), + "http", + ".google.com", + true, + 8080u, + "/whatever"), FilterTestParams("123.123.123.123", - "", "123.123.123.123", false, 0u, ""), + std::string(), + "123.123.123.123", + false, + 0u, + std::string()), FilterTestParams("https://123.123.123.123", - "https", "123.123.123.123", false, 0u, ""), + "https", + "123.123.123.123", + false, + 0u, + std::string()), FilterTestParams("123.123.123.123/", - "", "123.123.123.123", false, 0u, "/"), + std::string(), + "123.123.123.123", + false, + 0u, + "/"), FilterTestParams("http://123.123.123.123:123/whatever", - "http", "123.123.123.123", false, 123u, "/whatever"), + "http", + "123.123.123.123", + false, + 123u, + "/whatever"), FilterTestParams("*", - "", "", true, 0u, ""), + std::string(), + std::string(), + true, + 0u, + std::string()), FilterTestParams("ftp://*", - "ftp", "", true, 0u, ""), + "ftp", + std::string(), + true, + 0u, + std::string()), FilterTestParams("http://*/whatever", - "http", "", true, 0u, "/whatever"))); + "http", + std::string(), + true, + 0u, + "/whatever"))); TEST_F(URLBlacklistManagerTest, Filtering) { URLBlacklist blacklist; diff --git a/chrome/browser/popup_blocker_browsertest.cc b/chrome/browser/popup_blocker_browsertest.cc index c2e3ede..aacbbef 100644 --- a/chrome/browser/popup_blocker_browsertest.cc +++ b/chrome/browser/popup_blocker_browsertest.cc @@ -55,7 +55,7 @@ class PopupBlockerBrowserTest : public InProcessBrowserTest { // Do a round trip to the renderer first to flush any in-flight IPCs to // create a to-be-blocked window. WebContents* tab = browser->tab_strip_model()->GetActiveWebContents(); - CHECK(content::ExecuteScript(tab, "")); + CHECK(content::ExecuteScript(tab, std::string())); BlockedContentTabHelper* blocked_content_tab_helper = BlockedContentTabHelper::FromWebContents(tab); std::vector<WebContents*> blocked_contents; @@ -127,12 +127,12 @@ IN_PROC_BROWSER_TEST_F(PopupBlockerBrowserTest, MultiplePopups) { IN_PROC_BROWSER_TEST_F(PopupBlockerBrowserTest, AllowPopupThroughContentSetting) { GURL url(GetTestURL()); - browser()->profile()->GetHostContentSettingsMap()->SetContentSetting( - ContentSettingsPattern::FromURL(url), - ContentSettingsPattern::Wildcard(), - CONTENT_SETTINGS_TYPE_POPUPS, - "", - CONTENT_SETTING_ALLOW); + browser()->profile()->GetHostContentSettingsMap() + ->SetContentSetting(ContentSettingsPattern::FromURL(url), + ContentSettingsPattern::Wildcard(), + CONTENT_SETTINGS_TYPE_POPUPS, + std::string(), + CONTENT_SETTING_ALLOW); NavigateAndCheckPopupShown(browser(), url); } diff --git a/chrome/browser/predictors/autocomplete_action_predictor.cc b/chrome/browser/predictors/autocomplete_action_predictor.cc index cc183c36..184e7a7 100644 --- a/chrome/browser/predictors/autocomplete_action_predictor.cc +++ b/chrome/browser/predictors/autocomplete_action_predictor.cc @@ -148,7 +148,7 @@ void AutocompleteActionPredictor::StartPrerendering( prerender::PrerenderManagerFactory::GetForProfile(profile_)) { content::SessionStorageNamespace* session_storage_namespace = NULL; content::SessionStorageNamespaceMap::const_iterator it = - session_storage_namespace_map.find(""); + session_storage_namespace_map.find(std::string()); if (it != session_storage_namespace_map.end()) session_storage_namespace = it->second; prerender_handle_.reset( diff --git a/chrome/browser/predictors/resource_prefetch_predictor.cc b/chrome/browser/predictors/resource_prefetch_predictor.cc index a6d7cbd..b37f3a1 100644 --- a/chrome/browser/predictors/resource_prefetch_predictor.cc +++ b/chrome/browser/predictors/resource_prefetch_predictor.cc @@ -1012,7 +1012,8 @@ void ResourcePrefetchPredictor::LearnNavigation( } else { bool is_host = key_type == PREFETCH_KEY_TYPE_HOST; PrefetchData empty_data( - !is_host ? PREFETCH_KEY_TYPE_HOST : PREFETCH_KEY_TYPE_URL , ""); + !is_host ? PREFETCH_KEY_TYPE_HOST : PREFETCH_KEY_TYPE_URL, + std::string()); const PrefetchData& host_data = is_host ? cache_entry->second : empty_data; const PrefetchData& url_data = is_host ? empty_data : cache_entry->second; BrowserThread::PostTask( diff --git a/chrome/browser/predictors/resource_prefetch_predictor_tables_unittest.cc b/chrome/browser/predictors/resource_prefetch_predictor_tables_unittest.cc index d39e892..fa5be14 100644 --- a/chrome/browser/predictors/resource_prefetch_predictor_tables_unittest.cc +++ b/chrome/browser/predictors/resource_prefetch_predictor_tables_unittest.cc @@ -167,34 +167,45 @@ void ResourcePrefetchPredictorTablesTest::TestDeleteSingleDataPoint() { void ResourcePrefetchPredictorTablesTest::TestUpdateData() { PrefetchData google(PREFETCH_KEY_TYPE_URL, "http://www.google.com"); google.last_visit = base::Time::FromInternalValue(10); - google.resources.push_back(ResourceRow( - "", - "http://www.google.com/style.css", - ResourceType::STYLESHEET, - 6, 2, 0, 1.0)); - google.resources.push_back(ResourceRow( - "", - "http://www.google.com/image.png", - ResourceType::IMAGE, - 6, 4, 1, 4.2)); - google.resources.push_back(ResourceRow( - "", - "http://www.google.com/a.xml", - ResourceType::LAST_TYPE, - 1, 0, 0, 6.1)); - google.resources.push_back(ResourceRow( - "", - "http://www.resources.google.com/script.js", - ResourceType::SCRIPT, - 12, 0, 0, 8.5)); + google.resources.push_back(ResourceRow(std::string(), + "http://www.google.com/style.css", + ResourceType::STYLESHEET, + 6, + 2, + 0, + 1.0)); + google.resources.push_back(ResourceRow(std::string(), + "http://www.google.com/image.png", + ResourceType::IMAGE, + 6, + 4, + 1, + 4.2)); + google.resources.push_back(ResourceRow(std::string(), + "http://www.google.com/a.xml", + ResourceType::LAST_TYPE, + 1, + 0, + 0, + 6.1)); + google.resources + .push_back(ResourceRow(std::string(), + "http://www.resources.google.com/script.js", + ResourceType::SCRIPT, + 12, + 0, + 0, + 8.5)); PrefetchData yahoo(PREFETCH_KEY_TYPE_HOST, "www.yahoo.com"); yahoo.last_visit = base::Time::FromInternalValue(7); - yahoo.resources.push_back(ResourceRow( - "", - "http://www.yahoo.com/image.png", - ResourceType::IMAGE, - 120, 1, 1, 10.0)); + yahoo.resources.push_back(ResourceRow(std::string(), + "http://www.yahoo.com/image.png", + ResourceType::IMAGE, + 120, + 1, + 1, + 10.0)); tables_->UpdateData(google, yahoo); @@ -276,59 +287,78 @@ void ResourcePrefetchPredictorTablesTest::InitializeSampleData() { { // Url data. PrefetchData google(PREFETCH_KEY_TYPE_URL, "http://www.google.com"); google.last_visit = base::Time::FromInternalValue(1); - google.resources.push_back(ResourceRow( - "", - "http://www.google.com/style.css", - ResourceType::STYLESHEET, - 5, 2, 1, 1.1)); - google.resources.push_back(ResourceRow( - "", - "http://www.google.com/script.js", - ResourceType::SCRIPT, - 4, 0, 1, 2.1)); - google.resources.push_back(ResourceRow( - "", - "http://www.google.com/image.png", - ResourceType::IMAGE, - 6, 3, 0, 2.2)); - google.resources.push_back(ResourceRow( - "", - "http://www.google.com/a.font", - ResourceType::LAST_TYPE, - 2, 0, 0, 5.1)); - google.resources.push_back(ResourceRow( - "", - "http://www.resources.google.com/script.js", - ResourceType::SCRIPT, - 11, 0, 0, 8.5)); + google.resources.push_back(ResourceRow(std::string(), + "http://www.google.com/style.css", + ResourceType::STYLESHEET, + 5, + 2, + 1, + 1.1)); + google.resources.push_back(ResourceRow(std::string(), + "http://www.google.com/script.js", + ResourceType::SCRIPT, + 4, + 0, + 1, + 2.1)); + google.resources.push_back(ResourceRow(std::string(), + "http://www.google.com/image.png", + ResourceType::IMAGE, + 6, + 3, + 0, + 2.2)); + google.resources.push_back(ResourceRow(std::string(), + "http://www.google.com/a.font", + ResourceType::LAST_TYPE, + 2, + 0, + 0, + 5.1)); + google.resources + .push_back(ResourceRow(std::string(), + "http://www.resources.google.com/script.js", + ResourceType::SCRIPT, + 11, + 0, + 0, + 8.5)); PrefetchData reddit(PREFETCH_KEY_TYPE_URL, "http://www.reddit.com"); reddit.last_visit = base::Time::FromInternalValue(2); - reddit.resources.push_back(ResourceRow( - "", - "http://reddit-resource.com/script1.js", - ResourceType::SCRIPT, - 4, 0, 1, 1.0)); - reddit.resources.push_back(ResourceRow( - "", - "http://reddit-resource.com/script2.js", - ResourceType::SCRIPT, - 2, 0, 0, 2.1)); + reddit.resources + .push_back(ResourceRow(std::string(), + "http://reddit-resource.com/script1.js", + ResourceType::SCRIPT, + 4, + 0, + 1, + 1.0)); + reddit.resources + .push_back(ResourceRow(std::string(), + "http://reddit-resource.com/script2.js", + ResourceType::SCRIPT, + 2, + 0, + 0, + 2.1)); PrefetchData yahoo(PREFETCH_KEY_TYPE_URL, "http://www.yahoo.com"); yahoo.last_visit = base::Time::FromInternalValue(3); - yahoo.resources.push_back(ResourceRow( - "", - "http://www.google.com/image.png", - ResourceType::IMAGE, - 20, 1, 0, 10.0)); + yahoo.resources.push_back(ResourceRow(std::string(), + "http://www.google.com/image.png", + ResourceType::IMAGE, + 20, + 1, + 0, + 10.0)); test_url_data_.clear(); test_url_data_.insert(std::make_pair("http://www.google.com", google)); test_url_data_.insert(std::make_pair("http://www.reddit.com", reddit)); test_url_data_.insert(std::make_pair("http://www.yahoo.com", yahoo)); - PrefetchData empty_host_data(PREFETCH_KEY_TYPE_HOST, ""); + PrefetchData empty_host_data(PREFETCH_KEY_TYPE_HOST, std::string()); tables_->UpdateData(google, empty_host_data); tables_->UpdateData(reddit, empty_host_data); tables_->UpdateData(yahoo, empty_host_data); @@ -337,45 +367,61 @@ void ResourcePrefetchPredictorTablesTest::InitializeSampleData() { { // Host data. PrefetchData facebook(PREFETCH_KEY_TYPE_HOST, "www.facebook.com"); facebook.last_visit = base::Time::FromInternalValue(4); - facebook.resources.push_back(ResourceRow( - "", - "http://www.facebook.com/style.css", - ResourceType::STYLESHEET, - 5, 2, 1, 1.1)); - facebook.resources.push_back(ResourceRow( - "", - "http://www.facebook.com/script.js", - ResourceType::SCRIPT, - 4, 0, 1, 2.1)); - facebook.resources.push_back(ResourceRow( - "", - "http://www.facebook.com/image.png", - ResourceType::IMAGE, - 6, 3, 0, 2.2)); - facebook.resources.push_back(ResourceRow( - "", - "http://www.facebook.com/a.font", - ResourceType::LAST_TYPE, - 2, 0, 0, 5.1)); - facebook.resources.push_back(ResourceRow( - "", - "http://www.resources.facebook.com/script.js", - ResourceType::SCRIPT, - 11, 0, 0, 8.5)); + facebook.resources + .push_back(ResourceRow(std::string(), + "http://www.facebook.com/style.css", + ResourceType::STYLESHEET, + 5, + 2, + 1, + 1.1)); + facebook.resources + .push_back(ResourceRow(std::string(), + "http://www.facebook.com/script.js", + ResourceType::SCRIPT, + 4, + 0, + 1, + 2.1)); + facebook.resources + .push_back(ResourceRow(std::string(), + "http://www.facebook.com/image.png", + ResourceType::IMAGE, + 6, + 3, + 0, + 2.2)); + facebook.resources.push_back(ResourceRow(std::string(), + "http://www.facebook.com/a.font", + ResourceType::LAST_TYPE, + 2, + 0, + 0, + 5.1)); + facebook.resources + .push_back(ResourceRow(std::string(), + "http://www.resources.facebook.com/script.js", + ResourceType::SCRIPT, + 11, + 0, + 0, + 8.5)); PrefetchData yahoo(PREFETCH_KEY_TYPE_HOST, "www.yahoo.com"); yahoo.last_visit = base::Time::FromInternalValue(5); - yahoo.resources.push_back(ResourceRow( - "", - "http://www.google.com/image.png", - ResourceType::IMAGE, - 20, 1, 0, 10.0)); + yahoo.resources.push_back(ResourceRow(std::string(), + "http://www.google.com/image.png", + ResourceType::IMAGE, + 20, + 1, + 0, + 10.0)); test_host_data_.clear(); test_host_data_.insert(std::make_pair("www.facebook.com", facebook)); test_host_data_.insert(std::make_pair("www.yahoo.com", yahoo)); - PrefetchData empty_url_data(PREFETCH_KEY_TYPE_URL, ""); + PrefetchData empty_url_data(PREFETCH_KEY_TYPE_URL, std::string()); tables_->UpdateData(empty_url_data, facebook); tables_->UpdateData(empty_url_data, yahoo); } diff --git a/chrome/browser/predictors/resource_prefetch_predictor_unittest.cc b/chrome/browser/predictors/resource_prefetch_predictor_unittest.cc index 891b70c..b6203da 100644 --- a/chrome/browser/predictors/resource_prefetch_predictor_unittest.cc +++ b/chrome/browser/predictors/resource_prefetch_predictor_unittest.cc @@ -176,9 +176,8 @@ ResourcePrefetchPredictorTest::ResourcePrefetchPredictorTest() profile_(new TestingProfile()), predictor_(NULL), mock_tables_(new StrictMock<MockResourcePrefetchPredictorTables>()), - empty_url_data_(PREFETCH_KEY_TYPE_URL, ""), - empty_host_data_(PREFETCH_KEY_TYPE_HOST, "") { -} + empty_url_data_(PREFETCH_KEY_TYPE_URL, std::string()), + empty_host_data_(PREFETCH_KEY_TYPE_HOST, std::string()) {} ResourcePrefetchPredictorTest::~ResourcePrefetchPredictorTest() { profile_.reset(NULL); @@ -214,52 +213,70 @@ void ResourcePrefetchPredictorTest::InitializeSampleData() { { // Url data. PrefetchData google(PREFETCH_KEY_TYPE_URL, "http://www.google.com/"); google.last_visit = base::Time::FromInternalValue(1); - google.resources.push_back(ResourceRow( - "", - "http://google.com/style1.css", - ResourceType::STYLESHEET, - 3, 2, 1, 1.0)); - google.resources.push_back(ResourceRow( - "", - "http://google.com/script3.js", - ResourceType::SCRIPT, - 4, 0, 1, 2.1)); - google.resources.push_back(ResourceRow( - "", - "http://google.com/script4.js", - ResourceType::SCRIPT, - 11, 0, 0, 2.1)); - google.resources.push_back(ResourceRow( - "", - "http://google.com/image1.png", - ResourceType::IMAGE, - 6, 3, 0, 2.2)); - google.resources.push_back(ResourceRow( - "", - "http://google.com/a.font", - ResourceType::LAST_TYPE, - 2, 0, 0, 5.1)); + google.resources.push_back(ResourceRow(std::string(), + "http://google.com/style1.css", + ResourceType::STYLESHEET, + 3, + 2, + 1, + 1.0)); + google.resources.push_back(ResourceRow(std::string(), + "http://google.com/script3.js", + ResourceType::SCRIPT, + 4, + 0, + 1, + 2.1)); + google.resources.push_back(ResourceRow(std::string(), + "http://google.com/script4.js", + ResourceType::SCRIPT, + 11, + 0, + 0, + 2.1)); + google.resources.push_back(ResourceRow(std::string(), + "http://google.com/image1.png", + ResourceType::IMAGE, + 6, + 3, + 0, + 2.2)); + google.resources.push_back(ResourceRow(std::string(), + "http://google.com/a.font", + ResourceType::LAST_TYPE, + 2, + 0, + 0, + 5.1)); PrefetchData reddit(PREFETCH_KEY_TYPE_URL, "http://www.reddit.com/"); reddit.last_visit = base::Time::FromInternalValue(2); - reddit.resources.push_back(ResourceRow( - "", - "http://reddit-resource.com/script1.js", - ResourceType::SCRIPT, - 4, 0, 1, 1.0)); - reddit.resources.push_back(ResourceRow( - "", - "http://reddit-resource.com/script2.js", - ResourceType::SCRIPT, - 2, 0, 0, 2.1)); + reddit.resources + .push_back(ResourceRow(std::string(), + "http://reddit-resource.com/script1.js", + ResourceType::SCRIPT, + 4, + 0, + 1, + 1.0)); + reddit.resources + .push_back(ResourceRow(std::string(), + "http://reddit-resource.com/script2.js", + ResourceType::SCRIPT, + 2, + 0, + 0, + 2.1)); PrefetchData yahoo(PREFETCH_KEY_TYPE_URL, "http://www.yahoo.com/"); yahoo.last_visit = base::Time::FromInternalValue(3); - yahoo.resources.push_back(ResourceRow( - "", - "http://google.com/image.png", - ResourceType::IMAGE, - 20, 1, 0, 10.0)); + yahoo.resources.push_back(ResourceRow(std::string(), + "http://google.com/image.png", + ResourceType::IMAGE, + 20, + 1, + 0, + 10.0)); test_url_data_.clear(); test_url_data_.insert(std::make_pair("http://www.google.com/", google)); @@ -270,39 +287,55 @@ void ResourcePrefetchPredictorTest::InitializeSampleData() { { // Host data. PrefetchData facebook(PREFETCH_KEY_TYPE_HOST, "www.facebook.com"); facebook.last_visit = base::Time::FromInternalValue(4); - facebook.resources.push_back(ResourceRow( - "", - "http://www.facebook.com/style.css", - ResourceType::STYLESHEET, - 5, 2, 1, 1.1)); - facebook.resources.push_back(ResourceRow( - "", - "http://www.facebook.com/script.js", - ResourceType::SCRIPT, - 4, 0, 1, 2.1)); - facebook.resources.push_back(ResourceRow( - "", - "http://www.facebook.com/image.png", - ResourceType::IMAGE, - 6, 3, 0, 2.2)); - facebook.resources.push_back(ResourceRow( - "", - "http://www.facebook.com/a.font", - ResourceType::LAST_TYPE, - 2, 0, 0, 5.1)); - facebook.resources.push_back(ResourceRow( - "", - "http://www.resources.facebook.com/script.js", - ResourceType::SCRIPT, - 11, 0, 0, 8.5)); + facebook.resources + .push_back(ResourceRow(std::string(), + "http://www.facebook.com/style.css", + ResourceType::STYLESHEET, + 5, + 2, + 1, + 1.1)); + facebook.resources + .push_back(ResourceRow(std::string(), + "http://www.facebook.com/script.js", + ResourceType::SCRIPT, + 4, + 0, + 1, + 2.1)); + facebook.resources + .push_back(ResourceRow(std::string(), + "http://www.facebook.com/image.png", + ResourceType::IMAGE, + 6, + 3, + 0, + 2.2)); + facebook.resources.push_back(ResourceRow(std::string(), + "http://www.facebook.com/a.font", + ResourceType::LAST_TYPE, + 2, + 0, + 0, + 5.1)); + facebook.resources + .push_back(ResourceRow(std::string(), + "http://www.resources.facebook.com/script.js", + ResourceType::SCRIPT, + 11, + 0, + 0, + 8.5)); PrefetchData yahoo(PREFETCH_KEY_TYPE_HOST, "www.yahoo.com"); yahoo.last_visit = base::Time::FromInternalValue(5); - yahoo.resources.push_back(ResourceRow( - "", - "http://google.com/image.png", - ResourceType::IMAGE, - 20, 1, 0, 10.0)); + yahoo.resources.push_back(ResourceRow(std::string(), + "http://google.com/image.png", + ResourceType::IMAGE, + 20, + 1, + 0, + 10.0)); test_host_data_.clear(); test_host_data_.insert(std::make_pair("www.facebook.com", facebook)); @@ -343,9 +376,14 @@ TEST_F(ResourcePrefetchPredictorTest, NavigationNotRecorded) { // Single navigation but history count is low, so should not record. AddUrlToHistory("http://www.google.com", 1); - URLRequestSummary main_frame = CreateURLRequestSummary( - 1, 1, "http://www.google.com", "http://www.google.com", - ResourceType::MAIN_FRAME, "", false); + URLRequestSummary main_frame = + CreateURLRequestSummary(1, + 1, + "http://www.google.com", + "http://www.google.com", + ResourceType::MAIN_FRAME, + std::string(), + false); predictor_->RecordURLRequest(main_frame); EXPECT_EQ(1, static_cast<int>(predictor_->inflight_navigations_.size())); @@ -364,15 +402,27 @@ TEST_F(ResourcePrefetchPredictorTest, NavigationNotRecorded) { predictor_->RecordUrlResponse(resource3); PrefetchData host_data(PREFETCH_KEY_TYPE_HOST, "www.google.com"); - host_data.resources.push_back(ResourceRow( - "", "http://google.com/style1.css", - ResourceType::STYLESHEET, 1, 0, 0, 1.0)); - host_data.resources.push_back(ResourceRow( - "", "http://google.com/script1.js", - ResourceType::SCRIPT, 1, 0, 0, 2.0)); - host_data.resources.push_back(ResourceRow( - "", "http://google.com/script2.js", - ResourceType::SCRIPT, 1, 0, 0, 3.0)); + host_data.resources.push_back(ResourceRow(std::string(), + "http://google.com/style1.css", + ResourceType::STYLESHEET, + 1, + 0, + 0, + 1.0)); + host_data.resources.push_back(ResourceRow(std::string(), + "http://google.com/script1.js", + ResourceType::SCRIPT, + 1, + 0, + 0, + 2.0)); + host_data.resources.push_back(ResourceRow(std::string(), + "http://google.com/script2.js", + ResourceType::SCRIPT, + 1, + 0, + 0, + 3.0)); EXPECT_CALL(*mock_tables_, UpdateData(empty_url_data_, host_data)); predictor_->OnNavigationComplete(main_frame.navigation_id); @@ -384,9 +434,14 @@ TEST_F(ResourcePrefetchPredictorTest, NavigationUrlNotInDB) { // resources and also for number of resources saved. AddUrlToHistory("http://www.google.com", 4); - URLRequestSummary main_frame = CreateURLRequestSummary( - 1, 1, "http://www.google.com", "http://www.google.com", - ResourceType::MAIN_FRAME, "", false); + URLRequestSummary main_frame = + CreateURLRequestSummary(1, + 1, + "http://www.google.com", + "http://www.google.com", + ResourceType::MAIN_FRAME, + std::string(), + false); predictor_->RecordURLRequest(main_frame); EXPECT_EQ(1, static_cast<int>(predictor_->inflight_navigations_.size())); @@ -424,18 +479,34 @@ TEST_F(ResourcePrefetchPredictorTest, NavigationUrlNotInDB) { resource7.resource_type); PrefetchData url_data(PREFETCH_KEY_TYPE_URL, "http://www.google.com/"); - url_data.resources.push_back(ResourceRow( - "", "http://google.com/style1.css", - ResourceType::STYLESHEET, 1, 0, 0, 1.0)); - url_data.resources.push_back(ResourceRow( - "", "http://google.com/script1.js", - ResourceType::SCRIPT, 1, 0, 0, 2.0)); - url_data.resources.push_back(ResourceRow( - "", "http://google.com/script2.js", - ResourceType::SCRIPT, 1, 0, 0, 3.0)); - url_data.resources.push_back(ResourceRow( - "", "http://google.com/style2.css", - ResourceType::STYLESHEET, 1, 0, 0, 7.0)); + url_data.resources.push_back(ResourceRow(std::string(), + "http://google.com/style1.css", + ResourceType::STYLESHEET, + 1, + 0, + 0, + 1.0)); + url_data.resources.push_back(ResourceRow(std::string(), + "http://google.com/script1.js", + ResourceType::SCRIPT, + 1, + 0, + 0, + 2.0)); + url_data.resources.push_back(ResourceRow(std::string(), + "http://google.com/script2.js", + ResourceType::SCRIPT, + 1, + 0, + 0, + 3.0)); + url_data.resources.push_back(ResourceRow(std::string(), + "http://google.com/style2.css", + ResourceType::STYLESHEET, + 1, + 0, + 0, + 7.0)); EXPECT_CALL(*mock_tables_, UpdateData(url_data, empty_host_data_)); PrefetchData host_data(PREFETCH_KEY_TYPE_HOST, "www.google.com"); @@ -461,9 +532,14 @@ TEST_F(ResourcePrefetchPredictorTest, NavigationUrlInDB) { EXPECT_EQ(3, static_cast<int>(predictor_->url_table_cache_->size())); EXPECT_EQ(2, static_cast<int>(predictor_->host_table_cache_->size())); - URLRequestSummary main_frame = CreateURLRequestSummary( - 1, 1, "http://www.google.com", "http://www.google.com", - ResourceType::MAIN_FRAME, "", false); + URLRequestSummary main_frame = + CreateURLRequestSummary(1, + 1, + "http://www.google.com", + "http://www.google.com", + ResourceType::MAIN_FRAME, + std::string(), + false); predictor_->RecordURLRequest(main_frame); EXPECT_EQ(1, static_cast<int>(predictor_->inflight_navigations_.size())); @@ -501,18 +577,34 @@ TEST_F(ResourcePrefetchPredictorTest, NavigationUrlInDB) { resource7.resource_type); PrefetchData url_data(PREFETCH_KEY_TYPE_URL, "http://www.google.com/"); - url_data.resources.push_back(ResourceRow( - "", "http://google.com/style1.css", - ResourceType::STYLESHEET, 4, 2, 0, 1.0)); - url_data.resources.push_back(ResourceRow( - "", "http://google.com/script1.js", - ResourceType::SCRIPT, 1, 0, 0, 2.0)); - url_data.resources.push_back(ResourceRow( - "", "http://google.com/script4.js", - ResourceType::SCRIPT, 11, 1, 1, 2.1)); - url_data.resources.push_back(ResourceRow( - "", "http://google.com/script2.js", - ResourceType::SCRIPT, 1, 0, 0, 3.0)); + url_data.resources.push_back(ResourceRow(std::string(), + "http://google.com/style1.css", + ResourceType::STYLESHEET, + 4, + 2, + 0, + 1.0)); + url_data.resources.push_back(ResourceRow(std::string(), + "http://google.com/script1.js", + ResourceType::SCRIPT, + 1, + 0, + 0, + 2.0)); + url_data.resources.push_back(ResourceRow(std::string(), + "http://google.com/script4.js", + ResourceType::SCRIPT, + 11, + 1, + 1, + 2.1)); + url_data.resources.push_back(ResourceRow(std::string(), + "http://google.com/script2.js", + ResourceType::SCRIPT, + 1, + 0, + 0, + 3.0)); EXPECT_CALL(*mock_tables_, UpdateData(url_data, empty_host_data_)); EXPECT_CALL(*mock_tables_, @@ -520,18 +612,34 @@ TEST_F(ResourcePrefetchPredictorTest, NavigationUrlInDB) { PREFETCH_KEY_TYPE_HOST)); PrefetchData host_data(PREFETCH_KEY_TYPE_HOST, "www.google.com"); - host_data.resources.push_back(ResourceRow( - "", "http://google.com/style1.css", - ResourceType::STYLESHEET, 1, 0, 0, 1.0)); - host_data.resources.push_back(ResourceRow( - "", "http://google.com/script1.js", - ResourceType::SCRIPT, 1, 0, 0, 2.0)); - host_data.resources.push_back(ResourceRow( - "", "http://google.com/script2.js", - ResourceType::SCRIPT, 1, 0, 0, 3.0)); - host_data.resources.push_back(ResourceRow( - "", "http://google.com/style2.css", - ResourceType::STYLESHEET, 1, 0, 0, 7.0)); + host_data.resources.push_back(ResourceRow(std::string(), + "http://google.com/style1.css", + ResourceType::STYLESHEET, + 1, + 0, + 0, + 1.0)); + host_data.resources.push_back(ResourceRow(std::string(), + "http://google.com/script1.js", + ResourceType::SCRIPT, + 1, + 0, + 0, + 2.0)); + host_data.resources.push_back(ResourceRow(std::string(), + "http://google.com/script2.js", + ResourceType::SCRIPT, + 1, + 0, + 0, + 3.0)); + host_data.resources.push_back(ResourceRow(std::string(), + "http://google.com/style2.css", + ResourceType::STYLESHEET, + 1, + 0, + 0, + 7.0)); EXPECT_CALL(*mock_tables_, UpdateData(empty_url_data_, host_data)); predictor_->OnNavigationComplete(main_frame.navigation_id); @@ -552,9 +660,14 @@ TEST_F(ResourcePrefetchPredictorTest, NavigationUrlNotInDBAndDBFull) { EXPECT_EQ(3, static_cast<int>(predictor_->url_table_cache_->size())); EXPECT_EQ(2, static_cast<int>(predictor_->host_table_cache_->size())); - URLRequestSummary main_frame = CreateURLRequestSummary( - 1, 1, "http://www.nike.com", "http://www.nike.com", - ResourceType::MAIN_FRAME, "", false); + URLRequestSummary main_frame = + CreateURLRequestSummary(1, + 1, + "http://www.nike.com", + "http://www.nike.com", + ResourceType::MAIN_FRAME, + std::string(), + false); predictor_->RecordURLRequest(main_frame); EXPECT_EQ(1, static_cast<int>(predictor_->inflight_navigations_.size())); @@ -575,12 +688,20 @@ TEST_F(ResourcePrefetchPredictorTest, NavigationUrlNotInDBAndDBFull) { PREFETCH_KEY_TYPE_HOST)); PrefetchData url_data(PREFETCH_KEY_TYPE_URL, "http://www.nike.com/"); - url_data.resources.push_back(ResourceRow( - "", "http://nike.com/style1.css", - ResourceType::STYLESHEET, 1, 0, 0, 1.0)); - url_data.resources.push_back(ResourceRow( - "", "http://nike.com/image2.png", - ResourceType::IMAGE, 1, 0, 0, 2.0)); + url_data.resources.push_back(ResourceRow(std::string(), + "http://nike.com/style1.css", + ResourceType::STYLESHEET, + 1, + 0, + 0, + 1.0)); + url_data.resources.push_back(ResourceRow(std::string(), + "http://nike.com/image2.png", + ResourceType::IMAGE, + 1, + 0, + 0, + 2.0)); EXPECT_CALL(*mock_tables_, UpdateData(url_data, empty_host_data_)); PrefetchData host_data(PREFETCH_KEY_TYPE_HOST, "www.nike.com"); @@ -647,15 +768,27 @@ TEST_F(ResourcePrefetchPredictorTest, DeleteUrls) { } TEST_F(ResourcePrefetchPredictorTest, OnMainFrameRequest) { - URLRequestSummary summary1 = CreateURLRequestSummary( - 1, 1, "http://www.google.com", "http://www.google.com", - ResourceType::MAIN_FRAME, "", false); - URLRequestSummary summary2 = CreateURLRequestSummary( - 1, 2, "http://www.google.com", "http://www.google.com", - ResourceType::MAIN_FRAME, "", false); - URLRequestSummary summary3 = CreateURLRequestSummary( - 2, 1, "http://www.yahoo.com", "http://www.yahoo.com", - ResourceType::MAIN_FRAME, "", false); + URLRequestSummary summary1 = CreateURLRequestSummary(1, + 1, + "http://www.google.com", + "http://www.google.com", + ResourceType::MAIN_FRAME, + std::string(), + false); + URLRequestSummary summary2 = CreateURLRequestSummary(1, + 2, + "http://www.google.com", + "http://www.google.com", + ResourceType::MAIN_FRAME, + std::string(), + false); + URLRequestSummary summary3 = CreateURLRequestSummary(2, + 1, + "http://www.yahoo.com", + "http://www.yahoo.com", + ResourceType::MAIN_FRAME, + std::string(), + false); predictor_->OnMainFrameRequest(summary1); EXPECT_EQ(1, static_cast<int>(predictor_->inflight_navigations_.size())); @@ -665,12 +798,20 @@ TEST_F(ResourcePrefetchPredictorTest, OnMainFrameRequest) { EXPECT_EQ(3, static_cast<int>(predictor_->inflight_navigations_.size())); // Insert anther with same navigation id. It should replace. - URLRequestSummary summary4 = CreateURLRequestSummary( - 1, 1, "http://www.nike.com", "http://www.nike.com", - ResourceType::MAIN_FRAME, "", false); - URLRequestSummary summary5 = CreateURLRequestSummary( - 1, 2, "http://www.google.com", "http://www.google.com", - ResourceType::MAIN_FRAME, "", false); + URLRequestSummary summary4 = CreateURLRequestSummary(1, + 1, + "http://www.nike.com", + "http://www.nike.com", + ResourceType::MAIN_FRAME, + std::string(), + false); + URLRequestSummary summary5 = CreateURLRequestSummary(1, + 2, + "http://www.google.com", + "http://www.google.com", + ResourceType::MAIN_FRAME, + std::string(), + false); predictor_->OnMainFrameRequest(summary4); EXPECT_EQ(3, static_cast<int>(predictor_->inflight_navigations_.size())); @@ -681,9 +822,13 @@ TEST_F(ResourcePrefetchPredictorTest, OnMainFrameRequest) { predictor_->OnMainFrameRequest(summary5); EXPECT_EQ(3, static_cast<int>(predictor_->inflight_navigations_.size())); - URLRequestSummary summary6 = CreateURLRequestSummary( - 3, 1, "http://www.shoes.com", "http://www.shoes.com", - ResourceType::MAIN_FRAME, "", false); + URLRequestSummary summary6 = CreateURLRequestSummary(3, + 1, + "http://www.shoes.com", + "http://www.shoes.com", + ResourceType::MAIN_FRAME, + std::string(), + false); predictor_->OnMainFrameRequest(summary6); EXPECT_EQ(3, static_cast<int>(predictor_->inflight_navigations_.size())); @@ -696,15 +841,27 @@ TEST_F(ResourcePrefetchPredictorTest, OnMainFrameRequest) { } TEST_F(ResourcePrefetchPredictorTest, OnMainFrameRedirect) { - URLRequestSummary summary1 = CreateURLRequestSummary( - 1, 1, "http://www.google.com", "http://www.google.com", - ResourceType::MAIN_FRAME, "", false); - URLRequestSummary summary2 = CreateURLRequestSummary( - 1, 2, "http://www.google.com", "http://www.google.com", - ResourceType::MAIN_FRAME, "", false); - URLRequestSummary summary3 = CreateURLRequestSummary( - 2, 1, "http://www.yahoo.com", "http://www.yahoo.com", - ResourceType::MAIN_FRAME, "", false); + URLRequestSummary summary1 = CreateURLRequestSummary(1, + 1, + "http://www.google.com", + "http://www.google.com", + ResourceType::MAIN_FRAME, + std::string(), + false); + URLRequestSummary summary2 = CreateURLRequestSummary(1, + 2, + "http://www.google.com", + "http://www.google.com", + ResourceType::MAIN_FRAME, + std::string(), + false); + URLRequestSummary summary3 = CreateURLRequestSummary(2, + 1, + "http://www.yahoo.com", + "http://www.yahoo.com", + ResourceType::MAIN_FRAME, + std::string(), + false); predictor_->OnMainFrameRedirect(summary1); EXPECT_TRUE(predictor_->inflight_navigations_.empty()); @@ -731,9 +888,14 @@ TEST_F(ResourcePrefetchPredictorTest, OnSubresourceResponse) { EXPECT_TRUE(predictor_->inflight_navigations_.empty()); // Add an inflight navigation. - URLRequestSummary main_frame1 = CreateURLRequestSummary( - 1, 1, "http://www.google.com", "http://www.google.com", - ResourceType::MAIN_FRAME, "", false); + URLRequestSummary main_frame1 = + CreateURLRequestSummary(1, + 1, + "http://www.google.com", + "http://www.google.com", + ResourceType::MAIN_FRAME, + std::string(), + false); predictor_->OnMainFrameRequest(main_frame1); EXPECT_EQ(1, static_cast<int>(predictor_->inflight_navigations_.size())); diff --git a/chrome/browser/predictors/resource_prefetcher_unittest.cc b/chrome/browser/predictors/resource_prefetcher_unittest.cc index 9d5ef5a..865c8af 100644 --- a/chrome/browser/predictors/resource_prefetcher_unittest.cc +++ b/chrome/browser/predictors/resource_prefetcher_unittest.cc @@ -111,7 +111,8 @@ class ResourcePrefetcherTest : public testing::Test { void OnReceivedRedirect(const std::string& url) { - prefetcher_->OnReceivedRedirect(GetInFlightRequest(url), GURL(""), NULL); + prefetcher_->OnReceivedRedirect( + GetInFlightRequest(url), GURL(std::string()), NULL); } void OnAuthRequired(const std::string& url) { prefetcher_->OnAuthRequired(GetInFlightRequest(url), NULL); diff --git a/chrome/browser/prefs/command_line_pref_store_unittest.cc b/chrome/browser/prefs/command_line_pref_store_unittest.cc index 5d2c939..1e23383 100644 --- a/chrome/browser/prefs/command_line_pref_store_unittest.cc +++ b/chrome/browser/prefs/command_line_pref_store_unittest.cc @@ -116,7 +116,7 @@ TEST(CommandLinePrefStoreTest, MultipleSwitches) { ASSERT_EQ(Value::TYPE_DICTIONARY, value->GetType()); ProxyConfigDictionary dict(static_cast<const DictionaryValue*>(value)); - std::string string_result = ""; + std::string string_result; ASSERT_TRUE(dict.GetProxyServer(&string_result)); EXPECT_EQ("proxy", string_result); @@ -172,9 +172,9 @@ TEST(CommandLinePrefStoreTest, ManualProxyModeInference) { store2->VerifyProxyMode(ProxyPrefs::MODE_PAC_SCRIPT); CommandLine cl3(CommandLine::NO_PROGRAM); - cl3.AppendSwitchASCII(switches::kProxyServer, ""); + cl3.AppendSwitchASCII(switches::kProxyServer, std::string()); scoped_refptr<TestCommandLinePrefStore> store3 = - new TestCommandLinePrefStore(&cl3); + new TestCommandLinePrefStore(&cl3); store3->VerifyProxyMode(ProxyPrefs::MODE_DIRECT); } diff --git a/chrome/browser/prefs/proxy_config_dictionary.cc b/chrome/browser/prefs/proxy_config_dictionary.cc index a99fa7c..b6db822 100644 --- a/chrome/browser/prefs/proxy_config_dictionary.cc +++ b/chrome/browser/prefs/proxy_config_dictionary.cc @@ -67,12 +67,20 @@ bool ProxyConfigDictionary::HasBypassList() const { // static DictionaryValue* ProxyConfigDictionary::CreateDirect() { - return CreateDictionary(ProxyPrefs::MODE_DIRECT, "", false, "", ""); + return CreateDictionary(ProxyPrefs::MODE_DIRECT, + std::string(), + false, + std::string(), + std::string()); } // static DictionaryValue* ProxyConfigDictionary::CreateAutoDetect() { - return CreateDictionary(ProxyPrefs::MODE_AUTO_DETECT, "", false, "", ""); + return CreateDictionary(ProxyPrefs::MODE_AUTO_DETECT, + std::string(), + false, + std::string(), + std::string()); } // static @@ -80,7 +88,10 @@ DictionaryValue* ProxyConfigDictionary::CreatePacScript( const std::string& pac_url, bool pac_mandatory) { return CreateDictionary(ProxyPrefs::MODE_PAC_SCRIPT, - pac_url, pac_mandatory, "", ""); + pac_url, + pac_mandatory, + std::string(), + std::string()); } // static @@ -88,8 +99,11 @@ DictionaryValue* ProxyConfigDictionary::CreateFixedServers( const std::string& proxy_server, const std::string& bypass_list) { if (!proxy_server.empty()) { - return CreateDictionary( - ProxyPrefs::MODE_FIXED_SERVERS, "", false, proxy_server, bypass_list); + return CreateDictionary(ProxyPrefs::MODE_FIXED_SERVERS, + std::string(), + false, + proxy_server, + bypass_list); } else { return CreateDirect(); } @@ -97,7 +111,11 @@ DictionaryValue* ProxyConfigDictionary::CreateFixedServers( // static DictionaryValue* ProxyConfigDictionary::CreateSystem() { - return CreateDictionary(ProxyPrefs::MODE_SYSTEM, "", false, "", ""); + return CreateDictionary(ProxyPrefs::MODE_SYSTEM, + std::string(), + false, + std::string(), + std::string()); } // static diff --git a/chrome/browser/prefs/proxy_policy_unittest.cc b/chrome/browser/prefs/proxy_policy_unittest.cc index ec51894..512e514 100644 --- a/chrome/browser/prefs/proxy_policy_unittest.cc +++ b/chrome/browser/prefs/proxy_policy_unittest.cc @@ -68,9 +68,9 @@ void assertBypassList(const ProxyConfigDictionary& dict, void assertProxyModeWithoutParams(const ProxyConfigDictionary& dict, ProxyPrefs::ProxyMode proxy_mode) { assertProxyMode(dict, proxy_mode); - assertProxyServer(dict, ""); - assertPacUrl(dict, ""); - assertBypassList(dict, ""); + assertProxyServer(dict, std::string()); + assertPacUrl(dict, std::string()); + assertBypassList(dict, std::string()); } } // namespace @@ -130,7 +130,7 @@ TEST_F(ProxyPolicyTest, OverridesCommandLineOptions) { ProxyConfigDictionary dict(prefs->GetDictionary(prefs::kProxy)); assertProxyMode(dict, ProxyPrefs::MODE_FIXED_SERVERS); assertProxyServer(dict, "789"); - assertPacUrl(dict, ""); + assertPacUrl(dict, std::string()); assertBypassList(dict, "123"); // Try a second time time with the managed PrefStore in place, the @@ -140,7 +140,7 @@ TEST_F(ProxyPolicyTest, OverridesCommandLineOptions) { ProxyConfigDictionary dict2(prefs->GetDictionary(prefs::kProxy)); assertProxyMode(dict2, ProxyPrefs::MODE_FIXED_SERVERS); assertProxyServer(dict2, "ghi"); - assertPacUrl(dict2, ""); + assertPacUrl(dict2, std::string()); assertBypassList(dict2, "abc"); } @@ -160,7 +160,7 @@ TEST_F(ProxyPolicyTest, OverridesUnrelatedCommandLineOptions) { ProxyConfigDictionary dict(prefs->GetDictionary(prefs::kProxy)); assertProxyMode(dict, ProxyPrefs::MODE_FIXED_SERVERS); assertProxyServer(dict, "789"); - assertPacUrl(dict, ""); + assertPacUrl(dict, std::string()); assertBypassList(dict, "123"); // Try a second time time with the managed PrefStore in place, the diff --git a/chrome/browser/prefs/session_startup_pref.cc b/chrome/browser/prefs/session_startup_pref.cc index d822cc0..fbbf62f 100644 --- a/chrome/browser/prefs/session_startup_pref.cc +++ b/chrome/browser/prefs/session_startup_pref.cc @@ -45,7 +45,7 @@ void URLListToPref(const base::ListValue* url_list, SessionStartupPref* pref) { for (size_t i = 0; i < url_list->GetSize(); ++i) { std::string url_text; if (url_list->GetString(i, &url_text)) { - GURL fixed_url = URLFixerUpper::FixupURL(url_text, ""); + GURL fixed_url = URLFixerUpper::FixupURL(url_text, std::string()); pref->urls.push_back(fixed_url); } } diff --git a/chrome/browser/prerender/prerender_contents.cc b/chrome/browser/prerender/prerender_contents.cc index ff32646..508ec89 100644 --- a/chrome/browser/prerender/prerender_contents.cc +++ b/chrome/browser/prerender/prerender_contents.cc @@ -465,8 +465,8 @@ WebContents* PrerenderContents::CreateWebContents( // TODO(ajwong): Remove the temporary map once prerendering is aware of // multiple session storage namespaces per tab. content::SessionStorageNamespaceMap session_storage_namespace_map; - session_storage_namespace_map[""] = session_storage_namespace; - return WebContents::CreateWithSessionStorage( + session_storage_namespace_map[std::string()] = session_storage_namespace; + return WebContents::CreateWithSessionStorage( WebContents::CreateParams(profile_), session_storage_namespace_map); } diff --git a/chrome/browser/prerender/prerender_histograms.cc b/chrome/browser/prerender/prerender_histograms.cc index d836cf8..325c00e 100644 --- a/chrome/browser/prerender/prerender_histograms.cc +++ b/chrome/browser/prerender/prerender_histograms.cc @@ -92,9 +92,9 @@ bool OriginIsOmnibox(Origin origin) { #define PREFIXED_HISTOGRAM_INTERNAL(origin, experiment, wash, HISTOGRAM, \ histogram_name) { \ { \ - /* Do not rename. HISTOGRAM expects a local variable "name". */ \ - std::string name = ComposeHistogramName("", histogram_name); \ - HISTOGRAM; \ + /* Do not rename. HISTOGRAM expects a local variable "name". */ \ + std::string name = ComposeHistogramName(std::string(), histogram_name); \ + HISTOGRAM; \ } \ /* Do not rename. HISTOGRAM expects a local variable "name". */ \ std::string name = GetHistogramName(origin, experiment, wash, \ diff --git a/chrome/browser/printing/cloud_print/cloud_print_setup_flow.cc b/chrome/browser/printing/cloud_print/cloud_print_setup_flow.cc index 299567a..131b45a 100644 --- a/chrome/browser/printing/cloud_print/cloud_print_setup_flow.cc +++ b/chrome/browser/printing/cloud_print/cloud_print_setup_flow.cc @@ -66,7 +66,7 @@ CloudPrintSetupFlow* CloudPrintSetupFlow::OpenDialog( chrome::GetActiveDesktop()); // Set the arguments for showing the gaia login page. DictionaryValue args; - args.SetString("user", ""); + args.SetString("user", std::string()); args.SetInteger("error", 0); args.SetBoolean("editable_user", true); diff --git a/chrome/browser/printing/cloud_print/cloud_print_setup_source.cc b/chrome/browser/printing/cloud_print/cloud_print_setup_source.cc index 7bb6d73..8c18da8 100644 --- a/chrome/browser/printing/cloud_print/cloud_print_setup_source.cc +++ b/chrome/browser/printing/cloud_print/cloud_print_setup_source.cc @@ -87,7 +87,7 @@ void CloudPrintSetupSource::StartDataRequest( // None of the strings used here currently have sync-specific wording in // them. There is a unit test to catch if that happens. - dict->SetString("introduction", ""); + dict->SetString("introduction", std::string()); AddString(dict, "signinprefix", IDS_SYNC_LOGIN_SIGNIN_PREFIX); AddString(dict, "signinsuffix", IDS_SYNC_LOGIN_SIGNIN_SUFFIX); AddString(dict, "cannotbeblank", IDS_SYNC_CANNOT_BE_BLANK); diff --git a/chrome/browser/printing/print_dialog_cloud_interative_uitest.cc b/chrome/browser/printing/print_dialog_cloud_interative_uitest.cc index 2529a1d..eb8eef4 100644 --- a/chrome/browser/printing/print_dialog_cloud_interative_uitest.cc +++ b/chrome/browser/printing/print_dialog_cloud_interative_uitest.cc @@ -251,7 +251,7 @@ net::URLRequestJob* PrintDialogCloudTest::Factory( return new net::URLRequestTestJob(request, network_delegate, net::URLRequestTestJob::test_headers(), - "", + std::string(), true); } diff --git a/chrome/browser/printing/print_dialog_cloud_unittest.cc b/chrome/browser/printing/print_dialog_cloud_unittest.cc index 217fa53..ce50f28 100644 --- a/chrome/browser/printing/print_dialog_cloud_unittest.cc +++ b/chrome/browser/printing/print_dialog_cloud_unittest.cc @@ -270,7 +270,7 @@ TEST_F(CloudPrintDataSenderTest, NoData) { TEST_F(CloudPrintDataSenderTest, EmptyData) { EXPECT_CALL(*mock_helper_, CallJavascriptFunction(_, _, _)).Times(0); - std::string data(""); + std::string data; scoped_refptr<CloudPrintDataSender> print_data_sender( CreateSender(base::RefCountedString::TakeString(&data))); base::FilePath test_data_file_name = GetTestDataFileName(); diff --git a/chrome/browser/profiles/gaia_info_update_service_factory.cc b/chrome/browser/profiles/gaia_info_update_service_factory.cc index 88ef612..f8f46f7 100644 --- a/chrome/browser/profiles/gaia_info_update_service_factory.cc +++ b/chrome/browser/profiles/gaia_info_update_service_factory.cc @@ -39,7 +39,8 @@ void GAIAInfoUpdateServiceFactory::RegisterUserPrefs( PrefRegistrySyncable* prefs) { prefs->RegisterInt64Pref(prefs::kProfileGAIAInfoUpdateTime, 0, PrefRegistrySyncable::UNSYNCABLE_PREF); - prefs->RegisterStringPref(prefs::kProfileGAIAInfoPictureURL, "", + prefs->RegisterStringPref(prefs::kProfileGAIAInfoPictureURL, + std::string(), PrefRegistrySyncable::UNSYNCABLE_PREF); } diff --git a/chrome/browser/profiles/gaia_info_update_service_unittest.cc b/chrome/browser/profiles/gaia_info_update_service_unittest.cc index dd85970..37dfdd7 100644 --- a/chrome/browser/profiles/gaia_info_update_service_unittest.cc +++ b/chrome/browser/profiles/gaia_info_update_service_unittest.cc @@ -184,7 +184,8 @@ TEST_F(GAIAInfoUpdateServiceTest, LogOut) { GAIAInfoUpdateService service(profile()); EXPECT_FALSE(service.GetCachedPictureURL().empty()); // Log out. - profile()->GetPrefs()->SetString(prefs::kGoogleServicesUsername, ""); + profile()->GetPrefs() + ->SetString(prefs::kGoogleServicesUsername, std::string()); // Verify that the GAIA name and picture, and picture URL are unset. EXPECT_TRUE(GetCache()->GetGAIANameOfProfileAtIndex(0).empty()); @@ -193,7 +194,8 @@ TEST_F(GAIAInfoUpdateServiceTest, LogOut) { } TEST_F(GAIAInfoUpdateServiceTest, LogIn) { - profile()->GetPrefs()->SetString(prefs::kGoogleServicesUsername, ""); + profile()->GetPrefs() + ->SetString(prefs::kGoogleServicesUsername, std::string()); GAIAInfoUpdateServiceMock service(profile()); // Log in. diff --git a/chrome/browser/profiles/profile_downloader_unittest.cc b/chrome/browser/profiles/profile_downloader_unittest.cc index 2e47968..5346694 100644 --- a/chrome/browser/profiles/profile_downloader_unittest.cc +++ b/chrome/browser/profiles/profile_downloader_unittest.cc @@ -68,25 +68,25 @@ TEST_F(ProfileDownloaderTest, ParseData) { true); // Data with only name. - VerifyWithNameAndURL("Pat Smith", "", "", true); + VerifyWithNameAndURL("Pat Smith", std::string(), std::string(), true); // Data with only URL. VerifyWithNameAndURL( - "", + std::string(), "https://example.com/--Abc/AAAAAAAAAAI/AAAAAAAAACQ/Efg/photo.jpg", "https://example.com/--Abc/AAAAAAAAAAI/AAAAAAAAACQ/Efg/s32-c/photo.jpg", true); // Data without name or URL. - VerifyWithNameAndURL("", "", "", false); + VerifyWithNameAndURL(std::string(), std::string(), std::string(), false); // Data with an invalid URL. - VerifyWithNameAndURL( "", "invalid url", "", false); + VerifyWithNameAndURL(std::string(), "invalid url", std::string(), false); } TEST_F(ProfileDownloaderTest, DefaultURL) { // Empty URL should be default photo - EXPECT_TRUE(ProfileDownloader::IsDefaultProfileImageURL("")); + EXPECT_TRUE(ProfileDownloader::IsDefaultProfileImageURL(std::string())); // Picasa default photo EXPECT_TRUE(ProfileDownloader::IsDefaultProfileImageURL( "https://example.com/-4/AAAAAAAAAAA/AAAAAAAAAAE/G/s64-c/photo.jpg")); diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc index f99cbba..a068fb3 100644 --- a/chrome/browser/profiles/profile_impl.cc +++ b/chrome/browser/profiles/profile_impl.cc @@ -289,9 +289,8 @@ void ProfileImpl::RegisterUserPrefs(PrefRegistrySyncable* registry) { registry->RegisterIntegerPref(prefs::kProfileAvatarIndex, -1, PrefRegistrySyncable::SYNCABLE_PREF); - registry->RegisterStringPref(prefs::kProfileName, - "", - PrefRegistrySyncable::SYNCABLE_PREF); + registry->RegisterStringPref( + prefs::kProfileName, std::string(), PrefRegistrySyncable::SYNCABLE_PREF); registry->RegisterBooleanPref(prefs::kProfileIsManaged, false, PrefRegistrySyncable::SYNCABLE_PREF); diff --git a/chrome/browser/profiles/profile_manager.cc b/chrome/browser/profiles/profile_manager.cc index 59f2e69..69da963 100644 --- a/chrome/browser/profiles/profile_manager.cc +++ b/chrome/browser/profiles/profile_manager.cc @@ -890,7 +890,7 @@ void ProfileManager::CreateMultiProfileAsync( // static void ProfileManager::RegisterPrefs(PrefRegistrySimple* registry) { - registry->RegisterStringPref(prefs::kProfileLastUsed, ""); + registry->RegisterStringPref(prefs::kProfileLastUsed, std::string()); registry->RegisterIntegerPref(prefs::kProfilesNumCreated, 1); registry->RegisterListPref(prefs::kProfilesLastActive); } diff --git a/chrome/browser/referrer_policy_browsertest.cc b/chrome/browser/referrer_policy_browsertest.cc index 83a32b4..0b9f40f 100644 --- a/chrome/browser/referrer_policy_browsertest.cc +++ b/chrome/browser/referrer_policy_browsertest.cc @@ -376,7 +376,7 @@ IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, History) { EXPECT_ORIGIN_AS_REFERRER); // Navigate to C. - ui_test_utils::NavigateToURL(browser(), test_server_->GetURL("")); + ui_test_utils::NavigateToURL(browser(), test_server_->GetURL(std::string())); string16 expected_title = GetExpectedTitle(start_url, EXPECT_ORIGIN_AS_REFERRER); diff --git a/chrome/browser/renderer_host/pepper/pepper_flash_clipboard_message_filter.cc b/chrome/browser/renderer_host/pepper/pepper_flash_clipboard_message_filter.cc index f39e75a..be2ce33 100644 --- a/chrome/browser/renderer_host/pepper/pepper_flash_clipboard_message_filter.cc +++ b/chrome/browser/renderer_host/pepper/pepper_flash_clipboard_message_filter.cc @@ -316,7 +316,7 @@ int32_t PepperFlashClipboardMessageFilter::OnMsgWriteData( scw.WriteText(UTF8ToUTF16(data[i])); break; case PP_FLASH_CLIPBOARD_FORMAT_HTML: - scw.WriteHTML(UTF8ToUTF16(data[i]), ""); + scw.WriteHTML(UTF8ToUTF16(data[i]), std::string()); break; case PP_FLASH_CLIPBOARD_FORMAT_RTF: scw.WriteRTF(data[i]); diff --git a/chrome/browser/safe_browsing/browser_feature_extractor.cc b/chrome/browser/safe_browsing/browser_feature_extractor.cc index 142f375..a40c66d 100644 --- a/chrome/browser/safe_browsing/browser_feature_extractor.cc +++ b/chrome/browser/safe_browsing/browser_feature_extractor.cc @@ -208,8 +208,8 @@ void BrowserFeatureExtractor::ExtractFeatures(const BrowseInfo* info, // 2) The first url on the same host as the candidate url (assuming that // it's different from the candidate url). if (url_index != -1) { - AddNavigationFeatures("", controller, url_index, info->url_redirects, - request); + AddNavigationFeatures( + std::string(), controller, url_index, info->url_redirects, request); } if (first_host_index != -1) { AddNavigationFeatures(features::kHostPrefix, diff --git a/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc b/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc index 74ec857..ec8b4e3 100644 --- a/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc +++ b/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc @@ -635,11 +635,11 @@ TEST_F(ClientSideDetectionHostTest, UpdateIPHostMap) { BrowseInfo* browse_info = GetBrowseInfo(); // Empty IP or host are skipped - UpdateIPHostMap("250.10.10.10", ""); + UpdateIPHostMap("250.10.10.10", std::string()); ASSERT_EQ(0U, browse_info->ips.size()); - UpdateIPHostMap("", "google.com/"); + UpdateIPHostMap(std::string(), "google.com/"); ASSERT_EQ(0U, browse_info->ips.size()); - UpdateIPHostMap("", ""); + UpdateIPHostMap(std::string(), std::string()); ASSERT_EQ(0U, browse_info->ips.size()); std::set<std::string> expected_hosts; diff --git a/chrome/browser/safe_browsing/client_side_detection_service_unittest.cc b/chrome/browser/safe_browsing/client_side_detection_service_unittest.cc index f5fd98b..ed533604 100644 --- a/chrome/browser/safe_browsing/client_side_detection_service_unittest.cc +++ b/chrome/browser/safe_browsing/client_side_detection_service_unittest.cc @@ -252,9 +252,8 @@ TEST_F(ClientSideDetectionServiceTest, FetchModelTest) { Mock::VerifyAndClearExpectations(&service); // Empty model file. - SetModelFetchResponse("", true /* success */); - EXPECT_CALL(service, EndFetchModel( - ClientSideDetectionService::MODEL_EMPTY)) + SetModelFetchResponse(std::string(), true /* success */); + EXPECT_CALL(service, EndFetchModel(ClientSideDetectionService::MODEL_EMPTY)) .WillOnce(QuitCurrentMessageLoop()); service.StartFetchModel(); msg_loop_.Run(); // EndFetchModel will quit the message loop. @@ -576,7 +575,7 @@ TEST_F(ClientSideDetectionServiceTest, IsBadIpAddress) { ClientSideDetectionService::SetBadSubnets( model, &(csd_service_->bad_subnets_)); EXPECT_FALSE(csd_service_->IsBadIpAddress("blabla")); - EXPECT_FALSE(csd_service_->IsBadIpAddress("")); + EXPECT_FALSE(csd_service_->IsBadIpAddress(std::string())); EXPECT_TRUE(csd_service_->IsBadIpAddress( "2620:0:1000:3103:21a:a0ff:fe10:786e")); diff --git a/chrome/browser/safe_browsing/download_protection_service_unittest.cc b/chrome/browser/safe_browsing/download_protection_service_unittest.cc index e8da2ee..af98856 100644 --- a/chrome/browser/safe_browsing/download_protection_service_unittest.cc +++ b/chrome/browser/safe_browsing/download_protection_service_unittest.cc @@ -390,7 +390,7 @@ TEST_F(DownloadProtectionServiceTest, CheckClientDownloadFetchFailed) { net::FakeURLFetcherFactory factory(NULL); // HTTP request will fail. factory.SetFakeResponse( - DownloadProtectionService::GetDownloadRequestUrl(), "", false); + DownloadProtectionService::GetDownloadRequestUrl(), std::string(), false); base::FilePath a_tmp(FILE_PATH_LITERAL("a.tmp")); base::FilePath a_exe(FILE_PATH_LITERAL("a.exe")); diff --git a/chrome/browser/safe_browsing/malware_details.cc b/chrome/browser/safe_browsing/malware_details.cc index 41cf690..7eb336d 100644 --- a/chrome/browser/safe_browsing/malware_details.cc +++ b/chrome/browser/safe_browsing/malware_details.cc @@ -178,16 +178,16 @@ void MalwareDetails::StartCollection() { } // Add the nodes, starting from the page url. - AddUrl(page_url, GURL(), "", NULL); + AddUrl(page_url, GURL(), std::string(), NULL); // Add the resource_url and its original url, if non-empty and different. if (!resource_.original_url.is_empty() && resource_.url != resource_.original_url) { // Add original_url, as the parent of resource_url. - AddUrl(resource_.original_url, GURL(), "", NULL); - AddUrl(resource_.url, resource_.original_url, "", NULL); + AddUrl(resource_.original_url, GURL(), std::string(), NULL); + AddUrl(resource_.url, resource_.original_url, std::string(), NULL); } else { - AddUrl(resource_.url, GURL(), "", NULL); + AddUrl(resource_.url, GURL(), std::string(), NULL); } // Add the redirect urls, if non-empty. The redirect urls do not include the @@ -201,13 +201,13 @@ void MalwareDetails::StartCollection() { } // Set the previous redirect url as the parent of the next one for (unsigned int i = 0; i < resource_.redirect_urls.size(); ++i) { - AddUrl(resource_.redirect_urls[i], parent_url, "", NULL); + AddUrl(resource_.redirect_urls[i], parent_url, std::string(), NULL); parent_url = resource_.redirect_urls[i]; } // Add the referrer url. if (nav_entry && !referrer_url.is_empty()) { - AddUrl(referrer_url, GURL(), "", NULL); + AddUrl(referrer_url, GURL(), std::string(), NULL); } // Get URLs of frames, scripts etc from the DOM. @@ -287,7 +287,7 @@ void MalwareDetails::OnRedirectionCollectionReady() { void MalwareDetails::AddRedirectUrlList(const std::vector<GURL>& urls) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); for (size_t i = 0; i < urls.size()-1; ++i) { - AddUrl(urls[i], urls[i+1], "", NULL); + AddUrl(urls[i], urls[i + 1], std::string(), NULL); } } diff --git a/chrome/browser/safe_browsing/ping_manager.cc b/chrome/browser/safe_browsing/ping_manager.cc index 6e73985..56580d00 100644 --- a/chrome/browser/safe_browsing/ping_manager.cc +++ b/chrome/browser/safe_browsing/ping_manager.cc @@ -113,7 +113,7 @@ GURL SafeBrowsingPingManager::SafeBrowsingHitUrl( threat_type == SB_THREAT_TYPE_BINARY_MALWARE_HASH || threat_type == SB_THREAT_TYPE_CLIENT_SIDE_PHISHING_URL); std::string url = SafeBrowsingProtocolManagerHelper::ComposeUrl( - url_prefix_, "report", client_name_, version_, ""); + url_prefix_, "report", client_name_, version_, std::string()); std::string threat_list = "none"; switch (threat_type) { case SB_THREAT_TYPE_URL_MALWARE: diff --git a/chrome/browser/safe_browsing/protocol_manager_unittest.cc b/chrome/browser/safe_browsing/protocol_manager_unittest.cc index 0bd9c3a..ca89ce5 100644 --- a/chrome/browser/safe_browsing/protocol_manager_unittest.cc +++ b/chrome/browser/safe_browsing/protocol_manager_unittest.cc @@ -378,7 +378,7 @@ TEST_F(SafeBrowsingProtocolManagerTest, ExistingDatabase) { url_fetcher->set_status(net::URLRequestStatus()); url_fetcher->set_response_code(200); - url_fetcher->SetResponseString(""); + url_fetcher->SetResponseString(std::string()); url_fetcher->delegate()->OnURLFetchComplete(url_fetcher); EXPECT_TRUE(pm->IsUpdateScheduled()); @@ -424,7 +424,7 @@ TEST_F(SafeBrowsingProtocolManagerTest, UpdateResponseBadBodyBackupSuccess) { // Respond to the backup successfully. backup_url_fetcher->set_status(net::URLRequestStatus()); backup_url_fetcher->set_response_code(200); - backup_url_fetcher->SetResponseString(""); + backup_url_fetcher->SetResponseString(std::string()); backup_url_fetcher->delegate()->OnURLFetchComplete(backup_url_fetcher); EXPECT_TRUE(pm->IsUpdateScheduled()); @@ -460,7 +460,7 @@ TEST_F(SafeBrowsingProtocolManagerTest, UpdateResponseHttpErrorBackupError) { // Go ahead and respond to it. url_fetcher->set_status(net::URLRequestStatus()); url_fetcher->set_response_code(404); - url_fetcher->SetResponseString(""); + url_fetcher->SetResponseString(std::string()); url_fetcher->delegate()->OnURLFetchComplete(url_fetcher); // There should now be a backup request. @@ -471,7 +471,7 @@ TEST_F(SafeBrowsingProtocolManagerTest, UpdateResponseHttpErrorBackupError) { // Respond to the backup unsuccessfully. backup_url_fetcher->set_status(net::URLRequestStatus()); backup_url_fetcher->set_response_code(404); - backup_url_fetcher->SetResponseString(""); + backup_url_fetcher->SetResponseString(std::string()); backup_url_fetcher->delegate()->OnURLFetchComplete(backup_url_fetcher); EXPECT_TRUE(pm->IsUpdateScheduled()); @@ -507,7 +507,7 @@ TEST_F(SafeBrowsingProtocolManagerTest, UpdateResponseHttpErrorBackupSuccess) { // Go ahead and respond to it. url_fetcher->set_status(net::URLRequestStatus()); url_fetcher->set_response_code(404); - url_fetcher->SetResponseString(""); + url_fetcher->SetResponseString(std::string()); url_fetcher->delegate()->OnURLFetchComplete(url_fetcher); // There should now be a backup request. @@ -519,7 +519,7 @@ TEST_F(SafeBrowsingProtocolManagerTest, UpdateResponseHttpErrorBackupSuccess) { // Respond to the backup successfully. backup_url_fetcher->set_status(net::URLRequestStatus()); backup_url_fetcher->set_response_code(200); - backup_url_fetcher->SetResponseString(""); + backup_url_fetcher->SetResponseString(std::string()); backup_url_fetcher->delegate()->OnURLFetchComplete(backup_url_fetcher); EXPECT_TRUE(pm->IsUpdateScheduled()); @@ -555,7 +555,7 @@ TEST_F(SafeBrowsingProtocolManagerTest, UpdateResponseHttpErrorBackupTimeout) { // Go ahead and respond to it. url_fetcher->set_status(net::URLRequestStatus()); url_fetcher->set_response_code(404); - url_fetcher->SetResponseString(""); + url_fetcher->SetResponseString(std::string()); url_fetcher->delegate()->OnURLFetchComplete(url_fetcher); // There should now be a backup request. @@ -617,7 +617,7 @@ TEST_F(SafeBrowsingProtocolManagerTest, // Respond to the backup unsuccessfully. backup_url_fetcher->set_status(net::URLRequestStatus()); backup_url_fetcher->set_response_code(404); - backup_url_fetcher->SetResponseString(""); + backup_url_fetcher->SetResponseString(std::string()); backup_url_fetcher->delegate()->OnURLFetchComplete(backup_url_fetcher); EXPECT_TRUE(pm->IsUpdateScheduled()); @@ -665,7 +665,7 @@ TEST_F(SafeBrowsingProtocolManagerTest, // Respond to the backup unsuccessfully. backup_url_fetcher->set_status(net::URLRequestStatus()); backup_url_fetcher->set_response_code(200); - backup_url_fetcher->SetResponseString(""); + backup_url_fetcher->SetResponseString(std::string()); backup_url_fetcher->delegate()->OnURLFetchComplete(backup_url_fetcher); EXPECT_TRUE(pm->IsUpdateScheduled()); @@ -713,7 +713,7 @@ TEST_F(SafeBrowsingProtocolManagerTest, // Respond to the backup unsuccessfully. backup_url_fetcher->set_status(net::URLRequestStatus()); backup_url_fetcher->set_response_code(404); - backup_url_fetcher->SetResponseString(""); + backup_url_fetcher->SetResponseString(std::string()); backup_url_fetcher->delegate()->OnURLFetchComplete(backup_url_fetcher); EXPECT_TRUE(pm->IsUpdateScheduled()); @@ -762,7 +762,7 @@ TEST_F(SafeBrowsingProtocolManagerTest, // Respond to the backup unsuccessfully. backup_url_fetcher->set_status(net::URLRequestStatus()); backup_url_fetcher->set_response_code(200); - backup_url_fetcher->SetResponseString(""); + backup_url_fetcher->SetResponseString(std::string()); backup_url_fetcher->delegate()->OnURLFetchComplete(backup_url_fetcher); EXPECT_TRUE(pm->IsUpdateScheduled()); @@ -807,7 +807,7 @@ TEST_F(SafeBrowsingProtocolManagerTest, UpdateResponseTimeoutBackupSuccess) { // Respond to the backup unsuccessfully. backup_url_fetcher->set_status(net::URLRequestStatus()); backup_url_fetcher->set_response_code(200); - backup_url_fetcher->SetResponseString(""); + backup_url_fetcher->SetResponseString(std::string()); backup_url_fetcher->delegate()->OnURLFetchComplete(backup_url_fetcher); EXPECT_TRUE(pm->IsUpdateScheduled()); @@ -888,7 +888,7 @@ TEST_F(SafeBrowsingProtocolManagerTest, EmptyRedirectResponse) { chunk_url_fetcher, "https://redirect-server.example.com/path"); chunk_url_fetcher->set_status(net::URLRequestStatus()); chunk_url_fetcher->set_response_code(200); - chunk_url_fetcher->SetResponseString(""); + chunk_url_fetcher->SetResponseString(std::string()); chunk_url_fetcher->delegate()->OnURLFetchComplete(chunk_url_fetcher); EXPECT_TRUE(pm->IsUpdateScheduled()); diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc b/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc index 3d0f2d9..032d5ec 100644 --- a/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc +++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc @@ -1004,8 +1004,8 @@ void SafeBrowsingBlockingPageV2::PopulateMalwareStringDictionary( if (!CanShowMalwareDetailsOption()) { strings->SetBoolean(kDisplayCheckBox, false); - strings->SetString("confirm_text", ""); - strings->SetString(kBoxChecked, ""); + strings->SetString("confirm_text", std::string()); + strings->SetString(kBoxChecked, std::string()); } else { // Show the checkbox for sending malware details. strings->SetBoolean(kDisplayCheckBox, true); @@ -1022,7 +1022,7 @@ void SafeBrowsingBlockingPageV2::PopulateMalwareStringDictionary( if (IsPrefEnabled(prefs::kSafeBrowsingReportingEnabled)) strings->SetString(kBoxChecked, "yes"); else - strings->SetString(kBoxChecked, ""); + strings->SetString(kBoxChecked, std::string()); } strings->SetString("report_error", string16()); @@ -1042,10 +1042,11 @@ void SafeBrowsingBlockingPageV2::PopulatePhishingStringDictionary( string16(), l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_PHISHING_V2_DESCRIPTION2)); - strings->SetString("details", ""); - strings->SetString("confirm_text", ""); - strings->SetString(kBoxChecked, ""); - strings->SetString("report_error", + strings->SetString("details", std::string()); + strings->SetString("confirm_text", std::string()); + strings->SetString(kBoxChecked, std::string()); + strings->SetString( + "report_error", l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_PHISHING_V2_REPORT_ERROR)); strings->SetBoolean(kDisplayCheckBox, false); strings->SetString("learnMore", diff --git a/chrome/browser/safe_browsing/safe_browsing_util.cc b/chrome/browser/safe_browsing/safe_browsing_util.cc index ef620a7..7e6710f 100644 --- a/chrome/browser/safe_browsing/safe_browsing_util.cc +++ b/chrome/browser/safe_browsing/safe_browsing_util.cc @@ -298,8 +298,10 @@ void CanonicalizeUrl(const GURL& url, url_unescaped_str.length(), &parsed); // 3. In hostname, remove all leading and trailing dots. - const std::string host = (parsed.host.len > 0) ? url_unescaped_str.substr( - parsed.host.begin, parsed.host.len) : ""; + const std::string host = + (parsed.host.len > 0) + ? url_unescaped_str.substr(parsed.host.begin, parsed.host.len) + : std::string(); const char kCharsToTrim[] = "."; std::string host_without_end_dots; TrimString(host, kCharsToTrim, &host_without_end_dots); @@ -309,10 +311,11 @@ void CanonicalizeUrl(const GURL& url, host_without_end_dots, '.')); // 5. In path, replace runs of consecutive slashes with a single slash. - std::string path = (parsed.path.len > 0) ? url_unescaped_str.substr( - parsed.path.begin, parsed.path.len): ""; - std::string path_without_consecutive_slash(RemoveConsecutiveChars( - path, '/')); + std::string path = + (parsed.path.len > 0) + ? url_unescaped_str.substr(parsed.path.begin, parsed.path.len) + : std::string(); + std::string path_without_consecutive_slash(RemoveConsecutiveChars(path, '/')); url_canon::Replacements<char> hp_replacements; hp_replacements.SetHost(host_without_consecutive_dots.data(), diff --git a/chrome/browser/safe_browsing/two_phase_uploader.cc b/chrome/browser/safe_browsing/two_phase_uploader.cc index 9b6165e..df58625 100644 --- a/chrome/browser/safe_browsing/two_phase_uploader.cc +++ b/chrome/browser/safe_browsing/two_phase_uploader.cc @@ -63,7 +63,7 @@ void TwoPhaseUploader::OnURLFetchComplete(const net::URLFetcher* source) { if (!status.is_success()) { LOG(ERROR) << "URLFetcher failed, status=" << status.status() << " err=" << status.error(); - Finish(status.error(), response_code, ""); + Finish(status.error(), response_code, std::string()); return; } @@ -83,7 +83,7 @@ void TwoPhaseUploader::OnURLFetchComplete(const net::URLFetcher* source) { if (!source->GetResponseHeaders()->EnumerateHeader( NULL, kLocationHeader, &location)) { LOG(ERROR) << "no location header"; - Finish(net::OK, response_code, ""); + Finish(net::OK, response_code, std::string()); return; } DVLOG(1) << "upload location: " << location; diff --git a/chrome/browser/search/local_ntp_source.cc b/chrome/browser/search/local_ntp_source.cc index d1fde35..38cbd7a 100644 --- a/chrome/browser/search/local_ntp_source.cc +++ b/chrome/browser/search/local_ntp_source.cc @@ -74,7 +74,7 @@ std::string LocalNtpSource::GetMimeType( path == kCloseBarActiveFilename) { return "image/png"; } - return ""; + return std::string(); } bool LocalNtpSource::ShouldServiceRequest( diff --git a/chrome/browser/search/local_omnibox_popup_source.cc b/chrome/browser/search/local_omnibox_popup_source.cc index 1ae3c8a..fa2d940 100644 --- a/chrome/browser/search/local_omnibox_popup_source.cc +++ b/chrome/browser/search/local_omnibox_popup_source.cc @@ -76,7 +76,7 @@ std::string LocalOmniboxPopupSource::GetMimeType( if (path == kPageIconFilename || path == kPageIcon2xFilename || path == kSearchIconFilename || path == kSearchIcon2xFilename) return "image/png"; - return ""; + return std::string(); } bool LocalOmniboxPopupSource::ShouldServiceRequest( diff --git a/chrome/browser/search/search.cc b/chrome/browser/search/search.cc index 83186b4..726bc89 100644 --- a/chrome/browser/search/search.cc +++ b/chrome/browser/search/search.cc @@ -527,7 +527,8 @@ uint64 GetUInt64ValueForFlagWithDefault(const std::string& flag, uint64 default_value, const FieldTrialFlags& flags) { uint64 value; - std::string str_value = GetStringValueForFlagWithDefault(flag, "", flags); + std::string str_value = + GetStringValueForFlagWithDefault(flag, std::string(), flags); if (base::StringToUint64(str_value, &value)) return value; return default_value; diff --git a/chrome/browser/search/search_unittest.cc b/chrome/browser/search/search_unittest.cc index 90ff642b..7c4bf4c 100644 --- a/chrome/browser/search/search_unittest.cc +++ b/chrome/browser/search/search_unittest.cc @@ -22,7 +22,7 @@ TEST(EmbeddedSearchFieldTrialTest, GetFieldTrialInfo) { uint64 group_number = 0; const uint64 ZERO = 0; - EXPECT_FALSE(GetFieldTrialInfo("", &flags, &group_number)); + EXPECT_FALSE(GetFieldTrialInfo(std::string(), &flags, &group_number)); EXPECT_EQ(ZERO, group_number); EXPECT_EQ(ZERO, flags.size()); @@ -62,9 +62,10 @@ TEST(EmbeddedSearchFieldTrialTest, GetFieldTrialInfo) { EXPECT_EQ(uint64(3), flags.size()); EXPECT_EQ(true, GetBoolValueForFlagWithDefault("bar", false, flags)); EXPECT_EQ(uint64(7), GetUInt64ValueForFlagWithDefault("baz", 0, flags)); - EXPECT_EQ("dogs", GetStringValueForFlagWithDefault("cat", "", flags)); - EXPECT_EQ("default", GetStringValueForFlagWithDefault( - "moose", "default", flags)); + EXPECT_EQ("dogs", + GetStringValueForFlagWithDefault("cat", std::string(), flags)); + EXPECT_EQ("default", + GetStringValueForFlagWithDefault("moose", "default", flags)); group_number = 0; flags.clear(); diff --git a/chrome/browser/search_engines/template_url_prepopulate_data_unittest.cc b/chrome/browser/search_engines/template_url_prepopulate_data_unittest.cc index 3237137..aa47992 100644 --- a/chrome/browser/search_engines/template_url_prepopulate_data_unittest.cc +++ b/chrome/browser/search_engines/template_url_prepopulate_data_unittest.cc @@ -167,7 +167,7 @@ TEST(TemplateURLPrepopulateDataTest, ProvidersFromPrefs) { entry->SetInteger("id", 1002); entry->SetString("name", "bar"); entry->SetString("keyword", "bark"); - entry->SetString("encoding", ""); + entry->SetString("encoding", std::string()); overrides->Append(entry->DeepCopy()); entry->SetInteger("id", 1003); entry->SetString("name", "baz"); diff --git a/chrome/browser/sessions/session_restore_browsertest.cc b/chrome/browser/sessions/session_restore_browsertest.cc index 5e2953a..e82391e 100644 --- a/chrome/browser/sessions/session_restore_browsertest.cc +++ b/chrome/browser/sessions/session_restore_browsertest.cc @@ -985,7 +985,7 @@ IN_PROC_BROWSER_TEST_F(SessionRestoreTest, SessionStorageAfterTabReplace) { ASSERT_TRUE(controller->GetDefaultSessionStorageNamespace()); content::SessionStorageNamespaceMap session_storage_namespace_map; - session_storage_namespace_map[""] = + session_storage_namespace_map[std::string()] = controller->GetDefaultSessionStorageNamespace(); scoped_ptr<content::WebContents> web_contents( content::WebContents::CreateWithSessionStorage( diff --git a/chrome/browser/shell_integration_linux.cc b/chrome/browser/shell_integration_linux.cc index 2a656fe..c0be6de 100644 --- a/chrome/browser/shell_integration_linux.cc +++ b/chrome/browser/shell_integration_linux.cc @@ -435,7 +435,7 @@ ShellIntegration::DefaultWebClientSetPermission // static bool ShellIntegration::SetAsDefaultBrowser() { - return SetDefaultWebClient(""); + return SetDefaultWebClient(std::string()); } // static @@ -445,7 +445,7 @@ bool ShellIntegration::SetAsDefaultProtocolClient(const std::string& protocol) { // static ShellIntegration::DefaultWebClientState ShellIntegration::GetDefaultBrowser() { - return GetIsDefaultWebClient(""); + return GetIsDefaultWebClient(std::string()); } // static diff --git a/chrome/browser/shell_integration_unittest.cc b/chrome/browser/shell_integration_unittest.cc index 0b81311..8715114 100644 --- a/chrome/browser/shell_integration_unittest.cc +++ b/chrome/browser/shell_integration_unittest.cc @@ -644,7 +644,7 @@ TEST(ShellIntegrationTest, GetDesktopFileContents) { test_cases[i].template_contents, web_app::GenerateApplicationNameFromURL(GURL(test_cases[i].url)), GURL(test_cases[i].url), - "", + std::string(), base::FilePath(), ASCIIToUTF16(test_cases[i].title), test_cases[i].icon_name, diff --git a/chrome/browser/signin/about_signin_internals.cc b/chrome/browser/signin/about_signin_internals.cc index ad83b0d..e58a013 100644 --- a/chrome/browser/signin/about_signin_internals.cc +++ b/chrome/browser/signin/about_signin_internals.cc @@ -25,7 +25,8 @@ AboutSigninInternals::AboutSigninInternals() : profile_(NULL) { for (size_t i = 0; i < kNumTokenPrefs; ++i) { signin_status_.token_info_map.insert(std::pair<std::string, TokenInfo>( kTokenPrefsArray[i], - TokenInfo("", "Not Loaded", "", kTokenPrefsArray[i]))); + TokenInfo( + std::string(), "Not Loaded", std::string(), kTokenPrefsArray[i]))); } } @@ -170,7 +171,7 @@ void AboutSigninInternals::NotifyTokenReceivedFailure( const std::string value_pref = TokenPrefPath(token_name) + ".value"; const std::string time_pref = TokenPrefPath(token_name) + ".time"; const std::string status_pref = TokenPrefPath(token_name) + ".status"; - profile_->GetPrefs()->SetString(value_pref.c_str(), ""); + profile_->GetPrefs()->SetString(value_pref.c_str(), std::string()); profile_->GetPrefs()->SetString(time_pref.c_str(), time_as_str); profile_->GetPrefs()->SetString(status_pref.c_str(), error); @@ -186,7 +187,7 @@ void AboutSigninInternals::NotifyClearStoredToken( signin_status_.token_info_map[token_name].token.clear(); const std::string value_pref = TokenPrefPath(token_name) + ".value"; - profile_->GetPrefs()->SetString(value_pref.c_str(), ""); + profile_->GetPrefs()->SetString(value_pref.c_str(), std::string()); NotifyObservers(); } diff --git a/chrome/browser/signin/about_signin_internals_factory.cc b/chrome/browser/signin/about_signin_internals_factory.cc index ccce353..f5f197f 100644 --- a/chrome/browser/signin/about_signin_internals_factory.cc +++ b/chrome/browser/signin/about_signin_internals_factory.cc @@ -42,7 +42,8 @@ void AboutSigninInternalsFactory::RegisterUserPrefs( for (int i = UNTIMED_FIELDS_BEGIN; i < UNTIMED_FIELDS_END; ++i) { const std::string pref_path = SigninStatusFieldToString( static_cast<UntimedSigninStatusField>(i)); - user_prefs->RegisterStringPref(pref_path.c_str(), "", + user_prefs->RegisterStringPref(pref_path.c_str(), + std::string(), PrefRegistrySyncable::UNSYNCABLE_PREF); } for (int i = TIMED_FIELDS_BEGIN; i < TIMED_FIELDS_END; ++i) { @@ -50,10 +51,10 @@ void AboutSigninInternalsFactory::RegisterUserPrefs( static_cast<TimedSigninStatusField>(i)) + ".value"; const std::string time = SigninStatusFieldToString( static_cast<TimedSigninStatusField>(i)) + ".time"; - user_prefs->RegisterStringPref(value.c_str(), "", - PrefRegistrySyncable::UNSYNCABLE_PREF); - user_prefs->RegisterStringPref(time.c_str(), "", - PrefRegistrySyncable::UNSYNCABLE_PREF); + user_prefs->RegisterStringPref( + value.c_str(), std::string(), PrefRegistrySyncable::UNSYNCABLE_PREF); + user_prefs->RegisterStringPref( + time.c_str(), std::string(), PrefRegistrySyncable::UNSYNCABLE_PREF); } // TokenService information for about:signin-internals. for (size_t i = 0; i < kNumTokenPrefs; i++) { @@ -61,12 +62,12 @@ void AboutSigninInternalsFactory::RegisterUserPrefs( const std::string value = pref + ".value"; const std::string status = pref + ".status"; const std::string time = pref + ".time"; - user_prefs->RegisterStringPref(value.c_str(), "", - PrefRegistrySyncable::UNSYNCABLE_PREF); - user_prefs->RegisterStringPref(status.c_str(), "", - PrefRegistrySyncable::UNSYNCABLE_PREF); - user_prefs->RegisterStringPref(time.c_str(), "", - PrefRegistrySyncable::UNSYNCABLE_PREF); + user_prefs->RegisterStringPref( + value.c_str(), std::string(), PrefRegistrySyncable::UNSYNCABLE_PREF); + user_prefs->RegisterStringPref( + status.c_str(), std::string(), PrefRegistrySyncable::UNSYNCABLE_PREF); + user_prefs->RegisterStringPref( + time.c_str(), std::string(), PrefRegistrySyncable::UNSYNCABLE_PREF); } } diff --git a/chrome/browser/signin/oauth2_token_service_unittest.cc b/chrome/browser/signin/oauth2_token_service_unittest.cc index 3649374..7095b43 100644 --- a/chrome/browser/signin/oauth2_token_service_unittest.cc +++ b/chrome/browser/signin/oauth2_token_service_unittest.cc @@ -138,7 +138,7 @@ TEST_F(OAuth2TokenServiceTest, FailureShouldNotRetry) { net::TestURLFetcher* fetcher = factory_.GetFetcherByID(0); EXPECT_TRUE(fetcher); fetcher->set_response_code(net::HTTP_UNAUTHORIZED); - fetcher->SetResponseString(""); + fetcher->SetResponseString(std::string()); fetcher->delegate()->OnURLFetchComplete(fetcher); EXPECT_EQ(0, consumer_.number_of_correct_tokens_); EXPECT_EQ(1, consumer_.number_of_errors_); @@ -251,7 +251,7 @@ TEST_F(OAuth2TokenServiceTest, SuccessAndExpirationAndFailure) { fetcher = factory_.GetFetcherByID(0); EXPECT_TRUE(fetcher); fetcher->set_response_code(net::HTTP_UNAUTHORIZED); - fetcher->SetResponseString(""); + fetcher->SetResponseString(std::string()); fetcher->delegate()->OnURLFetchComplete(fetcher); EXPECT_EQ(1, consumer_.number_of_correct_tokens_); EXPECT_EQ(1, consumer_.number_of_errors_); @@ -374,7 +374,7 @@ TEST_F(OAuth2TokenServiceTest, SuccessAndSignOutAndRequest) { // Signs out service_->IssueAuthTokenForTest(GaiaConstants::kGaiaOAuth2LoginRefreshToken, - ""); + std::string()); service_->EraseTokensFromDB(); request = oauth2_service_->StartRequest(std::set<std::string>(), &consumer_); @@ -404,7 +404,7 @@ TEST_F(OAuth2TokenServiceTest, SuccessAndSignOutAndSignInAndSuccess) { // Signs out and signs in service_->IssueAuthTokenForTest(GaiaConstants::kGaiaOAuth2LoginRefreshToken, - ""); + std::string()); service_->EraseTokensFromDB(); service_->IssueAuthTokenForTest(GaiaConstants::kGaiaOAuth2LoginRefreshToken, "refreshToken"); @@ -486,7 +486,7 @@ TEST_F(OAuth2TokenServiceTest, RetryingConsumer) { net::TestURLFetcher* fetcher = factory_.GetFetcherByID(0); EXPECT_TRUE(fetcher); fetcher->set_response_code(net::HTTP_UNAUTHORIZED); - fetcher->SetResponseString(""); + fetcher->SetResponseString(std::string()); fetcher->delegate()->OnURLFetchComplete(fetcher); EXPECT_EQ(0, consumer.number_of_correct_tokens_); EXPECT_EQ(1, consumer.number_of_errors_); @@ -494,7 +494,7 @@ TEST_F(OAuth2TokenServiceTest, RetryingConsumer) { fetcher = factory_.GetFetcherByID(0); EXPECT_TRUE(fetcher); fetcher->set_response_code(net::HTTP_UNAUTHORIZED); - fetcher->SetResponseString(""); + fetcher->SetResponseString(std::string()); fetcher->delegate()->OnURLFetchComplete(fetcher); EXPECT_EQ(0, consumer.number_of_correct_tokens_); EXPECT_EQ(2, consumer.number_of_errors_); diff --git a/chrome/browser/signin/signin_internals_util.cc b/chrome/browser/signin/signin_internals_util.cc index adae0a1..f187418 100644 --- a/chrome/browser/signin/signin_internals_util.cc +++ b/chrome/browser/signin/signin_internals_util.cc @@ -98,11 +98,11 @@ std::string SigninStatusFieldToString(UntimedSigninStatusField field) { ENUM_CASE(LSID); case UNTIMED_FIELDS_END: NOTREACHED(); - return ""; + return std::string(); } NOTREACHED(); - return ""; + return std::string(); } std::string SigninStatusFieldToString(TimedSigninStatusField field) { @@ -113,11 +113,11 @@ std::string SigninStatusFieldToString(TimedSigninStatusField field) { ENUM_CASE(GET_USER_INFO_STATUS); case TIMED_FIELDS_END: NOTREACHED(); - return ""; + return std::string(); } NOTREACHED(); - return ""; + return std::string(); } SigninStatus::SigninStatus() @@ -203,10 +203,10 @@ std::string SigninStatusFieldToLabel(UntimedSigninStatusField field) { return "Sid (Hash)"; case UNTIMED_FIELDS_END: NOTREACHED(); - return ""; + return std::string(); } NOTREACHED(); - return ""; + return std::string(); } TimedSigninStatusValue SigninStatusFieldToLabel( @@ -226,10 +226,10 @@ TimedSigninStatusValue SigninStatusFieldToLabel( "Last OnGetUserInfo Time"); case TIMED_FIELDS_END: NOTREACHED(); - return TimedSigninStatusValue("Error", ""); + return TimedSigninStatusValue("Error", std::string()); } NOTREACHED(); - return TimedSigninStatusValue("Error", ""); + return TimedSigninStatusValue("Error", std::string()); } } // namespace diff --git a/chrome/browser/signin/signin_manager.cc b/chrome/browser/signin/signin_manager.cc index a8bc081..ab5befc 100644 --- a/chrome/browser/signin/signin_manager.cc +++ b/chrome/browser/signin/signin_manager.cc @@ -305,10 +305,9 @@ std::string SigninManager::SigninTypeToString( } NOTREACHED(); - return ""; + return std::string(); } - bool SigninManager::PrepareForSignin(SigninType type, const std::string& username, const std::string& password) { @@ -468,7 +467,8 @@ void SigninManager::StartSignInWithOAuth(const std::string& username, scopes.push_back(GaiaUrls::GetInstance()->oauth1_login_scope()); const std::string& locale = g_browser_process->GetApplicationLocale(); - client_login_->StartClientOAuth(username, password, scopes, "", locale); + client_login_->StartClientOAuth( + username, password, scopes, std::string(), locale); // Register for token availability. The signin manager will pre-login the // user when the GAIA service token is ready for use. Only do this if we @@ -549,10 +549,9 @@ void SigninManager::SignOut() { profile_->GetPrefs()->ClearPref(prefs::kGoogleServicesUsername); // Erase (now) stale information from AboutSigninInternals. - NotifyDiagnosticsObservers(USERNAME, ""); - NotifyDiagnosticsObservers(LSID, ""); - NotifyDiagnosticsObservers( - signin_internals_util::SID, ""); + NotifyDiagnosticsObservers(USERNAME, std::string()); + NotifyDiagnosticsObservers(LSID, std::string()); + NotifyDiagnosticsObservers(signin_internals_util::SID, std::string()); TokenService* token_service = TokenServiceFactory::GetForProfile(profile_); content::NotificationService::current()->Notify( diff --git a/chrome/browser/signin/signin_manager_factory.cc b/chrome/browser/signin/signin_manager_factory.cc index 67e33c0..11dd5e6 100644 --- a/chrome/browser/signin/signin_manager_factory.cc +++ b/chrome/browser/signin/signin_manager_factory.cc @@ -39,9 +39,11 @@ SigninManagerFactory* SigninManagerFactory::GetInstance() { } void SigninManagerFactory::RegisterUserPrefs(PrefRegistrySyncable* registry) { - registry->RegisterStringPref(prefs::kGoogleServicesLastUsername, "", + registry->RegisterStringPref(prefs::kGoogleServicesLastUsername, + std::string(), PrefRegistrySyncable::UNSYNCABLE_PREF); - registry->RegisterStringPref(prefs::kGoogleServicesUsername, "", + registry->RegisterStringPref(prefs::kGoogleServicesUsername, + std::string(), PrefRegistrySyncable::UNSYNCABLE_PREF); registry->RegisterBooleanPref(prefs::kAutologinEnabled, true, PrefRegistrySyncable::UNSYNCABLE_PREF); @@ -54,7 +56,8 @@ void SigninManagerFactory::RegisterUserPrefs(PrefRegistrySyncable* registry) { // static void SigninManagerFactory::RegisterPrefs(PrefRegistrySimple* registry) { - registry->RegisterStringPref(prefs::kGoogleServicesUsernamePattern, ""); + registry->RegisterStringPref(prefs::kGoogleServicesUsernamePattern, + std::string()); } ProfileKeyedService* SigninManagerFactory::BuildServiceInstanceFor( diff --git a/chrome/browser/signin/signin_manager_unittest.cc b/chrome/browser/signin/signin_manager_unittest.cc index 79964d0..c49f7a1 100644 --- a/chrome/browser/signin/signin_manager_unittest.cc +++ b/chrome/browser/signin/signin_manager_unittest.cc @@ -308,7 +308,8 @@ TEST_F(SigninManagerTest, SignInClientLogin) { manager_->Initialize(profile_.get()); EXPECT_TRUE(manager_->GetAuthenticatedUsername().empty()); - manager_->StartSignIn("user@gmail.com", "password", "", ""); + manager_->StartSignIn( + "user@gmail.com", "password", std::string(), std::string()); EXPECT_TRUE(manager_->GetAuthenticatedUsername().empty()); SimulateValidResponseClientLogin(true); @@ -340,7 +341,7 @@ TEST_F(SigninManagerTest, Prohibited) { EXPECT_TRUE(manager_->IsAllowedUsername("happy@google.com")); EXPECT_FALSE(manager_->IsAllowedUsername("test@invalid.com")); EXPECT_FALSE(manager_->IsAllowedUsername("test@notgoogle.com")); - EXPECT_FALSE(manager_->IsAllowedUsername("")); + EXPECT_FALSE(manager_->IsAllowedUsername(std::string())); } TEST_F(SigninManagerTest, TestAlternateWildcard) { @@ -353,7 +354,7 @@ TEST_F(SigninManagerTest, TestAlternateWildcard) { EXPECT_TRUE(manager_->IsAllowedUsername("happy@google.com")); EXPECT_FALSE(manager_->IsAllowedUsername("test@invalid.com")); EXPECT_FALSE(manager_->IsAllowedUsername("test@notgoogle.com")); - EXPECT_FALSE(manager_->IsAllowedUsername("")); + EXPECT_FALSE(manager_->IsAllowedUsername(std::string())); } TEST_F(SigninManagerTest, ProhibitedAtStartup) { @@ -421,7 +422,7 @@ TEST_F(SigninManagerTest, SignInWithCredentialsEmptyPasswordValidCookie) { net::CookieMonster::SetCookiesCallback()); // Since the password is empty, will verify the gaia cookies first. - manager_->StartSignInWithCredentials("0", "user@gmail.com", ""); + manager_->StartSignInWithCredentials("0", "user@gmail.com", std::string()); WaitUntilUIDone(); @@ -434,7 +435,7 @@ TEST_F(SigninManagerTest, SignInWithCredentialsEmptyPasswordNoValidCookie) { EXPECT_TRUE(manager_->GetAuthenticatedUsername().empty()); // Since the password is empty, will verify the gaia cookies first. - manager_->StartSignInWithCredentials("0", "user@gmail.com", ""); + manager_->StartSignInWithCredentials("0", "user@gmail.com", std::string()); WaitUntilUIDone(); @@ -458,7 +459,7 @@ TEST_F(SigninManagerTest, SignInWithCredentialsEmptyPasswordInValidCookie) { net::CookieMonster::SetCookiesCallback()); // Since the password is empty, must verify the gaia cookies first. - manager_->StartSignInWithCredentials("0", "user@gmail.com", ""); + manager_->StartSignInWithCredentials("0", "user@gmail.com", std::string()); WaitUntilUIDone(); @@ -471,7 +472,7 @@ TEST_F(SigninManagerTest, SignInClientLoginNoGPlus) { manager_->Initialize(profile_.get()); EXPECT_TRUE(manager_->GetAuthenticatedUsername().empty()); - manager_->StartSignIn("username", "password", "", ""); + manager_->StartSignIn("username", "password", std::string(), std::string()); EXPECT_TRUE(manager_->GetAuthenticatedUsername().empty()); SimulateValidResponseClientLogin(false); @@ -482,7 +483,7 @@ TEST_F(SigninManagerTest, ClearTransientSigninData) { manager_->Initialize(profile_.get()); EXPECT_TRUE(manager_->GetAuthenticatedUsername().empty()); - manager_->StartSignIn("username", "password", "", ""); + manager_->StartSignIn("username", "password", std::string(), std::string()); EXPECT_TRUE(manager_->GetAuthenticatedUsername().empty()); SimulateValidResponseClientLogin(false); @@ -513,7 +514,7 @@ TEST_F(SigninManagerTest, ClearTransientSigninData) { TEST_F(SigninManagerTest, SignOutClientLogin) { manager_->Initialize(profile_.get()); - manager_->StartSignIn("username", "password", "", ""); + manager_->StartSignIn("username", "password", std::string(), std::string()); SimulateValidResponseClientLogin(false); manager_->OnClientLoginSuccess(credentials_); @@ -529,7 +530,7 @@ TEST_F(SigninManagerTest, SignOutClientLogin) { TEST_F(SigninManagerTest, SignInFailureClientLogin) { manager_->Initialize(profile_.get()); - manager_->StartSignIn("username", "password", "", ""); + manager_->StartSignIn("username", "password", std::string(), std::string()); GoogleServiceAuthError error(GoogleServiceAuthError::REQUEST_CANCELED); manager_->OnClientLoginFailure(error); @@ -547,7 +548,7 @@ TEST_F(SigninManagerTest, SignInFailureClientLogin) { TEST_F(SigninManagerTest, ProvideSecondFactorSuccess) { manager_->Initialize(profile_.get()); - manager_->StartSignIn("username", "password", "", ""); + manager_->StartSignIn("username", "password", std::string(), std::string()); GoogleServiceAuthError error(GoogleServiceAuthError::TWO_FACTOR); manager_->OnClientLoginFailure(error); @@ -566,7 +567,7 @@ TEST_F(SigninManagerTest, ProvideSecondFactorSuccess) { TEST_F(SigninManagerTest, ProvideSecondFactorFailure) { manager_->Initialize(profile_.get()); - manager_->StartSignIn("username", "password", "", ""); + manager_->StartSignIn("username", "password", std::string(), std::string()); GoogleServiceAuthError error1(GoogleServiceAuthError::TWO_FACTOR); manager_->OnClientLoginFailure(error1); @@ -596,7 +597,7 @@ TEST_F(SigninManagerTest, ProvideSecondFactorFailure) { TEST_F(SigninManagerTest, SignOutMidConnect) { manager_->Initialize(profile_.get()); - manager_->StartSignIn("username", "password", "", ""); + manager_->StartSignIn("username", "password", std::string(), std::string()); manager_->SignOut(); EXPECT_EQ(0U, google_login_success_.size()); EXPECT_EQ(0U, google_login_failure_.size()); diff --git a/chrome/browser/signin/token_service_unittest.cc b/chrome/browser/signin/token_service_unittest.cc index 617a394..fbe83df 100644 --- a/chrome/browser/signin/token_service_unittest.cc +++ b/chrome/browser/signin/token_service_unittest.cc @@ -225,7 +225,7 @@ TEST_F(TokenServiceTest, OnTokenSuccessUpdate) { EXPECT_EQ(service_->GetTokenForService(GaiaConstants::kSyncService), "token2"); - service_->OnIssueAuthTokenSuccess(GaiaConstants::kSyncService, ""); + service_->OnIssueAuthTokenSuccess(GaiaConstants::kSyncService, std::string()); EXPECT_TRUE(service_->HasTokenForService(GaiaConstants::kSyncService)); EXPECT_EQ(service_->GetTokenForService(GaiaConstants::kSyncService), ""); } diff --git a/chrome/browser/spellchecker/spelling_service_client_unittest.cc b/chrome/browser/spellchecker/spelling_service_client_unittest.cc index d3243e8..5833fce 100644 --- a/chrome/browser/spellchecker/spelling_service_client_unittest.cc +++ b/chrome/browser/spellchecker/spelling_service_client_unittest.cc @@ -343,7 +343,7 @@ TEST_F(SpellingServiceClientTest, AvailableServices) { // SpellingServiceClient::IsAvailable() describes why this function returns // false for suggestions.) If there is no language set, then we // do not allow any remote. - pref->SetString(prefs::kSpellCheckDictionary, ""); + pref->SetString(prefs::kSpellCheckDictionary, std::string()); EXPECT_FALSE(client_.IsAvailable(&profile_, kSuggest)); EXPECT_FALSE(client_.IsAvailable(&profile_, kSpellcheck)); diff --git a/chrome/browser/ssl/ssl_blocking_page.cc b/chrome/browser/ssl/ssl_blocking_page.cc index 6942d1e..615c4c6 100644 --- a/chrome/browser/ssl/ssl_blocking_page.cc +++ b/chrome/browser/ssl/ssl_blocking_page.cc @@ -218,9 +218,9 @@ std::string SSLBlockingPage::GetHTMLContents() { l10n_util::GetStringUTF16( IDS_SSL_ERROR_PAGE_CANNOT_PROCEED)); } else { - strings.SetString("reasonForNotProceeding", ""); + strings.SetString("reasonForNotProceeding", std::string()); } - strings.SetString("errorType", ""); + strings.SetString("errorType", std::string()); } strings.SetString("textdirection", base::i18n::IsRTL() ? "rtl" : "ltr"); @@ -318,6 +318,6 @@ void SSLBlockingPage::SetExtraInfo( strings->SetString(keys[i], extra_info[i]); } for (; i < 5; i++) { - strings->SetString(keys[i], ""); + strings->SetString(keys[i], std::string()); } } diff --git a/chrome/browser/ssl/ssl_browser_tests.cc b/chrome/browser/ssl/ssl_browser_tests.cc index 42cfbf6..d4afe0f 100644 --- a/chrome/browser/ssl/ssl_browser_tests.cc +++ b/chrome/browser/ssl/ssl_browser_tests.cc @@ -738,9 +738,9 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, MAYBE_TestHTTPSErrorWithNoNavEntry) { IN_PROC_BROWSER_TEST_F(SSLUITest, TestBadHTTPSDownload) { ASSERT_TRUE(test_server()->Start()); ASSERT_TRUE(https_server_expired_.Start()); - GURL url_non_dangerous = test_server()->GetURL(""); - GURL url_dangerous = https_server_expired_.GetURL( - "files/downloads/dangerous/dangerous.exe"); + GURL url_non_dangerous = test_server()->GetURL(std::string()); + GURL url_dangerous = + https_server_expired_.GetURL("files/downloads/dangerous/dangerous.exe"); base::ScopedTempDir downloads_directory_; // Need empty temp dir to avoid having Chrome ask us for a new filename diff --git a/chrome/browser/storage_monitor/media_storage_util.cc b/chrome/browser/storage_monitor/media_storage_util.cc index 72602fa..dc9c61b 100644 --- a/chrome/browser/storage_monitor/media_storage_util.cc +++ b/chrome/browser/storage_monitor/media_storage_util.cc @@ -187,8 +187,9 @@ std::string MediaStorageUtil::MakeDeviceId(Type type, bool MediaStorageUtil::CrackDeviceId(const std::string& device_id, Type* type, std::string* unique_id) { size_t prefix_length = device_id.find_first_of(':'); - std::string prefix = prefix_length != std::string::npos ? - device_id.substr(0, prefix_length + 1) : ""; + std::string prefix = prefix_length != std::string::npos + ? device_id.substr(0, prefix_length + 1) + : std::string(); Type found_type; if (prefix == kRemovableMassStorageWithDCIMPrefix) { diff --git a/chrome/browser/sync/glue/session_model_associator_unittest.cc b/chrome/browser/sync/glue/session_model_associator_unittest.cc index d1f63bb..e5ceab1e 100644 --- a/chrome/browser/sync/glue/session_model_associator_unittest.cc +++ b/chrome/browser/sync/glue/session_model_associator_unittest.cc @@ -375,7 +375,7 @@ TEST_F(SyncSessionModelAssociatorTest, SetSessionTabFromDelegate) { // Create tab specifics with an empty favicon. Ensure it gets ignored and not // stored into the synced favicon lookups. TEST_F(SyncSessionModelAssociatorTest, LoadEmptyFavicon) { - std::string favicon = ""; + std::string favicon; std::string favicon_url = "http://www.faviconurl.com/favicon.ico"; std::string page_url = "http://www.faviconurl.com/page.html"; sync_pb::SessionTab tab; diff --git a/chrome/browser/sync/glue/sync_backend_host_unittest.cc b/chrome/browser/sync/glue/sync_backend_host_unittest.cc index 96d1acb..d05dd46 100644 --- a/chrome/browser/sync/glue/sync_backend_host_unittest.cc +++ b/chrome/browser/sync/glue/sync_backend_host_unittest.cc @@ -194,7 +194,7 @@ class SyncBackendHostTest : public testing::Test { WillOnce(InvokeWithoutArgs(QuitMessageLoop)); backend_->Initialize(&mock_frontend_, syncer::WeakHandle<syncer::JsEventHandler>(), - GURL(""), + GURL(std::string()), credentials_, true, &fake_manager_factory_, diff --git a/chrome/browser/sync/glue/synced_session.h b/chrome/browser/sync/glue/synced_session.h index a1d0d68..80ff9be 100644 --- a/chrome/browser/sync/glue/synced_session.h +++ b/chrome/browser/sync/glue/synced_session.h @@ -74,7 +74,7 @@ struct SyncedSession { case SyncedSession::TYPE_TABLET: return "tablet"; default: - return ""; + return std::string(); } } diff --git a/chrome/browser/sync/invalidations/invalidator_storage.cc b/chrome/browser/sync/invalidations/invalidator_storage.cc index acbbd47..e88d0e2 100644 --- a/chrome/browser/sync/invalidations/invalidator_storage.cc +++ b/chrome/browser/sync/invalidations/invalidator_storage.cc @@ -282,8 +282,10 @@ void InvalidatorStorage::SetBootstrapData(const std::string& data) { } std::string InvalidatorStorage::GetBootstrapData() const { - std::string base64_data(pref_service_ ? - pref_service_->GetString(prefs::kInvalidatorInvalidationState) : ""); + std::string base64_data( + pref_service_ + ? pref_service_->GetString(prefs::kInvalidatorInvalidationState) + : std::string()); std::string data; base::Base64Decode(base64_data, &data); return data; diff --git a/chrome/browser/sync/profile_sync_service.cc b/chrome/browser/sync/profile_sync_service.cc index 2d8bbd3..a58fff4 100644 --- a/chrome/browser/sync/profile_sync_service.cc +++ b/chrome/browser/sync/profile_sync_service.cc @@ -726,7 +726,7 @@ void ProfileSyncService::ClearUnrecoverableError() { std::string ProfileSyncService::GetExperimentNameForDataType( syncer::ModelType data_type) { NOTREACHED(); - return ""; + return std::string(); } void ProfileSyncService::RegisterNewDataType(syncer::ModelType data_type) { diff --git a/chrome/browser/sync/profile_sync_service_bookmark_unittest.cc b/chrome/browser/sync/profile_sync_service_bookmark_unittest.cc index bc62c97..1ad62a1 100644 --- a/chrome/browser/sync/profile_sync_service_bookmark_unittest.cc +++ b/chrome/browser/sync/profile_sync_service_bookmark_unittest.cc @@ -706,9 +706,9 @@ TEST_F(ProfileSyncServiceBookmarkTest, ServerChangeProcessing) { "'about:blank','gnotesWin','location=0,menubar=0," \ "scrollbars=0,status=0,toolbar=0,width=300," \ "height=300,resizable');});"); - adds.AddURL(L"", javascript_url, other_bookmarks_id(), 0); - int64 u6 = adds.AddURL(L"Sync1", "http://www.syncable.edu/", - mobile_bookmarks_id(), 0); + adds.AddURL(std::wstring(), javascript_url, other_bookmarks_id(), 0); + int64 u6 = adds.AddURL( + L"Sync1", "http://www.syncable.edu/", mobile_bookmarks_id(), 0); syncer::ChangeRecordList::const_iterator it; // The bookmark model shouldn't yet have seen any of the nodes of |adds|. diff --git a/chrome/browser/sync/profile_sync_service_harness.cc b/chrome/browser/sync/profile_sync_service_harness.cc index c290374..eb0b074 100644 --- a/chrome/browser/sync/profile_sync_service_harness.cc +++ b/chrome/browser/sync/profile_sync_service_harness.cc @@ -134,7 +134,7 @@ ProfileSyncServiceHarness* ProfileSyncServiceHarness::CreateAndAttach( NOTREACHED() << "Profile has never signed into sync."; return NULL; } - return new ProfileSyncServiceHarness(profile, "", ""); + return new ProfileSyncServiceHarness(profile, std::string(), std::string()); } void ProfileSyncServiceHarness::SetCredentials(const std::string& username, @@ -179,7 +179,8 @@ bool ProfileSyncServiceHarness::SetupSync( service_->SetSetupInProgress(true); // Authenticate sync client using GAIA credentials. - service_->signin()->StartSignIn(username_, password_, "", ""); + service_->signin() + ->StartSignIn(username_, password_, std::string(), std::string()); // Wait for the OnBackendInitialized() callback. if (!AwaitBackendInitialized()) { @@ -1014,7 +1015,7 @@ std::string ProfileSyncServiceHarness::GetSerializedProgressMarker( syncer::ProgressMarkerMap::const_iterator it = markers_map.find(model_type); - return (it != markers_map.end()) ? it->second : ""; + return (it != markers_map.end()) ? it->second : std::string(); } std::string ProfileSyncServiceHarness::GetClientInfoString( diff --git a/chrome/browser/sync/profile_sync_service_session_unittest.cc b/chrome/browser/sync/profile_sync_service_session_unittest.cc index 1ee92a6..4ed28ab 100644 --- a/chrome/browser/sync/profile_sync_service_session_unittest.cc +++ b/chrome/browser/sync/profile_sync_service_session_unittest.cc @@ -85,8 +85,10 @@ class FakeProfileSyncService : public TestProfileSyncService { virtual ~FakeProfileSyncService() {} virtual scoped_ptr<DeviceInfo> GetLocalDeviceInfo() const OVERRIDE { - return scoped_ptr<DeviceInfo>( - new DeviceInfo("client_name", "", "", sync_pb::SyncEnums::TYPE_WIN)); + return scoped_ptr<DeviceInfo>(new DeviceInfo("client_name", + std::string(), + std::string(), + sync_pb::SyncEnums::TYPE_WIN)); } }; diff --git a/chrome/browser/sync/profile_sync_service_startup_unittest.cc b/chrome/browser/sync/profile_sync_service_startup_unittest.cc index 1a00308..d85946e 100644 --- a/chrome/browser/sync/profile_sync_service_startup_unittest.cc +++ b/chrome/browser/sync/profile_sync_service_startup_unittest.cc @@ -189,9 +189,10 @@ TEST_F(ProfileSyncServiceStartupTest, StartFirstTime) { // Create some tokens in the token service; the service will startup when // it is notified that tokens are available. sync_->SetSetupInProgress(true); - sync_->signin()->StartSignIn("test_user", "", "", ""); - TokenServiceFactory::GetForProfile(profile_.get())->IssueAuthTokenForTest( - GaiaConstants::kSyncService, "sync_token"); + sync_->signin() + ->StartSignIn("test_user", std::string(), std::string(), std::string()); + TokenServiceFactory::GetForProfile(profile_.get()) + ->IssueAuthTokenForTest(GaiaConstants::kSyncService, "sync_token"); TokenServiceFactory::GetForProfile(profile_.get())->IssueAuthTokenForTest( GaiaConstants::kGaiaOAuth2LoginRefreshToken, "oauth2_login_token"); sync_->SetSetupInProgress(false); @@ -235,7 +236,8 @@ TEST_F(ProfileSyncServiceStartupTest, StartNoCredentials) { EXPECT_CALL(observer_, OnStateChanged()).Times(AnyNumber()); sync_->SetSetupInProgress(true); - sync_->signin()->StartSignIn("test_user", "", "", ""); + sync_->signin() + ->StartSignIn("test_user", std::string(), std::string(), std::string()); // NOTE: Unlike StartFirstTime, this test does not issue any auth tokens. token_service->LoadTokensFromDB(); sync_->SetSetupInProgress(false); @@ -269,9 +271,10 @@ TEST_F(ProfileSyncServiceStartupTest, StartInvalidCredentials) { EXPECT_CALL(*data_type_manager, Stop()).Times(1); EXPECT_CALL(observer_, OnStateChanged()).Times(AnyNumber()); sync_->SetSetupInProgress(true); - sync_->signin()->StartSignIn("test_user", "", "", ""); - token_service->IssueAuthTokenForTest( - GaiaConstants::kSyncService, "sync_token"); + sync_->signin() + ->StartSignIn("test_user", std::string(), std::string(), std::string()); + token_service->IssueAuthTokenForTest(GaiaConstants::kSyncService, + "sync_token"); sync_->SetSetupInProgress(false); MessageLoop::current()->Run(); diff --git a/chrome/browser/sync/sync_prefs.cc b/chrome/browser/sync/sync_prefs.cc index 0c7a4bd..a5c58e8 100644 --- a/chrome/browser/sync/sync_prefs.cc +++ b/chrome/browser/sync/sync_prefs.cc @@ -87,10 +87,10 @@ void SyncPrefs::RegisterUserPrefs(PrefRegistrySyncable* registry) { false, PrefRegistrySyncable::UNSYNCABLE_PREF); registry->RegisterStringPref(prefs::kSyncEncryptionBootstrapToken, - "", + std::string(), PrefRegistrySyncable::UNSYNCABLE_PREF); registry->RegisterStringPref(prefs::kSyncKeystoreEncryptionBootstrapToken, - "", + std::string(), PrefRegistrySyncable::UNSYNCABLE_PREF); #if defined(OS_CHROMEOS) registry->RegisterStringPref(prefs::kSyncSpareBootstrapToken, @@ -99,7 +99,7 @@ void SyncPrefs::RegisterUserPrefs(PrefRegistrySyncable* registry) { #endif registry->RegisterStringPref(prefs::kSyncSessionsGUID, - "", + std::string(), PrefRegistrySyncable::UNSYNCABLE_PREF); // We will start prompting people about new data types after the launch of @@ -181,9 +181,9 @@ void SyncPrefs::SetStartSuppressed(bool is_suppressed) { std::string SyncPrefs::GetGoogleServicesUsername() const { DCHECK(CalledOnValidThread()); - return - pref_service_ ? - pref_service_->GetString(prefs::kGoogleServicesUsername) : ""; + return pref_service_ + ? pref_service_->GetString(prefs::kGoogleServicesUsername) + : std::string(); } base::Time SyncPrefs::GetLastSyncedTime() const { @@ -266,9 +266,9 @@ bool SyncPrefs::IsManaged() const { std::string SyncPrefs::GetEncryptionBootstrapToken() const { DCHECK(CalledOnValidThread()); - return - pref_service_ ? - pref_service_->GetString(prefs::kSyncEncryptionBootstrapToken) : ""; + return pref_service_ + ? pref_service_->GetString(prefs::kSyncEncryptionBootstrapToken) + : std::string(); } void SyncPrefs::SetEncryptionBootstrapToken(const std::string& token) { @@ -278,10 +278,9 @@ void SyncPrefs::SetEncryptionBootstrapToken(const std::string& token) { std::string SyncPrefs::GetKeystoreEncryptionBootstrapToken() const { DCHECK(CalledOnValidThread()); - return - pref_service_ ? - pref_service_->GetString(prefs::kSyncKeystoreEncryptionBootstrapToken) : - ""; + return pref_service_ ? pref_service_->GetString( + prefs::kSyncKeystoreEncryptionBootstrapToken) + : std::string(); } void SyncPrefs::SetKeystoreEncryptionBootstrapToken(const std::string& token) { @@ -291,9 +290,8 @@ void SyncPrefs::SetKeystoreEncryptionBootstrapToken(const std::string& token) { std::string SyncPrefs::GetSyncSessionsGUID() const { DCHECK(CalledOnValidThread()); - return - pref_service_ ? - pref_service_->GetString(prefs::kSyncSessionsGUID) : ""; + return pref_service_ ? pref_service_->GetString(prefs::kSyncSessionsGUID) + : std::string(); } void SyncPrefs::SetSyncSessionsGUID(const std::string& guid) { diff --git a/chrome/browser/sync/test/integration/sync_extension_helper.cc b/chrome/browser/sync/test/integration/sync_extension_helper.cc index 84cf7547..fc007af9 100644 --- a/chrome/browser/sync/test/integration/sync_extension_helper.cc +++ b/chrome/browser/sync/test/integration/sync_extension_helper.cc @@ -63,7 +63,7 @@ std::string SyncExtensionHelper::InstallExtension( scoped_refptr<Extension> extension = GetExtension(profile, name, type); if (!extension.get()) { NOTREACHED() << "Could not install extension " << name; - return ""; + return std::string(); } profile->GetExtensionService()->OnExtensionInstalled( extension, syncer::StringOrdinal(), false /* no requirement errors */, diff --git a/chrome/browser/sync_file_system/drive_file_sync_client.cc b/chrome/browser/sync_file_system/drive_file_sync_client.cc index b6c8095..7f8903a 100644 --- a/chrome/browser/sync_file_system/drive_file_sync_client.cc +++ b/chrome/browser/sync_file_system/drive_file_sync_client.cc @@ -129,7 +129,7 @@ DriveFileSyncClient::DriveFileSyncClient(Profile* profile) drive_service_.reset(new google_apis::GDataWapiService( profile->GetRequestContext(), GURL(google_apis::GDataWapiUrlGenerator::kBaseUrlForProduction), - "" /* custom_user_agent */)); + std::string() /* custom_user_agent */)); drive_service_->Initialize(profile); drive_service_->AddObserver(this); net::NetworkChangeNotifier::AddConnectionTypeObserver(this); diff --git a/chrome/browser/sync_file_system/drive_file_sync_service.cc b/chrome/browser/sync_file_system/drive_file_sync_service.cc index c7a12a7..15691f49 100644 --- a/chrome/browser/sync_file_system/drive_file_sync_service.cc +++ b/chrome/browser/sync_file_system/drive_file_sync_service.cc @@ -411,7 +411,8 @@ void DriveFileSyncService::RegisterOriginForTrackingChanges( void DriveFileSyncService::UnregisterOriginForTrackingChanges( const GURL& origin, const SyncStatusCallback& callback) { - scoped_ptr<TaskToken> token(GetToken(FROM_HERE, TASK_TYPE_DATABASE, "")); + scoped_ptr<TaskToken> token( + GetToken(FROM_HERE, TASK_TYPE_DATABASE, std::string())); if (!token) { pending_tasks_.push_back(base::Bind( &DriveFileSyncService::UnregisterOriginForTrackingChanges, @@ -442,7 +443,8 @@ void DriveFileSyncService::EnableOriginForTrackingChanges( if (!metadata_store_->IsOriginDisabled(origin)) return; - scoped_ptr<TaskToken> token(GetToken(FROM_HERE, TASK_TYPE_DATABASE, "")); + scoped_ptr<TaskToken> token( + GetToken(FROM_HERE, TASK_TYPE_DATABASE, std::string())); if (!token) { pending_tasks_.push_back(base::Bind( &DriveFileSyncService::EnableOriginForTrackingChanges, @@ -463,7 +465,8 @@ void DriveFileSyncService::DisableOriginForTrackingChanges( !metadata_store_->IsIncrementalSyncOrigin(origin)) return; - scoped_ptr<TaskToken> token(GetToken(FROM_HERE, TASK_TYPE_DATABASE, "")); + scoped_ptr<TaskToken> token( + GetToken(FROM_HERE, TASK_TYPE_DATABASE, std::string())); if (!token) { pending_tasks_.push_back(base::Bind( &DriveFileSyncService::DisableOriginForTrackingChanges, diff --git a/chrome/browser/tab_contents/spelling_menu_observer_browsertest.cc b/chrome/browser/tab_contents/spelling_menu_observer_browsertest.cc index fd5ca6f..47d6bdb 100644 --- a/chrome/browser/tab_contents/spelling_menu_observer_browsertest.cc +++ b/chrome/browser/tab_contents/spelling_menu_observer_browsertest.cc @@ -301,7 +301,7 @@ IN_PROC_BROWSER_TEST_F(SpellingMenuObserverTest, EnableSpellingService) { new SpellingMenuObserver(menu.get())); menu->SetObserver(observer.get()); menu->GetPrefs()->SetBoolean(prefs::kSpellCheckUseSpellingService, true); - menu->GetPrefs()->SetString(prefs::kSpellCheckDictionary, ""); + menu->GetPrefs()->SetString(prefs::kSpellCheckDictionary, std::string()); content::ContextMenuParams params; params.is_editable = true; diff --git a/chrome/browser/themes/theme_syncable_service_unittest.cc b/chrome/browser/themes/theme_syncable_service_unittest.cc index 8a1829f..8fa7d25 100644 --- a/chrome/browser/themes/theme_syncable_service_unittest.cc +++ b/chrome/browser/themes/theme_syncable_service_unittest.cc @@ -104,7 +104,7 @@ class FakeThemeService : public ThemeService { if (theme_extension_) return theme_extension_->id(); else - return ""; + return std::string(); } const extensions::Extension* theme_extension() const { diff --git a/chrome/browser/translate/translate_manager_browsertest.cc b/chrome/browser/translate/translate_manager_browsertest.cc index 1078295..8f2b12d 100644 --- a/chrome/browser/translate/translate_manager_browsertest.cc +++ b/chrome/browser/translate/translate_manager_browsertest.cc @@ -538,7 +538,7 @@ TEST_F(TranslateManagerBrowserTest, TranslateUnknownLanguage) { RenderViewHostTester::TestOnMessageReceived( rvh(), ChromeViewHostMsg_PageTranslated( - 2, 0, "", "en", TranslateErrors::UNKNOWN_LANGUAGE)); + 2, 0, std::string(), "en", TranslateErrors::UNKNOWN_LANGUAGE)); infobar = GetTranslateInfoBar(); ASSERT_TRUE(infobar != NULL); EXPECT_EQ(TranslateInfoBarDelegate::TRANSLATION_ERROR, diff --git a/chrome/browser/translate/translate_manager_unittest.cc b/chrome/browser/translate/translate_manager_unittest.cc index 9b25c95..6b176a1 100644 --- a/chrome/browser/translate/translate_manager_unittest.cc +++ b/chrome/browser/translate/translate_manager_unittest.cc @@ -16,7 +16,7 @@ typedef testing::Test TranslateManagerTest; TEST_F(TranslateManagerTest, CheckTranslatableURL) { - GURL empty_url = GURL(""); + GURL empty_url = GURL(std::string()); EXPECT_FALSE(TranslateManager::IsTranslatableURL(empty_url)); std::string chrome = std::string(chrome::kChromeUIScheme) + "://flags"; diff --git a/chrome/browser/ui/app_list/app_list_service.cc b/chrome/browser/ui/app_list/app_list_service.cc index f02da1e..a0bf010 100644 --- a/chrome/browser/ui/app_list/app_list_service.cc +++ b/chrome/browser/ui/app_list/app_list_service.cc @@ -66,7 +66,7 @@ void AppListService::RegisterPrefs(PrefRegistrySimple* registry) { registry->RegisterIntegerPref(prefs::kAppListLaunchCount, 0); registry->RegisterInt64Pref(prefs::kLastAppListAppLaunchPing, 0); registry->RegisterIntegerPref(prefs::kAppListAppLaunchCount, 0); - registry->RegisterStringPref(prefs::kAppListProfile, ""); + registry->RegisterStringPref(prefs::kAppListProfile, std::string()); #if defined(OS_WIN) registry->RegisterBooleanPref(prefs::kRestartWithAppList, false); #endif diff --git a/chrome/browser/ui/blocked_content/blocked_content_tab_helper.cc b/chrome/browser/ui/blocked_content/blocked_content_tab_helper.cc index 2ee22c3..844f210 100644 --- a/chrome/browser/ui/blocked_content/blocked_content_tab_helper.cc +++ b/chrome/browser/ui/blocked_content/blocked_content_tab_helper.cc @@ -110,10 +110,8 @@ void BlockedContentTabHelper::AddPopup(content::WebContents* new_contents, if (creator.is_valid() && profile->GetHostContentSettingsMap()->GetContentSetting( - creator, - creator, - CONTENT_SETTINGS_TYPE_POPUPS, - "") == CONTENT_SETTING_ALLOW) { + creator, creator, CONTENT_SETTINGS_TYPE_POPUPS, std::string()) == + CONTENT_SETTING_ALLOW) { content::WebContentsDelegate* delegate = web_contents()->GetDelegate(); if (delegate) { delegate->AddNewContents(web_contents(), diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc index 47f07ca..c6b30b8 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc @@ -813,9 +813,13 @@ void Browser::OpenFile() { ui::SelectFileDialog::FileTypeInfo file_types; file_types.support_drive = true; select_file_dialog_->SelectFile(ui::SelectFileDialog::SELECT_OPEN_FILE, - string16(), directory, - &file_types, 0, FILE_PATH_LITERAL(""), - parent_window, NULL); + string16(), + directory, + &file_types, + 0, + FILE_PATH_LITERAL(std::string()), + parent_window, + NULL); } void Browser::UpdateDownloadShelfVisibility(bool visible) { diff --git a/chrome/browser/ui/browser_browsertest.cc b/chrome/browser/ui/browser_browsertest.cc index 5e6b769..e253102 100644 --- a/chrome/browser/ui/browser_browsertest.cc +++ b/chrome/browser/ui/browser_browsertest.cc @@ -558,7 +558,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, NullOpenerRedirectForksProcess) { base::FilePath(kDocRoot)); ASSERT_TRUE(https_test_server.Start()); GURL http_url(test_server()->GetURL("files/title1.html")); - GURL https_url(https_test_server.GetURL("")); + GURL https_url(https_test_server.GetURL(std::string())); // Start with an http URL. ui_test_utils::NavigateToURL(browser(), http_url); @@ -647,7 +647,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, OtherRedirectsDontForkProcess) { base::FilePath(kDocRoot)); ASSERT_TRUE(https_test_server.Start()); GURL http_url(test_server()->GetURL("files/title1.html")); - GURL https_url(https_test_server.GetURL("")); + GURL https_url(https_test_server.GetURL(std::string())); // Start with an http URL. ui_test_utils::NavigateToURL(browser(), http_url); @@ -747,7 +747,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, CommandCreateAppShortcutHttp) { browser()->command_controller()->command_updater(); ASSERT_TRUE(test_server()->Start()); - GURL http_url(test_server()->GetURL("")); + GURL http_url(test_server()->GetURL(std::string())); ASSERT_TRUE(http_url.SchemeIs(chrome::kHttpScheme)); ui_test_utils::NavigateToURL(browser(), http_url); EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_CREATE_SHORTCUTS)); @@ -775,7 +775,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, CommandCreateAppShortcutFtp) { net::TestServer::kLocalhost, base::FilePath(kDocRoot)); ASSERT_TRUE(test_server.Start()); - GURL ftp_url(test_server.GetURL("")); + GURL ftp_url(test_server.GetURL(std::string())); ASSERT_TRUE(ftp_url.SchemeIs(chrome::kFtpScheme)); ui_test_utils::NavigateToURL(browser(), ftp_url); EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_CREATE_SHORTCUTS)); @@ -807,7 +807,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, CommandCreateAppShortcutInvalid) { // DISABLED: http://crbug.com/72310 IN_PROC_BROWSER_TEST_F(BrowserTest, DISABLED_ConvertTabToAppShortcut) { ASSERT_TRUE(test_server()->Start()); - GURL http_url(test_server()->GetURL("")); + GURL http_url(test_server()->GetURL(std::string())); ASSERT_TRUE(http_url.SchemeIs(chrome::kHttpScheme)); ASSERT_EQ(1, browser()->tab_strip_model()->count()); diff --git a/chrome/browser/ui/browser_tab_contents.cc b/chrome/browser/ui/browser_tab_contents.cc index c4fe56c..fdcaa16 100644 --- a/chrome/browser/ui/browser_tab_contents.cc +++ b/chrome/browser/ui/browser_tab_contents.cc @@ -172,8 +172,10 @@ void BrowserTabContents::AttachTabHelpers(WebContents* web_contents) { // because the connected state may change while this tab is open. Having a // one-click signin helper attached does not cause problems if the profile // happens to be already connected. - if (OneClickSigninHelper::CanOffer( - web_contents, OneClickSigninHelper::CAN_OFFER_FOR_ALL, "", NULL)) { + if (OneClickSigninHelper::CanOffer(web_contents, + OneClickSigninHelper::CAN_OFFER_FOR_ALL, + std::string(), + NULL)) { OneClickSigninHelper::CreateForWebContents(web_contents); } #endif diff --git a/chrome/browser/ui/browser_tabrestore.cc b/chrome/browser/ui/browser_tabrestore.cc index 0e96e0d..373de5c 100644 --- a/chrome/browser/ui/browser_tabrestore.cc +++ b/chrome/browser/ui/browser_tabrestore.cc @@ -50,7 +50,7 @@ WebContents* CreateRestoredTab( // session_storage_namespace.h include since we only need that to assign // into the map. content::SessionStorageNamespaceMap session_storage_namespace_map; - session_storage_namespace_map[""] = session_storage_namespace; + session_storage_namespace_map[std::string()] = session_storage_namespace; WebContents::CreateParams create_params( browser->profile(), tab_util::GetSiteInstanceForNewTab(browser->profile(), restore_url)); diff --git a/chrome/browser/ui/certificate_dialogs.cc b/chrome/browser/ui/certificate_dialogs.cc index 8e69b5d..939c3a13 100644 --- a/chrome/browser/ui/certificate_dialogs.cc +++ b/chrome/browser/ui/certificate_dialogs.cc @@ -52,7 +52,7 @@ std::string GetBase64String(net::X509Certificate::OSCertHandle cert) { if (!base::Base64Encode( x509_certificate_model::GetDerString(cert), &base64)) { LOG(ERROR) << "base64 encoding error"; - return ""; + return std::string(); } return "-----BEGIN CERTIFICATE-----\r\n" + WrapAt64(base64) + diff --git a/chrome/browser/ui/chrome_pages.cc b/chrome/browser/ui/chrome_pages.cc index fe9300c..7fed38a 100644 --- a/chrome/browser/ui/chrome_pages.cc +++ b/chrome/browser/ui/chrome_pages.cc @@ -65,7 +65,7 @@ void ShowBookmarkManager(Browser* browser) { } void ShowBookmarkManagerForNode(Browser* browser, int64 node_id) { - OpenBookmarkManagerWithHash(browser, "", node_id); + OpenBookmarkManagerWithHash(browser, std::string(), node_id); } void ShowHistory(Browser* browser) { diff --git a/chrome/browser/ui/chrome_select_file_policy_unittest.cc b/chrome/browser/ui/chrome_select_file_policy_unittest.cc index d5a6c10..0d20463 100644 --- a/chrome/browser/ui/chrome_select_file_policy_unittest.cc +++ b/chrome/browser/ui/chrome_select_file_policy_unittest.cc @@ -56,7 +56,7 @@ class FileSelectionUser : public ui::SelectFileDialog::Listener { file_path, NULL, 0, - FILE_PATH_LITERAL(""), + FILE_PATH_LITERAL(std::string()), NULL, NULL); file_selection_initialisation_in_progress = false; diff --git a/chrome/browser/ui/fullscreen/fullscreen_controller_state_test.cc b/chrome/browser/ui/fullscreen/fullscreen_controller_state_test.cc index 34bb7f0..3c851f4 100644 --- a/chrome/browser/ui/fullscreen/fullscreen_controller_state_test.cc +++ b/chrome/browser/ui/fullscreen/fullscreen_controller_state_test.cc @@ -658,7 +658,7 @@ FullscreenControllerStateTest::StateTransitionInfo std::string FullscreenControllerStateTest::GetAndClearDebugLog() { debugging_log_ << "(End of Debugging Log)\n"; std::string output_log = "\nDebugging Log:\n" + debugging_log_.str(); - debugging_log_.str(""); + debugging_log_.str(std::string()); return output_log; } diff --git a/chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.cc b/chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.cc index 3796706..a4d0a2b 100644 --- a/chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.cc +++ b/chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.cc @@ -462,7 +462,12 @@ bool CreateNewBookmarkFromNetscapeURL(GtkSelectionData* selection_data, string16 GetNameForURL(const GURL& url) { if (url.is_valid()) { - return net::GetSuggestedFilename(url, "", "", "", "", std::string()); + return net::GetSuggestedFilename(url, + std::string(), + std::string(), + std::string(), + std::string(), + std::string()); } else { return l10n_util::GetStringUTF16(IDS_APP_UNTITLED_SHORTCUT_FILE_NAME); } diff --git a/chrome/browser/ui/gtk/constrained_web_dialog_delegate_gtk.cc b/chrome/browser/ui/gtk/constrained_web_dialog_delegate_gtk.cc index fe42588..fdb10b5 100644 --- a/chrome/browser/ui/gtk/constrained_web_dialog_delegate_gtk.cc +++ b/chrome/browser/ui/gtk/constrained_web_dialog_delegate_gtk.cc @@ -127,7 +127,7 @@ ConstrainedWebDialogDelegateViewGtk::ConstrainedWebDialogDelegateViewGtk( void ConstrainedWebDialogDelegateViewGtk::OnDestroy(GtkWidget* widget) { if (!impl_->closed_via_webui()) - GetWebDialogDelegate()->OnDialogClosed(""); + GetWebDialogDelegate()->OnDialogClosed(std::string()); delete this; } diff --git a/chrome/browser/ui/gtk/first_run_bubble.cc b/chrome/browser/ui/gtk/first_run_bubble.cc index 7207758..70bf245 100644 --- a/chrome/browser/ui/gtk/first_run_bubble.cc +++ b/chrome/browser/ui/gtk/first_run_bubble.cc @@ -44,10 +44,12 @@ FirstRunBubble::FirstRunBubble(Browser* browser, : browser_(browser), bubble_(NULL) { GtkThemeService* theme_service = GtkThemeService::GetFrom(browser->profile()); - GtkWidget* title = theme_service->BuildLabel("", ui::kGdkBlack); - char* markup = g_markup_printf_escaped(kSearchLabelMarkup, + GtkWidget* title = theme_service->BuildLabel(std::string(), ui::kGdkBlack); + char* markup = g_markup_printf_escaped( + kSearchLabelMarkup, l10n_util::GetStringFUTF8(IDS_FR_BUBBLE_TITLE, - GetDefaultSearchEngineName(browser->profile())).c_str()); + GetDefaultSearchEngineName(browser->profile())) + .c_str()); gtk_label_set_markup(GTK_LABEL(title), markup); g_free(markup); diff --git a/chrome/browser/ui/gtk/location_bar_view_gtk.cc b/chrome/browser/ui/gtk/location_bar_view_gtk.cc index befcd30..9bd0ebb 100644 --- a/chrome/browser/ui/gtk/location_bar_view_gtk.cc +++ b/chrome/browser/ui/gtk/location_bar_view_gtk.cc @@ -410,9 +410,9 @@ void LocationBarViewGtk::Init(bool popup_window_mode) { // Tab to search (the keyword box on the left hand side). tab_to_search_full_label_ = - theme_service_->BuildLabel("", ui::kGdkBlack); + theme_service_->BuildLabel(std::string(), ui::kGdkBlack); tab_to_search_partial_label_ = - theme_service_->BuildLabel("", ui::kGdkBlack); + theme_service_->BuildLabel(std::string(), ui::kGdkBlack); GtkWidget* tab_to_search_label_hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(tab_to_search_label_hbox), tab_to_search_full_label_, FALSE, FALSE, 0); @@ -458,12 +458,12 @@ void LocationBarViewGtk::Init(bool popup_window_mode) { tab_to_search_hint_ = gtk_hbox_new(FALSE, 0); gtk_widget_set_name(tab_to_search_hint_, "chrome-tab-to-search-hint"); tab_to_search_hint_leading_label_ = - theme_service_->BuildLabel("", kHintTextColor); + theme_service_->BuildLabel(std::string(), kHintTextColor); gtk_widget_set_sensitive(tab_to_search_hint_leading_label_, FALSE); tab_to_search_hint_icon_ = gtk_image_new_from_pixbuf( rb.GetNativeImageNamed(IDR_LOCATION_BAR_KEYWORD_HINT_TAB).ToGdkPixbuf()); tab_to_search_hint_trailing_label_ = - theme_service_->BuildLabel("", kHintTextColor); + theme_service_->BuildLabel(std::string(), kHintTextColor); gtk_widget_set_sensitive(tab_to_search_hint_trailing_label_, FALSE); gtk_box_pack_start(GTK_BOX(tab_to_search_hint_), tab_to_search_hint_leading_label_, diff --git a/chrome/browser/ui/gtk/ssl_client_certificate_selector.cc b/chrome/browser/ui/gtk/ssl_client_certificate_selector.cc index ebf2e78..d96e1d2 100644 --- a/chrome/browser/ui/gtk/ssl_client_certificate_selector.cc +++ b/chrome/browser/ui/gtk/ssl_client_certificate_selector.cc @@ -249,7 +249,7 @@ std::string SSLClientCertificateSelector::FormatComboBoxText( net::X509Certificate::OSCertHandle cert, const std::string& nickname) { std::string rv(nickname); rv += " ["; - rv += x509_certificate_model::GetSerialNumberHexified(cert, ""); + rv += x509_certificate_model::GetSerialNumberHexified(cert, std::string()); rv += ']'; return rv; } @@ -266,8 +266,8 @@ std::string SSLClientCertificateSelector::FormatDetailsText( rv += "\n "; rv += l10n_util::GetStringFUTF8( IDS_CERT_SERIAL_NUMBER_FORMAT, - UTF8ToUTF16( - x509_certificate_model::GetSerialNumberHexified(cert, ""))); + UTF8ToUTF16(x509_certificate_model::GetSerialNumberHexified( + cert, std::string()))); base::Time issued, expires; if (x509_certificate_model::GetTimes(cert, &issued, &expires)) { diff --git a/chrome/browser/ui/prefs/prefs_tab_helper.cc b/chrome/browser/ui/prefs/prefs_tab_helper.cc index b629064..7056161 100644 --- a/chrome/browser/ui/prefs/prefs_tab_helper.cc +++ b/chrome/browser/ui/prefs/prefs_tab_helper.cc @@ -152,7 +152,7 @@ ALL_FONT_SCRIPTS(WEBKIT_WEBPREFS_FONTS_STANDARD) // We haven't already set a default value for this font preference, so set // an empty string as the default. registry->RegisterStringPref( - pref_name, "", PrefRegistrySyncable::UNSYNCABLE_PREF); + pref_name, std::string(), PrefRegistrySyncable::UNSYNCABLE_PREF); } } } @@ -587,7 +587,7 @@ void PrefsTabHelper::RegisterUserPrefs(PrefRegistrySyncable* registry) { IDS_STATIC_ENCODING_LIST, PrefRegistrySyncable::UNSYNCABLE_PREF); registry->RegisterStringPref(prefs::kRecentlySelectedEncoding, - "", + std::string(), PrefRegistrySyncable::UNSYNCABLE_PREF); RegisterPrefsToMigrate(registry); @@ -666,7 +666,7 @@ void PrefsTabHelper::OnWebPrefChanged(const std::string& pref_name) { if (pref_value.empty()) { WebPreferences web_prefs = web_contents_->GetRenderViewHost()->GetWebkitPreferences(); - OverrideFontFamily(&web_prefs, generic_family, script, ""); + OverrideFontFamily(&web_prefs, generic_family, script, std::string()); web_contents_->GetRenderViewHost()->UpdateWebkitPreferences(web_prefs); return; } diff --git a/chrome/browser/ui/search/instant_browsertest.cc b/chrome/browser/ui/search/instant_browsertest.cc index 6afe15b..2e4beb2 100644 --- a/chrome/browser/ui/search/instant_browsertest.cc +++ b/chrome/browser/ui/search/instant_browsertest.cc @@ -607,7 +607,7 @@ IN_PROC_BROWSER_TEST_F(InstantTest, PageVisibility) { EXPECT_TRUE(CheckVisibilityIs(overlay, true)); // Deleting the omnibox text should hide the overlay. - SetOmniboxText(""); + SetOmniboxText(std::string()); EXPECT_TRUE(CheckVisibilityIs(active_tab, true)); EXPECT_TRUE(CheckVisibilityIs(overlay, false)); diff --git a/chrome/browser/ui/startup/startup_browser_creator_impl.cc b/chrome/browser/ui/startup/startup_browser_creator_impl.cc index 7600026..1d0cff3 100644 --- a/chrome/browser/ui/startup/startup_browser_creator_impl.cc +++ b/chrome/browser/ui/startup/startup_browser_creator_impl.cc @@ -933,8 +933,8 @@ void StartupBrowserCreatorImpl::AddStartupURLs( GURL(std::string(chrome::kChromeUISettingsURL) + chrome::kManagedUserSettingsSubPage)); if (has_reset_local_passphrase_switch) { - prefs->SetString(prefs::kManagedModeLocalPassphrase, ""); - prefs->SetString(prefs::kManagedModeLocalSalt, ""); + prefs->SetString(prefs::kManagedModeLocalPassphrase, std::string()); + prefs->SetString(prefs::kManagedModeLocalSalt, std::string()); } } diff --git a/chrome/browser/ui/sync/one_click_signin_helper_unittest.cc b/chrome/browser/ui/sync/one_click_signin_helper_unittest.cc index e879b6e..4892ab6 100644 --- a/chrome/browser/ui/sync/one_click_signin_helper_unittest.cc +++ b/chrome/browser/ui/sync/one_click_signin_helper_unittest.cc @@ -389,13 +389,15 @@ TEST_F(OneClickSigninHelperTest, CanOfferNoContents) { "user@gmail.com", &error_message)); EXPECT_EQ("", error_message); EXPECT_FALSE(OneClickSigninHelper::CanOffer( - NULL, OneClickSigninHelper::CAN_OFFER_FOR_INTERSTITAL_ONLY, - "", &error_message)); + NULL, + OneClickSigninHelper::CAN_OFFER_FOR_INTERSTITAL_ONLY, + std::string(), + &error_message)); EXPECT_EQ("", error_message); } TEST_F(OneClickSigninHelperTest, CanOffer) { - CreateSigninManager(false, ""); + CreateSigninManager(false, std::string()); EXPECT_CALL(*signin_manager_, IsAllowedUsername(_)). WillRepeatedly(Return(true)); @@ -408,9 +410,10 @@ TEST_F(OneClickSigninHelperTest, CanOffer) { web_contents(), OneClickSigninHelper::CAN_OFFER_FOR_ALL, "user@gmail.com", NULL)); EXPECT_TRUE(OneClickSigninHelper::CanOffer( - web_contents(), - OneClickSigninHelper::CAN_OFFER_FOR_INTERSTITAL_ONLY, - "", NULL)); + web_contents(), + OneClickSigninHelper::CAN_OFFER_FOR_INTERSTITAL_ONLY, + std::string(), + NULL)); EnableOneClick(false); @@ -424,14 +427,15 @@ TEST_F(OneClickSigninHelperTest, CanOffer) { web_contents(), OneClickSigninHelper::CAN_OFFER_FOR_ALL, "user@gmail.com", &error_message)); EXPECT_FALSE(OneClickSigninHelper::CanOffer( - web_contents(), - OneClickSigninHelper::CAN_OFFER_FOR_INTERSTITAL_ONLY, - "", &error_message)); + web_contents(), + OneClickSigninHelper::CAN_OFFER_FOR_INTERSTITAL_ONLY, + std::string(), + &error_message)); EXPECT_EQ("", error_message); } TEST_F(OneClickSigninHelperTest, CanOfferFirstSetup) { - CreateSigninManager(false, ""); + CreateSigninManager(false, std::string()); EXPECT_CALL(*signin_manager_, IsAllowedUsername(_)). WillRepeatedly(Return(true)); @@ -454,8 +458,10 @@ TEST_F(OneClickSigninHelperTest, CanOfferFirstSetup) { OneClickSigninHelper::CAN_OFFER_FOR_INTERSTITAL_ONLY, "foo@gmail.com", NULL)); EXPECT_TRUE(OneClickSigninHelper::CanOffer( - web_contents(), OneClickSigninHelper::CAN_OFFER_FOR_INTERSTITAL_ONLY, - "", NULL)); + web_contents(), + OneClickSigninHelper::CAN_OFFER_FOR_INTERSTITAL_ONLY, + std::string(), + NULL)); } TEST_F(OneClickSigninHelperTest, CanOfferProfileConnected) { @@ -492,12 +498,14 @@ TEST_F(OneClickSigninHelperTest, CanOfferProfileConnected) { UTF8ToUTF16("foo@gmail.com")), error_message); EXPECT_TRUE(OneClickSigninHelper::CanOffer( - web_contents(), OneClickSigninHelper::CAN_OFFER_FOR_INTERSTITAL_ONLY, - "", &error_message)); + web_contents(), + OneClickSigninHelper::CAN_OFFER_FOR_INTERSTITAL_ONLY, + std::string(), + &error_message)); } TEST_F(OneClickSigninHelperTest, CanOfferUsernameNotAllowed) { - CreateSigninManager(false, ""); + CreateSigninManager(false, std::string()); EXPECT_CALL(*signin_manager_, IsAllowedUsername(_)). WillRepeatedly(Return(false)); @@ -513,16 +521,15 @@ TEST_F(OneClickSigninHelperTest, CanOfferUsernameNotAllowed) { "foo@gmail.com", &error_message)); EXPECT_EQ(l10n_util::GetStringUTF8(IDS_SYNC_LOGIN_NAME_PROHIBITED), error_message); - EXPECT_TRUE( - OneClickSigninHelper::CanOffer( - web_contents(), - OneClickSigninHelper::CAN_OFFER_FOR_INTERSTITAL_ONLY, - "", - &error_message)); + EXPECT_TRUE(OneClickSigninHelper::CanOffer( + web_contents(), + OneClickSigninHelper::CAN_OFFER_FOR_INTERSTITAL_ONLY, + std::string(), + &error_message)); } TEST_F(OneClickSigninHelperTest, CanOfferWithRejectedEmail) { - CreateSigninManager(false, ""); + CreateSigninManager(false, std::string()); EXPECT_CALL(*signin_manager_, IsAllowedUsername(_)). WillRepeatedly(Return(true)); @@ -551,7 +558,7 @@ TEST_F(OneClickSigninHelperTest, CanOfferWithRejectedEmail) { } TEST_F(OneClickSigninHelperTest, CanOfferIncognito) { - CreateSigninManager(true, ""); + CreateSigninManager(true, std::string()); std::string error_message; EXPECT_FALSE(OneClickSigninHelper::CanOffer( @@ -563,13 +570,15 @@ TEST_F(OneClickSigninHelperTest, CanOfferIncognito) { "user@gmail.com", &error_message)); EXPECT_EQ("", error_message); EXPECT_FALSE(OneClickSigninHelper::CanOffer( - web_contents(), OneClickSigninHelper::CAN_OFFER_FOR_INTERSTITAL_ONLY, - "", &error_message)); + web_contents(), + OneClickSigninHelper::CAN_OFFER_FOR_INTERSTITAL_ONLY, + std::string(), + &error_message)); EXPECT_EQ("", error_message); } TEST_F(OneClickSigninHelperTest, CanOfferNoSigninCookies) { - CreateSigninManager(false, ""); + CreateSigninManager(false, std::string()); AllowSigninCookies(false); EXPECT_CALL(*signin_manager_, IsAllowedUsername(_)). @@ -585,8 +594,10 @@ TEST_F(OneClickSigninHelperTest, CanOfferNoSigninCookies) { "user@gmail.com", &error_message)); EXPECT_EQ("", error_message); EXPECT_FALSE(OneClickSigninHelper::CanOffer( - web_contents(), OneClickSigninHelper::CAN_OFFER_FOR_INTERSTITAL_ONLY, - "", &error_message)); + web_contents(), + OneClickSigninHelper::CAN_OFFER_FOR_INTERSTITAL_ONLY, + std::string(), + &error_message)); EXPECT_EQ("", error_message); } @@ -595,7 +606,7 @@ TEST_F(OneClickSigninHelperTest, CanOfferUntrustedProcess) { ASSERT_NE(trusted.GetID(), process()->GetID()); // Make sure the RenderProcessHost used by the test is untrusted. SetTrustedSigninProcessID(trusted.GetID()); - CreateSigninManager(false, ""); + CreateSigninManager(false, std::string()); EXPECT_CALL(*signin_manager_, IsAllowedUsername(_)). WillRepeatedly(Return(true)); @@ -607,7 +618,7 @@ TEST_F(OneClickSigninHelperTest, CanOfferUntrustedProcess) { } TEST_F(OneClickSigninHelperTest, CanOfferDisabledByPolicy) { - CreateSigninManager(false, ""); + CreateSigninManager(false, std::string()); EXPECT_CALL(*signin_manager_, IsAllowedUsername(_)). WillRepeatedly(Return(true)); @@ -642,7 +653,7 @@ TEST_F(OneClickSigninHelperTest, CanOfferDisabledByPolicy) { // Should not crash if a helper instance is not associated with an incognito // web contents. TEST_F(OneClickSigninHelperTest, ShowInfoBarUIThreadIncognito) { - CreateSigninManager(true, ""); + CreateSigninManager(true, std::string()); OneClickSigninHelper* helper = OneClickSigninHelper::FromWebContents(web_contents()); EXPECT_EQ(NULL, helper); @@ -657,9 +668,9 @@ TEST_F(OneClickSigninHelperTest, ShowInfoBarUIThreadIncognito) { // config sync, then Chrome should redirect immidiately to sync settings page, // and upon successful setup, redirect back to webstore. TEST_F(OneClickSigninHelperTest, SigninFromWebstoreWithConfigSyncfirst) { - CreateSigninManager(false, ""); - EXPECT_CALL(*signin_manager_, IsAllowedUsername(_)). - WillRepeatedly(Return(true)); + CreateSigninManager(false, std::string()); + EXPECT_CALL(*signin_manager_, IsAllowedUsername(_)) + .WillRepeatedly(Return(true)); CreateProfileSyncServiceMock(); @@ -687,9 +698,9 @@ TEST_F(OneClickSigninHelperTest, SigninFromWebstoreWithConfigSyncfirst) { } TEST_F(OneClickSigninHelperTest, ShowSigninBubbleAfterSigninComplete) { - CreateSigninManager(false, ""); - EXPECT_CALL(*signin_manager_, IsAllowedUsername(_)). - WillRepeatedly(Return(true)); + CreateSigninManager(false, std::string()); + EXPECT_CALL(*signin_manager_, IsAllowedUsername(_)) + .WillRepeatedly(Return(true)); CreateProfileSyncServiceMock(); @@ -725,31 +736,34 @@ TEST_F(OneClickSigninHelperIOTest, CanOfferOnIOThread) { scoped_ptr<TestProfileIOData> io_data(CreateTestProfileIOData(false)); EXPECT_EQ(OneClickSigninHelper::CAN_OFFER, OneClickSigninHelper::CanOfferOnIOThreadImpl( - valid_gaia_url_, "", &request_, io_data.get())); + valid_gaia_url_, std::string(), &request_, io_data.get())); } TEST_F(OneClickSigninHelperIOTest, CanOfferOnIOThreadIncognito) { scoped_ptr<TestProfileIOData> io_data(CreateTestProfileIOData(true)); EXPECT_EQ(OneClickSigninHelper::DONT_OFFER, OneClickSigninHelper::CanOfferOnIOThreadImpl( - valid_gaia_url_, "", &request_, io_data.get())); + valid_gaia_url_, std::string(), &request_, io_data.get())); } TEST_F(OneClickSigninHelperIOTest, CanOfferOnIOThreadNoIOData) { EXPECT_EQ(OneClickSigninHelper::DONT_OFFER, OneClickSigninHelper::CanOfferOnIOThreadImpl( - valid_gaia_url_, "", &request_, NULL)); + valid_gaia_url_, std::string(), &request_, NULL)); } TEST_F(OneClickSigninHelperIOTest, CanOfferOnIOThreadBadURL) { scoped_ptr<TestProfileIOData> io_data(CreateTestProfileIOData(false)); + EXPECT_EQ( + OneClickSigninHelper::IGNORE_REQUEST, + OneClickSigninHelper::CanOfferOnIOThreadImpl( + GURL("https://foo.com/"), std::string(), &request_, io_data.get())); EXPECT_EQ(OneClickSigninHelper::IGNORE_REQUEST, OneClickSigninHelper::CanOfferOnIOThreadImpl( - GURL("https://foo.com/"), "", &request_, io_data.get())); - EXPECT_EQ(OneClickSigninHelper::IGNORE_REQUEST, - OneClickSigninHelper::CanOfferOnIOThreadImpl( - GURL("http://accounts.google.com/"), "", - &request_, io_data.get())); + GURL("http://accounts.google.com/"), + std::string(), + &request_, + io_data.get())); } TEST_F(OneClickSigninHelperIOTest, CanOfferOnIOThreadReferrer) { @@ -796,7 +810,7 @@ TEST_F(OneClickSigninHelperIOTest, CanOfferOnIOThreadDisabled) { scoped_ptr<TestProfileIOData> io_data(CreateTestProfileIOData(false)); EXPECT_EQ(OneClickSigninHelper::DONT_OFFER, OneClickSigninHelper::CanOfferOnIOThreadImpl( - valid_gaia_url_, "", &request_, io_data.get())); + valid_gaia_url_, std::string(), &request_, io_data.get())); } TEST_F(OneClickSigninHelperIOTest, CanOfferOnIOThreadSignedIn) { @@ -806,7 +820,7 @@ TEST_F(OneClickSigninHelperIOTest, CanOfferOnIOThreadSignedIn) { scoped_ptr<TestProfileIOData> io_data(CreateTestProfileIOData(false)); EXPECT_EQ(OneClickSigninHelper::DONT_OFFER, OneClickSigninHelper::CanOfferOnIOThreadImpl( - valid_gaia_url_, "", &request_, io_data.get())); + valid_gaia_url_, std::string(), &request_, io_data.get())); } TEST_F(OneClickSigninHelperIOTest, CanOfferOnIOThreadEmailNotAllowed) { @@ -814,7 +828,7 @@ TEST_F(OneClickSigninHelperIOTest, CanOfferOnIOThreadEmailNotAllowed) { scoped_ptr<TestProfileIOData> io_data(CreateTestProfileIOData(false)); EXPECT_EQ(OneClickSigninHelper::DONT_OFFER, OneClickSigninHelper::CanOfferOnIOThreadImpl( - valid_gaia_url_, "", &request_, io_data.get())); + valid_gaia_url_, std::string(), &request_, io_data.get())); } TEST_F(OneClickSigninHelperIOTest, CanOfferOnIOThreadEmailAlreadyUsed) { @@ -827,7 +841,7 @@ TEST_F(OneClickSigninHelperIOTest, CanOfferOnIOThreadEmailAlreadyUsed) { scoped_ptr<TestProfileIOData> io_data(CreateTestProfileIOData(false)); EXPECT_EQ(OneClickSigninHelper::DONT_OFFER, OneClickSigninHelper::CanOfferOnIOThreadImpl( - valid_gaia_url_, "", &request_, io_data.get())); + valid_gaia_url_, std::string(), &request_, io_data.get())); } TEST_F(OneClickSigninHelperIOTest, CanOfferOnIOThreadWithRejectedEmail) { @@ -835,7 +849,7 @@ TEST_F(OneClickSigninHelperIOTest, CanOfferOnIOThreadWithRejectedEmail) { scoped_ptr<TestProfileIOData> io_data(CreateTestProfileIOData(false)); EXPECT_EQ(OneClickSigninHelper::DONT_OFFER, OneClickSigninHelper::CanOfferOnIOThreadImpl( - valid_gaia_url_, "", &request_, io_data.get())); + valid_gaia_url_, std::string(), &request_, io_data.get())); } TEST_F(OneClickSigninHelperIOTest, CanOfferOnIOThreadNoSigninCookies) { @@ -843,14 +857,14 @@ TEST_F(OneClickSigninHelperIOTest, CanOfferOnIOThreadNoSigninCookies) { scoped_ptr<TestProfileIOData> io_data(CreateTestProfileIOData(false)); EXPECT_EQ(OneClickSigninHelper::DONT_OFFER, OneClickSigninHelper::CanOfferOnIOThreadImpl( - valid_gaia_url_, "", &request_, io_data.get())); + valid_gaia_url_, std::string(), &request_, io_data.get())); } TEST_F(OneClickSigninHelperIOTest, CanOfferOnIOThreadDisabledByPolicy) { scoped_ptr<TestProfileIOData> io_data(CreateTestProfileIOData(false)); EXPECT_EQ(OneClickSigninHelper::CAN_OFFER, OneClickSigninHelper::CanOfferOnIOThreadImpl( - valid_gaia_url_, "", &request_, io_data.get())); + valid_gaia_url_, std::string(), &request_, io_data.get())); // Simulate a policy disabling signin by writing kSigninAllowed directly. // We should not offer to sign in the browser. @@ -858,7 +872,7 @@ TEST_F(OneClickSigninHelperIOTest, CanOfferOnIOThreadDisabledByPolicy) { prefs::kSigninAllowed, base::Value::CreateBooleanValue(false)); EXPECT_EQ(OneClickSigninHelper::DONT_OFFER, OneClickSigninHelper::CanOfferOnIOThreadImpl( - valid_gaia_url_, "", &request_, io_data.get())); + valid_gaia_url_, std::string(), &request_, io_data.get())); // Reset the preference. profile_->GetTestingPrefService()->SetManagedPref( @@ -870,5 +884,5 @@ TEST_F(OneClickSigninHelperIOTest, CanOfferOnIOThreadDisabledByPolicy) { prefs::kSyncManaged, base::Value::CreateBooleanValue(true)); EXPECT_EQ(OneClickSigninHelper::CAN_OFFER, OneClickSigninHelper::CanOfferOnIOThreadImpl( - valid_gaia_url_, "", &request_, io_data.get())); + valid_gaia_url_, std::string(), &request_, io_data.get())); } diff --git a/chrome/browser/ui/sync/tab_contents_synced_tab_delegate.cc b/chrome/browser/ui/sync/tab_contents_synced_tab_delegate.cc index 4b003cf..4115f18 100644 --- a/chrome/browser/ui/sync/tab_contents_synced_tab_delegate.cc +++ b/chrome/browser/ui/sync/tab_contents_synced_tab_delegate.cc @@ -43,7 +43,7 @@ Profile* TabContentsSyncedTabDelegate::profile() const { std::string TabContentsSyncedTabDelegate::GetExtensionAppId() const { const scoped_refptr<const extensions::Extension> extension_app( extensions::TabHelper::FromWebContents(web_contents_)->extension_app()); - return (extension_app.get() ? extension_app->id() : ""); + return (extension_app.get() ? extension_app->id() : std::string()); } int TabContentsSyncedTabDelegate::GetCurrentEntryIndex() const { diff --git a/chrome/browser/ui/website_settings/website_settings.cc b/chrome/browser/ui/website_settings/website_settings.cc index daf7257..8a37c39 100644 --- a/chrome/browser/ui/website_settings/website_settings.cc +++ b/chrome/browser/ui/website_settings/website_settings.cc @@ -143,12 +143,18 @@ void WebsiteSettings::OnSitePermissionChanged(ContentSettingsType type, secondary_pattern = ContentSettingsPattern::Wildcard(); // Set permission for both microphone and camera. content_settings_->SetContentSetting( - primary_pattern, secondary_pattern, - CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, "", setting); + primary_pattern, + secondary_pattern, + CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, + std::string(), + setting); content_settings_->SetContentSetting( - primary_pattern, secondary_pattern, - CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, "", setting); + primary_pattern, + secondary_pattern, + CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, + std::string(), + setting); break; } default: @@ -167,7 +173,7 @@ void WebsiteSettings::OnSitePermissionChanged(ContentSettingsType type, // can not create media settings exceptions by hand. content_settings::SettingInfo info; scoped_ptr<Value> v(content_settings_->GetWebsiteSetting( - site_url_, site_url_, type, "", &info)); + site_url_, site_url_, type, std::string(), &info)); DCHECK(info.source == content_settings::SETTING_SOURCE_USER); ContentSettingsPattern::Relation r1 = info.primary_pattern.Compare(primary_pattern); @@ -188,7 +194,7 @@ void WebsiteSettings::OnSitePermissionChanged(ContentSettingsType type, if (setting != CONTENT_SETTING_DEFAULT) value = Value::CreateIntegerValue(setting); content_settings_->SetWebsiteSetting( - primary_pattern, secondary_pattern, type, "", value); + primary_pattern, secondary_pattern, type, std::string(), value); } show_info_bar_ = true; @@ -452,14 +458,20 @@ void WebsiteSettings::PresentSitePermissions() { content_settings::SettingInfo info; if (permission_info.type == CONTENT_SETTINGS_TYPE_MEDIASTREAM) { scoped_ptr<base::Value> mic_value(content_settings_->GetWebsiteSetting( - site_url_, site_url_, CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, - "", &info)); + site_url_, + site_url_, + CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, + std::string(), + &info)); ContentSetting mic_setting = content_settings::ValueToContentSetting(mic_value.get()); scoped_ptr<base::Value> camera_value(content_settings_->GetWebsiteSetting( - site_url_, site_url_, CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, - "", &info)); + site_url_, + site_url_, + CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, + std::string(), + &info)); ContentSetting camera_setting = content_settings::ValueToContentSetting(camera_value.get()); @@ -469,7 +481,7 @@ void WebsiteSettings::PresentSitePermissions() { permission_info.setting = mic_setting; } else { scoped_ptr<Value> value(content_settings_->GetWebsiteSetting( - site_url_, site_url_, permission_info.type, "", &info)); + site_url_, site_url_, permission_info.type, std::string(), &info)); DCHECK(value.get()); if (value->GetType() == Value::TYPE_INTEGER) { permission_info.setting = diff --git a/chrome/browser/ui/website_settings/website_settings_unittest.cc b/chrome/browser/ui/website_settings/website_settings_unittest.cc index 4fe881a..8f486af 100644 --- a/chrome/browser/ui/website_settings/website_settings_unittest.cc +++ b/chrome/browser/ui/website_settings/website_settings_unittest.cc @@ -165,22 +165,22 @@ TEST_F(WebsiteSettingsTest, OnPermissionsChanged) { HostContentSettingsMap* content_settings = profile()->GetHostContentSettingsMap(); ContentSetting setting = content_settings->GetContentSetting( - url(), url(), CONTENT_SETTINGS_TYPE_POPUPS, ""); + url(), url(), CONTENT_SETTINGS_TYPE_POPUPS, std::string()); EXPECT_EQ(setting, CONTENT_SETTING_BLOCK); setting = content_settings->GetContentSetting( - url(), url(), CONTENT_SETTINGS_TYPE_PLUGINS, ""); + url(), url(), CONTENT_SETTINGS_TYPE_PLUGINS, std::string()); EXPECT_EQ(setting, CONTENT_SETTING_ALLOW); setting = content_settings->GetContentSetting( - url(), url(), CONTENT_SETTINGS_TYPE_GEOLOCATION, ""); + url(), url(), CONTENT_SETTINGS_TYPE_GEOLOCATION, std::string()); EXPECT_EQ(setting, CONTENT_SETTING_ASK); setting = content_settings->GetContentSetting( - url(), url(), CONTENT_SETTINGS_TYPE_NOTIFICATIONS, ""); + url(), url(), CONTENT_SETTINGS_TYPE_NOTIFICATIONS, std::string()); EXPECT_EQ(setting, CONTENT_SETTING_ASK); setting = content_settings->GetContentSetting( - url(), url(), CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, ""); + url(), url(), CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, std::string()); EXPECT_EQ(setting, CONTENT_SETTING_ASK); setting = content_settings->GetContentSetting( - url(), url(), CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, ""); + url(), url(), CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, std::string()); EXPECT_EQ(setting, CONTENT_SETTING_ASK); EXPECT_CALL(*mock_ui(), SetIdentityInfo(_)); @@ -212,22 +212,22 @@ TEST_F(WebsiteSettingsTest, OnPermissionsChanged) { // Verify that the site permissions were changed correctly. setting = content_settings->GetContentSetting( - url(), url(), CONTENT_SETTINGS_TYPE_POPUPS, ""); + url(), url(), CONTENT_SETTINGS_TYPE_POPUPS, std::string()); EXPECT_EQ(setting, CONTENT_SETTING_ALLOW); setting = content_settings->GetContentSetting( - url(), url(), CONTENT_SETTINGS_TYPE_PLUGINS, ""); + url(), url(), CONTENT_SETTINGS_TYPE_PLUGINS, std::string()); EXPECT_EQ(setting, CONTENT_SETTING_BLOCK); setting = content_settings->GetContentSetting( - url(), url(), CONTENT_SETTINGS_TYPE_GEOLOCATION, ""); + url(), url(), CONTENT_SETTINGS_TYPE_GEOLOCATION, std::string()); EXPECT_EQ(setting, CONTENT_SETTING_ALLOW); setting = content_settings->GetContentSetting( - url(), url(), CONTENT_SETTINGS_TYPE_NOTIFICATIONS, ""); + url(), url(), CONTENT_SETTINGS_TYPE_NOTIFICATIONS, std::string()); EXPECT_EQ(setting, CONTENT_SETTING_ALLOW); setting = content_settings->GetContentSetting( - url(), url(), CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, ""); + url(), url(), CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, std::string()); EXPECT_EQ(setting, CONTENT_SETTING_ALLOW); setting = content_settings->GetContentSetting( - url(), url(), CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, ""); + url(), url(), CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, std::string()); EXPECT_EQ(setting, CONTENT_SETTING_ALLOW); } diff --git a/chrome/browser/ui/webui/about_ui.cc b/chrome/browser/ui/webui/about_ui.cc index 861d2be..b2dc2ae 100644 --- a/chrome/browser/ui/webui/about_ui.cc +++ b/chrome/browser/ui/webui/about_ui.cc @@ -785,15 +785,21 @@ std::string AboutSandbox() { data.append("<table>"); - AboutSandboxRow(&data, "", IDS_ABOUT_SANDBOX_SUID_SANDBOX, + AboutSandboxRow(&data, + std::string(), + IDS_ABOUT_SANDBOX_SUID_SANDBOX, status & content::kSandboxLinuxSUID); AboutSandboxRow(&data, " ", IDS_ABOUT_SANDBOX_PID_NAMESPACES, status & content::kSandboxLinuxPIDNS); AboutSandboxRow(&data, " ", IDS_ABOUT_SANDBOX_NET_NAMESPACES, status & content::kSandboxLinuxNetNS); - AboutSandboxRow(&data, "", IDS_ABOUT_SANDBOX_SECCOMP_LEGACY_SANDBOX, + AboutSandboxRow(&data, + std::string(), + IDS_ABOUT_SANDBOX_SECCOMP_LEGACY_SANDBOX, status & content::kSandboxLinuxSeccompLegacy); - AboutSandboxRow(&data, "", IDS_ABOUT_SANDBOX_SECCOMP_BPF_SANDBOX, + AboutSandboxRow(&data, + std::string(), + IDS_ABOUT_SANDBOX_SECCOMP_BPF_SANDBOX, status & content::kSandboxLinuxSeccompBpf); data.append("</table>"); diff --git a/chrome/browser/ui/webui/downloads_dom_handler_browsertest.cc b/chrome/browser/ui/webui/downloads_dom_handler_browsertest.cc index 0bfa286..19e6404 100644 --- a/chrome/browser/ui/webui/downloads_dom_handler_browsertest.cc +++ b/chrome/browser/ui/webui/downloads_dom_handler_browsertest.cc @@ -147,7 +147,7 @@ IN_PROC_BROWSER_TEST_F(DownloadsDOMHandlerTest, base::FilePath(FILE_PATH_LITERAL("/path/to/file")), base::FilePath(FILE_PATH_LITERAL("/path/to/file")), url_chain, - GURL(""), + GURL(std::string()), current, current, 128, diff --git a/chrome/browser/ui/webui/extensions/extension_settings_handler.cc b/chrome/browser/ui/webui/extensions/extension_settings_handler.cc index bd3bc6f..914939e 100644 --- a/chrome/browser/ui/webui/extensions/extension_settings_handler.cc +++ b/chrome/browser/ui/webui/extensions/extension_settings_handler.cc @@ -930,9 +930,14 @@ void ExtensionSettingsHandler::HandleLoadUnpackedExtensionMessage( load_extension_dialog_ = ui::SelectFileDialog::Create( this, new ChromeSelectFilePolicy(web_ui()->GetWebContents())); load_extension_dialog_->SelectFile( - kSelectType, select_title, last_unpacked_directory_, NULL, - kFileTypeIndex, FILE_PATH_LITERAL(""), - web_ui()->GetWebContents()->GetView()->GetTopLevelNativeWindow(), NULL); + kSelectType, + select_title, + last_unpacked_directory_, + NULL, + kFileTypeIndex, + FILE_PATH_LITERAL(std::string()), + web_ui()->GetWebContents()->GetView()->GetTopLevelNativeWindow(), + NULL); } void ExtensionSettingsHandler::ShowAlert(const std::string& message) { diff --git a/chrome/browser/ui/webui/extensions/pack_extension_handler.cc b/chrome/browser/ui/webui/extensions/pack_extension_handler.cc index a69cd4d..0623fda 100644 --- a/chrome/browser/ui/webui/extensions/pack_extension_handler.cc +++ b/chrome/browser/ui/webui/extensions/pack_extension_handler.cc @@ -184,8 +184,12 @@ void PackExtensionHandler::HandleSelectFilePathMessage( load_extension_dialog_ = ui::SelectFileDialog::Create( this, new ChromeSelectFilePolicy(web_ui()->GetWebContents())); load_extension_dialog_->SelectFile( - type, select_title, base::FilePath(), &info, file_type_index, - FILE_PATH_LITERAL(""), + type, + select_title, + base::FilePath(), + &info, + file_type_index, + FILE_PATH_LITERAL(std::string()), web_ui()->GetWebContents()->GetView()->GetTopLevelNativeWindow(), NULL); } diff --git a/chrome/browser/ui/webui/favicon_source.cc b/chrome/browser/ui/webui/favicon_source.cc index 6864120..232b6eb 100644 --- a/chrome/browser/ui/webui/favicon_source.cc +++ b/chrome/browser/ui/webui/favicon_source.cc @@ -253,10 +253,8 @@ void FaviconSource::OnFaviconDataAvailable( void FaviconSource::SendDefaultResponse( const content::URLDataSource::GotDataCallback& callback) { - SendDefaultResponse(IconRequest(callback, - "", - 16, - ui::SCALE_FACTOR_100P)); + SendDefaultResponse( + IconRequest(callback, std::string(), 16, ui::SCALE_FACTOR_100P)); } void FaviconSource::SendDefaultResponse(const IconRequest& icon_request) { diff --git a/chrome/browser/ui/webui/feedback_ui.cc b/chrome/browser/ui/webui/feedback_ui.cc index 3cb20bf..b28e065 100644 --- a/chrome/browser/ui/webui/feedback_ui.cc +++ b/chrome/browser/ui/webui/feedback_ui.cc @@ -409,23 +409,23 @@ bool FeedbackHandler::Init() { std::string query_str = *it; if (StartsWithASCII(query_str, std::string(kSessionIDParameter), true)) { ReplaceFirstSubstringAfterOffset( - &query_str, 0, kSessionIDParameter, ""); + &query_str, 0, kSessionIDParameter, std::string()); if (!base::StringToInt(query_str, &session_id)) return false; } else if (StartsWithASCII(*it, std::string(kTabIndexParameter), true)) { ReplaceFirstSubstringAfterOffset( - &query_str, 0, kTabIndexParameter, ""); + &query_str, 0, kTabIndexParameter, std::string()); if (!base::StringToInt(query_str, &index)) return false; } else if (StartsWithASCII(*it, std::string(kCustomPageUrlParameter), true)) { ReplaceFirstSubstringAfterOffset( - &query_str, 0, kCustomPageUrlParameter, ""); + &query_str, 0, kCustomPageUrlParameter, std::string()); custom_page_url = query_str; } else if (StartsWithASCII(*it, std::string(kCategoryTagParameter), true)) { ReplaceFirstSubstringAfterOffset( - &query_str, 0, kCategoryTagParameter, ""); + &query_str, 0, kCategoryTagParameter, std::string()); category_tag_ = query_str; #if defined(OS_CHROMEOS) } else if (StartsWithASCII(*it, std::string(kTimestampParameter), true)) { diff --git a/chrome/browser/ui/webui/inspect_ui.cc b/chrome/browser/ui/webui/inspect_ui.cc index b0b67c3..b98ea9e 100644 --- a/chrome/browser/ui/webui/inspect_ui.cc +++ b/chrome/browser/ui/webui/inspect_ui.cc @@ -462,7 +462,7 @@ void InspectUI::OnAdbPages( targets.Append(target_data); } - std::string json_string = ""; + std::string json_string; base::JSONWriter::Write(&targets, &json_string); callback.Run(base::RefCountedString::TakeString(&json_string)); } diff --git a/chrome/browser/ui/webui/instant_ui.cc b/chrome/browser/ui/webui/instant_ui.cc index f84bf9a..23a255c 100644 --- a/chrome/browser/ui/webui/instant_ui.cc +++ b/chrome/browser/ui/webui/instant_ui.cc @@ -169,6 +169,7 @@ InstantUI::InstantUI(content::WebUI* web_ui) : WebUIController(web_ui) { // static void InstantUI::RegisterUserPrefs(PrefRegistrySyncable* registry) { - registry->RegisterStringPref(prefs::kInstantUIZeroSuggestUrlPrefix, "", + registry->RegisterStringPref(prefs::kInstantUIZeroSuggestUrlPrefix, + std::string(), PrefRegistrySyncable::UNSYNCABLE_PREF); } diff --git a/chrome/browser/ui/webui/net_internals/net_internals_ui.cc b/chrome/browser/ui/webui/net_internals/net_internals_ui.cc index cea9824..0ac1324 100644 --- a/chrome/browser/ui/webui/net_internals/net_internals_ui.cc +++ b/chrome/browser/ui/webui/net_internals/net_internals_ui.cc @@ -1409,7 +1409,7 @@ void NetInternalsMessageHandler::IOThreadImpl::OnGetSpdyStatus( next_protos_value = Value::CreateStringValue( JoinString(net::HttpStreamFactory::next_protos(), ',')); } else { - next_protos_value = Value::CreateStringValue(""); + next_protos_value = Value::CreateStringValue(std::string()); } status_dict->Set("next_protos", next_protos_value); diff --git a/chrome/browser/ui/webui/options/browser_options_handler.cc b/chrome/browser/ui/webui/options/browser_options_handler.cc index 48f4f60..081806f 100644 --- a/chrome/browser/ui/webui/options/browser_options_handler.cc +++ b/chrome/browser/ui/webui/options/browser_options_handler.cc @@ -1194,8 +1194,11 @@ void BrowserOptionsHandler::HandleSelectDownloadLocation( ui::SelectFileDialog::SELECT_FOLDER, l10n_util::GetStringUTF16(IDS_OPTIONS_DOWNLOADLOCATION_BROWSE_TITLE), pref_service->GetFilePath(prefs::kDownloadDefaultDirectory), - &info, 0, FILE_PATH_LITERAL(""), - web_ui()->GetWebContents()->GetView()->GetTopLevelNativeWindow(), NULL); + &info, + 0, + FILE_PATH_LITERAL(std::string()), + web_ui()->GetWebContents()->GetView()->GetTopLevelNativeWindow(), + NULL); } void BrowserOptionsHandler::FileSelected(const base::FilePath& path, int index, diff --git a/chrome/browser/ui/webui/options/certificate_manager_handler.cc b/chrome/browser/ui/webui/options/certificate_manager_handler.cc index c1e18da..f30eaec 100644 --- a/chrome/browser/ui/webui/options/certificate_manager_handler.cc +++ b/chrome/browser/ui/webui/options/certificate_manager_handler.cc @@ -326,7 +326,7 @@ void CertificateManagerHandler::GetLocalizedValues( l10n_util::GetStringUTF16(IDS_CERT_MANAGER_DELETE_CA_DESCRIPTION)); localized_strings->SetString("unknownCertsTabDeleteConfirm", l10n_util::GetStringUTF16(IDS_CERT_MANAGER_DELETE_UNKNOWN_FORMAT)); - localized_strings->SetString("unknownCertsTabDeleteImpact", ""); + localized_strings->SetString("unknownCertsTabDeleteImpact", std::string()); // Certificate Restore overlay strings. localized_strings->SetString("certificateRestorePasswordDescription", @@ -614,7 +614,7 @@ void CertificateManagerHandler::ExportPersonalPasswordSelected( chrome::UnlockCertSlotIfNecessary( selected_cert_list_[0].get(), chrome::kCryptoModulePasswordCertExport, - "", // unused. + std::string(), // unused. base::Bind(&CertificateManagerHandler::ExportPersonalSlotsUnlocked, base::Unretained(this))); } @@ -723,7 +723,7 @@ void CertificateManagerHandler::ImportPersonalFileRead( chrome::UnlockSlotsIfNecessary( modules, chrome::kCryptoModulePasswordCertImport, - "", // unused. + std::string(), // unused. base::Bind(&CertificateManagerHandler::ImportPersonalSlotUnlocked, base::Unretained(this))); } diff --git a/chrome/browser/ui/webui/options/content_settings_handler.cc b/chrome/browser/ui/webui/options/content_settings_handler.cc index 85249bc..549856b 100644 --- a/chrome/browser/ui/webui/options/content_settings_handler.cc +++ b/chrome/browser/ui/webui/options/content_settings_handler.cc @@ -123,7 +123,7 @@ std::string ContentSettingToString(ContentSetting setting) { NOTREACHED(); } - return ""; + return std::string(); } ContentSetting ContentSettingFromString(const std::string& name) { @@ -151,8 +151,9 @@ DictionaryValue* GetExceptionForPage( DictionaryValue* exception = new DictionaryValue(); exception->SetString(kOrigin, pattern.ToString()); exception->SetString(kEmbeddingOrigin, - secondary_pattern == ContentSettingsPattern::Wildcard() ? "" : - secondary_pattern.ToString()); + secondary_pattern == ContentSettingsPattern::Wildcard() + ? std::string() + : secondary_pattern.ToString()); exception->SetString(kSetting, ContentSettingToString(setting)); exception->SetString(kSource, provider_name); return exception; @@ -604,7 +605,7 @@ void ContentSettingsHandler::UpdateMediaSettingsView() { media_ui_settings.SetString("askText", "mediaStreamAsk"); media_ui_settings.SetString("blockText", "mediaStreamBlock"); media_ui_settings.SetBoolean("showBubble", false); - media_ui_settings.SetString("bubbleText", ""); + media_ui_settings.SetString("bubbleText", std::string()); web_ui()->CallJavascriptFunction("ContentSettings.updateMediaUI", media_ui_settings); @@ -1052,18 +1053,16 @@ void ContentSettingsHandler::RemoveMediaException( mode == "normal" ? GetContentSettingsMap() : GetOTRContentSettingsMap(); if (settings_map) { - settings_map->SetWebsiteSetting( - ContentSettingsPattern::FromString(pattern), - ContentSettingsPattern::Wildcard(), - CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, - "", - NULL); - settings_map->SetWebsiteSetting( - ContentSettingsPattern::FromString(pattern), - ContentSettingsPattern::Wildcard(), - CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, - "", - NULL); + settings_map->SetWebsiteSetting(ContentSettingsPattern::FromString(pattern), + ContentSettingsPattern::Wildcard(), + CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, + std::string(), + NULL); + settings_map->SetWebsiteSetting(ContentSettingsPattern::FromString(pattern), + ContentSettingsPattern::Wildcard(), + CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, + std::string(), + NULL); } } @@ -1088,10 +1087,11 @@ void ContentSettingsHandler::RemoveExceptionFromHostContentSettingsMap( if (settings_map) { settings_map->SetWebsiteSetting( ContentSettingsPattern::FromString(pattern), - secondary_pattern.empty() ? ContentSettingsPattern::Wildcard() : - ContentSettingsPattern::FromString(secondary_pattern), + secondary_pattern.empty() + ? ContentSettingsPattern::Wildcard() + : ContentSettingsPattern::FromString(secondary_pattern), type, - "", + std::string(), NULL); } } @@ -1259,7 +1259,7 @@ void ContentSettingsHandler::SetException(const ListValue* args) { settings_map->SetContentSetting(ContentSettingsPattern::FromString(pattern), ContentSettingsPattern::Wildcard(), type, - "", + std::string(), ContentSettingFromString(setting)); } } diff --git a/chrome/browser/ui/webui/options/font_settings_handler.cc b/chrome/browser/ui/webui/options/font_settings_handler.cc index 61f1524..558effc 100644 --- a/chrome/browser/ui/webui/options/font_settings_handler.cc +++ b/chrome/browser/ui/webui/options/font_settings_handler.cc @@ -188,8 +188,8 @@ void FontSettingsHandler::FontsListHasLoaded( option->Append(new base::StringValue(has_rtl_chars ? "rtl" : "ltr")); } else { // Add empty name/value to indicate a separator item. - option->Append(new base::StringValue("")); - option->Append(new base::StringValue("")); + option->Append(new base::StringValue(std::string())); + option->Append(new base::StringValue(std::string())); } encoding_list.Append(option); } diff --git a/chrome/browser/ui/webui/options/managed_user_passphrase_handler.cc b/chrome/browser/ui/webui/options/managed_user_passphrase_handler.cc index 2090137..f3aac91 100644 --- a/chrome/browser/ui/webui/options/managed_user_passphrase_handler.cc +++ b/chrome/browser/ui/webui/options/managed_user_passphrase_handler.cc @@ -110,8 +110,8 @@ void ManagedUserPassphraseHandler::IsPassphraseSet( void ManagedUserPassphraseHandler::ResetPassphrase( const base::ListValue* args) { PrefService* pref_service = Profile::FromWebUI(web_ui())->GetPrefs(); - pref_service->SetString(prefs::kManagedModeLocalPassphrase, ""); - pref_service->SetString(prefs::kManagedModeLocalSalt, ""); + pref_service->SetString(prefs::kManagedModeLocalPassphrase, std::string()); + pref_service->SetString(prefs::kManagedModeLocalSalt, std::string()); } void ManagedUserPassphraseHandler::SetLocalPassphrase( diff --git a/chrome/browser/ui/webui/options/preferences_browsertest.cc b/chrome/browser/ui/webui/options/preferences_browsertest.cc index 5839538..8dbc971 100644 --- a/chrome/browser/ui/webui/options/preferences_browsertest.cc +++ b/chrome/browser/ui/webui/options/preferences_browsertest.cc @@ -343,7 +343,7 @@ void PreferencesBrowserTest::VerifySetPref(const std::string& name, std::string observed_json; ASSERT_TRUE(content::ExecuteScriptAndExtractString( render_view_host_, javascript.str(), &observed_json)); - VerifyObservedPref(observed_json, name, value, "", false, !commit); + VerifyObservedPref(observed_json, name, value, std::string(), false, !commit); VerifyAndClearExpectations(); } @@ -385,7 +385,7 @@ void PreferencesBrowserTest::VerifyCommit(const std::string& name, void PreferencesBrowserTest::VerifySetCommit(const std::string& name, const base::Value* value) { ExpectSetCommit(name, value); - VerifyCommit(name, value, ""); + VerifyCommit(name, value, std::string()); VerifyAndClearExpectations(); } @@ -476,8 +476,8 @@ IN_PROC_BROWSER_TEST_F(PreferencesBrowserTest, FetchPrefs) { // Verify notifications when default values are in effect. SetupJavaScriptTestEnvironment(pref_names_, &observed_json); - VerifyObservedPrefs(observed_json, pref_names_, default_values_, - "", false, false); + VerifyObservedPrefs( + observed_json, pref_names_, default_values_, std::string(), false, false); // Verify notifications when recommended values are in effect. SetUserPolicies(policy_names_, non_default_values_, @@ -497,8 +497,12 @@ IN_PROC_BROWSER_TEST_F(PreferencesBrowserTest, FetchPrefs) { ClearUserPolicies(); SetUserValues(pref_names_, non_default_values_); SetupJavaScriptTestEnvironment(pref_names_, &observed_json); - VerifyObservedPrefs(observed_json, pref_names_, non_default_values_, - "", false, false); + VerifyObservedPrefs(observed_json, + pref_names_, + non_default_values_, + std::string(), + false, + false); } // Verifies that setting a user-modified pref value through the JavaScript @@ -550,7 +554,7 @@ IN_PROC_BROWSER_TEST_F(PreferencesBrowserTest, DialogPrefsSetRollback) { ASSERT_NO_FATAL_FAILURE(SetupJavaScriptTestEnvironment(pref_names_, NULL)); for (size_t i = 0; i < pref_names_.size(); ++i) { VerifySetPref(pref_names_[i], types_[i], non_default_values_[i], false); - VerifyRollback(pref_names_[i], default_values_[i], ""); + VerifyRollback(pref_names_[i], default_values_[i], std::string()); } // Verify behavior when recommended values are in effect. @@ -592,7 +596,7 @@ IN_PROC_BROWSER_TEST_F(PreferencesBrowserTest, DialogPrefsClearRollback) { ASSERT_NO_FATAL_FAILURE(SetupJavaScriptTestEnvironment(pref_names_, NULL)); for (size_t i = 0; i < pref_names_.size(); ++i) { VerifyClearPref(pref_names_[i], default_values_[i], false); - VerifyRollback(pref_names_[i], non_default_values_[i], ""); + VerifyRollback(pref_names_[i], non_default_values_[i], std::string()); } } @@ -624,15 +628,19 @@ IN_PROC_BROWSER_TEST_F(PreferencesBrowserTest, NotificationsOnBackendChanges) { StartObserving(); ClearUserPolicies(); FinishObserving(&observed_json); - VerifyObservedPrefs(observed_json, pref_names_, default_values_, - "", false, false); + VerifyObservedPrefs( + observed_json, pref_names_, default_values_, std::string(), false, false); // Verify notifications when user-modified values come into effect. StartObserving(); SetUserValues(pref_names_, non_default_values_); FinishObserving(&observed_json); - VerifyObservedPrefs(observed_json, pref_names_, non_default_values_, - "", false, false); + VerifyObservedPrefs(observed_json, + pref_names_, + non_default_values_, + std::string(), + false, + false); } #if defined(OS_CHROMEOS) diff --git a/chrome/browser/ui/webui/policy_ui_browsertest.cc b/chrome/browser/ui/webui/policy_ui_browsertest.cc index 6af1613..6293fef 100644 --- a/chrome/browser/ui/webui/policy_ui_browsertest.cc +++ b/chrome/browser/ui/webui/policy_ui_browsertest.cc @@ -43,7 +43,7 @@ std::vector<std::string> PopulateExpectedPolicy( metadata->scope == policy::POLICY_SCOPE_MACHINE ? IDS_POLICY_SCOPE_DEVICE : IDS_POLICY_SCOPE_USER)); } else { - expected_policy.push_back(""); + expected_policy.push_back(std::string()); } // Populate expected level. @@ -52,7 +52,7 @@ std::vector<std::string> PopulateExpectedPolicy( metadata->level == policy::POLICY_LEVEL_RECOMMENDED ? IDS_POLICY_LEVEL_RECOMMENDED : IDS_POLICY_LEVEL_MANDATORY)); } else { - expected_policy.push_back(""); + expected_policy.push_back(std::string()); } // Populate expected policy name. @@ -178,7 +178,7 @@ IN_PROC_BROWSER_TEST_F(PolicyUITest, SendPolicyNames) { for (const policy::PolicyDefinitionList::Entry* policy = policies->begin; policy != policies->end; ++policy) { expected_policies.push_back( - PopulateExpectedPolicy(policy->name, "", NULL, false)); + PopulateExpectedPolicy(policy->name, std::string(), NULL, false)); } // Retrieve the contents of the policy table from the UI and verify that it @@ -240,7 +240,8 @@ IN_PROC_BROWSER_TEST_F(PolicyUITest, SendPolicyValues) { policy != policies->end; ++policy) { std::map<std::string, std::string>::const_iterator it = expected_values.find(policy->name); - const std::string value = it == expected_values.end() ? "" : it->second; + const std::string value = + it == expected_values.end() ? std::string() : it->second; const policy::PolicyMap::Entry* metadata = values.Get(policy->name); expected_policies.insert( metadata ? expected_policies.begin() + first_unset_position++ : diff --git a/chrome/browser/ui/webui/print_preview/print_preview_handler.cc b/chrome/browser/ui/webui/print_preview/print_preview_handler.cc index 0525da3..ec05b59 100644 --- a/chrome/browser/ui/webui/print_preview/print_preview_handler.cc +++ b/chrome/browser/ui/webui/print_preview/print_preview_handler.cc @@ -866,7 +866,7 @@ void PrintPreviewHandler::SelectFile(const base::FilePath& default_filename) { sticky_settings->save_path()->Append(default_filename), &file_type_info, 0, - FILE_PATH_LITERAL(""), + FILE_PATH_LITERAL(std::string()), platform_util::GetTopLevel( preview_web_contents()->GetView()->GetNativeView()), NULL); diff --git a/chrome/browser/ui/webui/print_preview/print_preview_ui.cc b/chrome/browser/ui/webui/print_preview/print_preview_ui.cc index 52cbe91..4e10802 100644 --- a/chrome/browser/ui/webui/print_preview/print_preview_ui.cc +++ b/chrome/browser/ui/webui/print_preview/print_preview_ui.cc @@ -571,7 +571,7 @@ void PrintPreviewUI::OnClosePrintPreviewDialog() { ConstrainedWebDialogDelegate* delegate = GetConstrainedDelegate(); if (!delegate) return; - delegate->GetWebDialogDelegate()->OnDialogClosed(""); + delegate->GetWebDialogDelegate()->OnDialogClosed(std::string()); delegate->OnDialogCloseFromWebUI(); } diff --git a/chrome/browser/ui/webui/signin/profile_signin_confirmation_dialog_unittest.cc b/chrome/browser/ui/webui/signin/profile_signin_confirmation_dialog_unittest.cc index e24b730..cd6f5fe 100644 --- a/chrome/browser/ui/webui/signin/profile_signin_confirmation_dialog_unittest.cc +++ b/chrome/browser/ui/webui/signin/profile_signin_confirmation_dialog_unittest.cc @@ -142,11 +142,11 @@ class ProfileSigninConfirmationDialogTest : public testing::Test { false); // Create a dialog, but don't display it. - dialog_ = new ProfileSigninConfirmationDialog( - profile_.get(), "", - base::Bind(&base::DoNothing), - base::Bind(&base::DoNothing), - base::Bind(&base::DoNothing)); + dialog_ = new ProfileSigninConfirmationDialog(profile_.get(), + std::string(), + base::Bind(&base::DoNothing), + base::Bind(&base::DoNothing), + base::Bind(&base::DoNothing)); } virtual void TearDown() OVERRIDE { @@ -204,10 +204,10 @@ TEST_F(ProfileSigninConfirmationDialogTest, PromptForNewProfile_Extensions) { &ProfileSigninConfirmationDialog::CheckShouldPromptForNewProfile, base::Unretained(dialog_)))); - scoped_refptr<extensions::Extension> extension = CreateExtension("foo", ""); + scoped_refptr<extensions::Extension> extension = + CreateExtension("foo", std::string()); extensions->extension_prefs()->AddGrantedPermissions( - extension->id(), - make_scoped_refptr(new extensions::PermissionSet)); + extension->id(), make_scoped_refptr(new extensions::PermissionSet)); extensions->AddExtension(extension); EXPECT_TRUE( GetCallbackResult( diff --git a/chrome/browser/ui/webui/sync_setup_handler_unittest.cc b/chrome/browser/ui/webui/sync_setup_handler_unittest.cc index f958519..19f2d0e 100644 --- a/chrome/browser/ui/webui/sync_setup_handler_unittest.cc +++ b/chrome/browser/ui/webui/sync_setup_handler_unittest.cc @@ -457,8 +457,13 @@ TEST_P(SyncSetupHandlerTest, DisplayBasicLogin) { // Now make sure that the appropriate params are being passed. DictionaryValue* dictionary; ASSERT_TRUE(data.arg2->GetAsDictionary(&dictionary)); - CheckShowSyncSetupArgs( - dictionary, "", false, GoogleServiceAuthError::NONE, "", true, ""); + CheckShowSyncSetupArgs(dictionary, + std::string(), + false, + GoogleServiceAuthError::NONE, + std::string(), + true, + std::string()); } else { ASSERT_FALSE(handler_->is_configuring_sync()); ASSERT_TRUE(handler_->have_signin_tracker()); @@ -494,8 +499,13 @@ TEST_P(SyncSetupHandlerTest, DisplayForceLogin) { // Now make sure that the appropriate params are being passed. DictionaryValue* dictionary; ASSERT_TRUE(data.arg2->GetAsDictionary(&dictionary)); - CheckShowSyncSetupArgs( - dictionary, "", false, GoogleServiceAuthError::NONE, "", true, ""); + CheckShowSyncSetupArgs(dictionary, + std::string(), + false, + GoogleServiceAuthError::NONE, + std::string(), + true, + std::string()); } else { ASSERT_FALSE(handler_->is_configuring_sync()); ASSERT_TRUE(handler_->have_signin_tracker()); @@ -679,7 +689,7 @@ TEST_P(SyncSetupHandlerTest, HandleGaiaAuthFailure) { if (!SyncPromoUI::UseWebBasedSigninFlow()) { // Fake a failed signin attempt. - handler_->TryLogin(kTestUser, kTestPassword, "", ""); + handler_->TryLogin(kTestUser, kTestPassword, std::string(), std::string()); GoogleServiceAuthError error( GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS); handler_->SigninFailed(error); @@ -695,9 +705,13 @@ TEST_P(SyncSetupHandlerTest, HandleGaiaAuthFailure) { // Now make sure that the appropriate params are being passed. DictionaryValue* dictionary; ASSERT_TRUE(data.arg2->GetAsDictionary(&dictionary)); - CheckShowSyncSetupArgs( - dictionary, "", false, GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS, - kTestUser, true, ""); + CheckShowSyncSetupArgs(dictionary, + std::string(), + false, + GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS, + kTestUser, + true, + std::string()); } else { ASSERT_FALSE(handler_->is_configuring_sync()); ASSERT_TRUE(handler_->have_signin_tracker()); @@ -718,7 +732,7 @@ TEST_P(SyncSetupHandlerTest, HandleCaptcha) { if (!SyncPromoUI::UseWebBasedSigninFlow()) { // Fake a failed signin attempt that requires a captcha. - handler_->TryLogin(kTestUser, kTestPassword, "", ""); + handler_->TryLogin(kTestUser, kTestPassword, std::string(), std::string()); GoogleServiceAuthError error = GoogleServiceAuthError::FromClientLoginCaptchaChallenge( "token", GURL(kTestCaptchaImageUrl), GURL(kTestCaptchaUnlockUrl)); @@ -734,9 +748,13 @@ TEST_P(SyncSetupHandlerTest, HandleCaptcha) { // Now make sure that the appropriate params are being passed. DictionaryValue* dictionary; ASSERT_TRUE(data.arg2->GetAsDictionary(&dictionary)); - CheckShowSyncSetupArgs( - dictionary, "", false, GoogleServiceAuthError::CAPTCHA_REQUIRED, - kTestUser, true, kTestCaptchaImageUrl); + CheckShowSyncSetupArgs(dictionary, + std::string(), + false, + GoogleServiceAuthError::CAPTCHA_REQUIRED, + kTestUser, + true, + kTestCaptchaImageUrl); } else { ASSERT_FALSE(handler_->is_configuring_sync()); ASSERT_TRUE(handler_->have_signin_tracker()); @@ -758,7 +776,7 @@ TEST_P(SyncSetupHandlerTest, UnrecoverableErrorInitializingSync) { ASSERT_EQ(1U, web_ui_.call_data().size()); // Fake a successful GAIA request (gaia credentials valid, but signin not // complete yet). - handler_->TryLogin(kTestUser, kTestPassword, "", ""); + handler_->TryLogin(kTestUser, kTestPassword, std::string(), std::string()); handler_->GaiaCredentialsValid(); ASSERT_EQ(2U, web_ui_.call_data().size()); EXPECT_EQ("SyncSetupOverlay.showSuccessAndSettingUp", @@ -780,9 +798,13 @@ TEST_P(SyncSetupHandlerTest, UnrecoverableErrorInitializingSync) { // Now make sure that the appropriate params are being passed. DictionaryValue* dictionary; ASSERT_TRUE(data.arg2->GetAsDictionary(&dictionary)); - CheckShowSyncSetupArgs( - dictionary, "", true, GoogleServiceAuthError::NONE, - kTestUser, true, ""); + CheckShowSyncSetupArgs(dictionary, + std::string(), + true, + GoogleServiceAuthError::NONE, + kTestUser, + true, + std::string()); } else { ASSERT_FALSE(handler_->is_configuring_sync()); ASSERT_TRUE(handler_->have_signin_tracker()); @@ -803,7 +825,7 @@ TEST_P(SyncSetupHandlerTest, GaiaErrorInitializingSync) { ASSERT_EQ(1U, web_ui_.call_data().size()); // Fake a successful GAIA request (gaia credentials valid, but signin not // complete yet). - handler_->TryLogin(kTestUser, kTestPassword, "", ""); + handler_->TryLogin(kTestUser, kTestPassword, std::string(), std::string()); handler_->GaiaCredentialsValid(); ASSERT_EQ(2U, web_ui_.call_data().size()); EXPECT_EQ("SyncSetupOverlay.showSuccessAndSettingUp", @@ -826,9 +848,13 @@ TEST_P(SyncSetupHandlerTest, GaiaErrorInitializingSync) { // Now make sure that the appropriate params are being passed. DictionaryValue* dictionary; ASSERT_TRUE(data.arg2->GetAsDictionary(&dictionary)); - CheckShowSyncSetupArgs( - dictionary, "", false, GoogleServiceAuthError::SERVICE_UNAVAILABLE, - kTestUser, true, ""); + CheckShowSyncSetupArgs(dictionary, + std::string(), + false, + GoogleServiceAuthError::SERVICE_UNAVAILABLE, + kTestUser, + true, + std::string()); } else { ASSERT_FALSE(handler_->is_configuring_sync()); ASSERT_TRUE(handler_->have_signin_tracker()); @@ -837,7 +863,7 @@ TEST_P(SyncSetupHandlerTest, GaiaErrorInitializingSync) { TEST_P(SyncSetupHandlerTest, TestSyncEverything) { std::string args = GetConfiguration( - NULL, SYNC_ALL_DATA, GetAllTypes(), "", ENCRYPT_PASSWORDS); + NULL, SYNC_ALL_DATA, GetAllTypes(), std::string(), ENCRYPT_PASSWORDS); ListValue list_args; list_args.Append(new StringValue(args)); EXPECT_CALL(*mock_pss_, IsPassphraseRequiredForDecryption()) @@ -855,7 +881,7 @@ TEST_P(SyncSetupHandlerTest, TestSyncEverything) { TEST_P(SyncSetupHandlerTest, TurnOnEncryptAll) { std::string args = GetConfiguration( - NULL, SYNC_ALL_DATA, GetAllTypes(), "", ENCRYPT_ALL_DATA); + NULL, SYNC_ALL_DATA, GetAllTypes(), std::string(), ENCRYPT_ALL_DATA); ListValue list_args; list_args.Append(new StringValue(args)); EXPECT_CALL(*mock_pss_, IsPassphraseRequiredForDecryption()) @@ -874,7 +900,7 @@ TEST_P(SyncSetupHandlerTest, TurnOnEncryptAll) { TEST_P(SyncSetupHandlerTest, TestPassphraseStillRequired) { std::string args = GetConfiguration( - NULL, SYNC_ALL_DATA, GetAllTypes(), "", ENCRYPT_PASSWORDS); + NULL, SYNC_ALL_DATA, GetAllTypes(), std::string(), ENCRYPT_PASSWORDS); ListValue list_args; list_args.Append(new StringValue(args)); EXPECT_CALL(*mock_pss_, IsPassphraseRequiredForDecryption()) @@ -990,8 +1016,11 @@ TEST_P(SyncSetupHandlerTest, TestSyncIndividualTypes) { for (it = user_selectable_types.First(); it.Good(); it.Inc()) { syncer::ModelTypeSet type_to_set; type_to_set.Put(it.Get()); - std::string args = GetConfiguration( - NULL, CHOOSE_WHAT_TO_SYNC, type_to_set, "", ENCRYPT_PASSWORDS); + std::string args = GetConfiguration(NULL, + CHOOSE_WHAT_TO_SYNC, + type_to_set, + std::string(), + ENCRYPT_PASSWORDS); ListValue list_args; list_args.Append(new StringValue(args)); EXPECT_CALL(*mock_pss_, IsPassphraseRequiredForDecryption()) @@ -1010,8 +1039,11 @@ TEST_P(SyncSetupHandlerTest, TestSyncIndividualTypes) { } TEST_P(SyncSetupHandlerTest, TestSyncAllManually) { - std::string args = GetConfiguration( - NULL, CHOOSE_WHAT_TO_SYNC, GetAllTypes(), "", ENCRYPT_PASSWORDS); + std::string args = GetConfiguration(NULL, + CHOOSE_WHAT_TO_SYNC, + GetAllTypes(), + std::string(), + ENCRYPT_PASSWORDS); ListValue list_args; list_args.Append(new StringValue(args)); EXPECT_CALL(*mock_pss_, IsPassphraseRequiredForDecryption()) @@ -1074,12 +1106,12 @@ TEST_P(SyncSetupHandlerTest, ShowSyncSetupWithAuthError) { ASSERT_TRUE(data.arg2->GetAsDictionary(&dictionary)); // We should display a login screen with a non-editable username filled in. CheckShowSyncSetupArgs(dictionary, - "", + std::string(), false, GoogleServiceAuthError::NONE, kTestUser, false, - ""); + std::string()); } else { ASSERT_FALSE(handler_->is_configuring_sync()); ASSERT_TRUE(handler_->have_signin_tracker()); @@ -1244,9 +1276,9 @@ TEST_P(SyncSetupHandlerTest, SubmitAuthWithInvalidUsername) { DictionaryValue args; args.SetString("user", "user@not_allowed.com"); args.SetString("pass", "password"); - args.SetString("captcha", ""); - args.SetString("otp", ""); - args.SetString("accessCode", ""); + args.SetString("captcha", std::string()); + args.SetString("otp", std::string()); + args.SetString("accessCode", std::string()); std::string json; base::JSONWriter::Write(&args, &json); ListValue list_args; @@ -1267,8 +1299,13 @@ TEST_P(SyncSetupHandlerTest, SubmitAuthWithInvalidUsername) { DictionaryValue* dictionary; ASSERT_TRUE(data.arg2->GetAsDictionary(&dictionary)); std::string err = l10n_util::GetStringUTF8(IDS_SYNC_LOGIN_NAME_PROHIBITED); - CheckShowSyncSetupArgs( - dictionary, err, false, GoogleServiceAuthError::NONE, "", true, ""); + CheckShowSyncSetupArgs(dictionary, + err, + false, + GoogleServiceAuthError::NONE, + std::string(), + true, + std::string()); handler_->CloseSyncSetup(); EXPECT_EQ(NULL, LoginUIServiceFactory::GetForProfile( diff --git a/chrome/browser/ui/webui/version_ui.cc b/chrome/browser/ui/webui/version_ui.cc index 678492a..6497ae0 100644 --- a/chrome/browser/ui/webui/version_ui.cc +++ b/chrome/browser/ui/webui/version_ui.cc @@ -92,7 +92,7 @@ content::WebUIDataSource* CreateVersionUIDataSource(Profile* profile) { html_source->AddString("command_line", WideToUTF16(CommandLine::ForCurrentProcess()->GetCommandLineString())); #elif defined(OS_POSIX) - std::string command_line = ""; + std::string command_line; typedef std::vector<std::string> ArgvList; const ArgvList& argv = CommandLine::ForCurrentProcess()->argv(); for (ArgvList::const_iterator iter = argv.begin(); iter != argv.end(); iter++) diff --git a/chrome/browser/value_store/leveldb_value_store.cc b/chrome/browser/value_store/leveldb_value_store.cc index 47ad0c0..bad05dd 100644 --- a/chrome/browser/value_store/leveldb_value_store.cc +++ b/chrome/browser/value_store/leveldb_value_store.cc @@ -334,7 +334,7 @@ std::string LeveldbValueStore::EnsureDbIsOpen() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); if (db_.get()) - return ""; + return std::string(); #if defined(OS_POSIX) std::string os_path(db_path_.value()); @@ -356,7 +356,7 @@ std::string LeveldbValueStore::EnsureDbIsOpen() { } db_.reset(db); - return ""; + return std::string(); } std::string LeveldbValueStore::ReadFromDb( @@ -371,7 +371,7 @@ std::string LeveldbValueStore::ReadFromDb( if (s.IsNotFound()) { // Despite there being no value, it was still a success. // Check this first because ok() is false on IsNotFound. - return ""; + return std::string(); } if (!s.ok()) @@ -384,7 +384,7 @@ std::string LeveldbValueStore::ReadFromDb( } setting->reset(value); - return ""; + return std::string(); } std::string LeveldbValueStore::AddToBatch( @@ -410,16 +410,16 @@ std::string LeveldbValueStore::AddToBatch( batch->Put(key, value_as_json); } - return ""; + return std::string(); } std::string LeveldbValueStore::WriteToDb(leveldb::WriteBatch* batch) { leveldb::Status status = db_->Write(leveldb::WriteOptions(), batch); if (status.IsNotFound()) { NOTREACHED() << "IsNotFound() but writing?!"; - return ""; + return std::string(); } - return status.ok() ? "" : status.ToString(); + return status.ok() ? std::string() : status.ToString(); } bool LeveldbValueStore::IsEmpty() { diff --git a/chrome/browser/web_applications/web_app_unittest.cc b/chrome/browser/web_applications/web_app_unittest.cc index 0bd1c01..149f62b 100644 --- a/chrome/browser/web_applications/web_app_unittest.cc +++ b/chrome/browser/web_applications/web_app_unittest.cc @@ -71,9 +71,8 @@ TEST_F(WebApplicationTest, AppDirWithId) { TEST_F(WebApplicationTest, AppDirWithUrl) { base::FilePath profile_path(FILE_PATH_LITERAL("profile")); base::FilePath result(web_app::GetWebAppDataDirectory( - profile_path, "", GURL("http://example.com"))); + profile_path, std::string(), GURL("http://example.com"))); base::FilePath expected = profile_path.AppendASCII("Web Applications") - .AppendASCII("example.com") - .AppendASCII("http_80"); + .AppendASCII("example.com").AppendASCII("http_80"); EXPECT_EQ(expected, result); } diff --git a/chrome/browser/webdata/keyword_table.cc b/chrome/browser/webdata/keyword_table.cc index 956d60b..10d224e 100644 --- a/chrome/browser/webdata/keyword_table.cc +++ b/chrome/browser/webdata/keyword_table.cc @@ -388,7 +388,7 @@ bool KeywordTable::MigrateToVersion45RemoveLogoIDAndAutogenerateColumns() { // Migrate the keywords backup table as well. if (!MigrateKeywordsTableForVersion45("keywords_backup") || !meta_table_->SetValue("Default Search Provider ID Backup Signature", - "")) + std::string())) return false; return transaction.Commit(); @@ -409,7 +409,7 @@ bool KeywordTable::MigrateToVersion47AddAlternateURLsColumn() { if (!db_->Execute("ALTER TABLE keywords_backup ADD COLUMN " "alternate_urls VARCHAR DEFAULT ''") || !meta_table_->SetValue("Default Search Provider ID Backup Signature", - "")) + std::string())) return false; return transaction.Commit(); diff --git a/chrome/browser/webdata/token_service_table_unittest.cc b/chrome/browser/webdata/token_service_table_unittest.cc index db409f8..3c60ccf 100644 --- a/chrome/browser/webdata/token_service_table_unittest.cc +++ b/chrome/browser/webdata/token_service_table_unittest.cc @@ -89,7 +89,7 @@ TEST_F(TokenServiceTableTest, MAYBE_TokenServiceGetSet) { out_map.clear(); // try blanking it - won't remove it from the db though! - EXPECT_TRUE(table_->SetTokenForService(service, "")); + EXPECT_TRUE(table_->SetTokenForService(service, std::string())); EXPECT_TRUE(table_->GetAllTokens(&out_map)); EXPECT_EQ(out_map.find(service)->second, ""); out_map.clear(); diff --git a/chrome/common/child_process_logging_posix.cc b/chrome/common/child_process_logging_posix.cc index 1690cd5..496103e 100644 --- a/chrome/common/child_process_logging_posix.cc +++ b/chrome/common/child_process_logging_posix.cc @@ -66,7 +66,7 @@ void SetActiveURL(const GURL& url) { void SetClientId(const std::string& client_id) { std::string str(client_id); - ReplaceSubstringsAfterOffset(&str, 0, "-", ""); + ReplaceSubstringsAfterOffset(&str, 0, "-", std::string()); if (str.empty()) return; diff --git a/chrome/common/content_settings_helper.cc b/chrome/common/content_settings_helper.cc index 306cbe7..68e8d40 100644 --- a/chrome/common/content_settings_helper.cc +++ b/chrome/common/content_settings_helper.cc @@ -12,11 +12,14 @@ namespace content_settings_helper { std::string OriginToString(const GURL& origin) { - std::string port_component(origin.IntPort() != url_parse::PORT_UNSPECIFIED ? - ":" + origin.port() : ""); - std::string scheme_component(!origin.SchemeIs(chrome::kHttpScheme) ? - origin.scheme() + content::kStandardSchemeSeparator : ""); - return scheme_component + origin.host() + port_component; + std::string port_component(origin.IntPort() != url_parse::PORT_UNSPECIFIED + ? ":" + origin.port() + : std::string()); + std::string scheme_component(!origin.SchemeIs(chrome::kHttpScheme) + ? origin.scheme() + + content::kStandardSchemeSeparator + : std::string()); + return scheme_component + origin.host() + port_component; } string16 OriginToString16(const GURL& origin) { diff --git a/chrome/common/content_settings_pattern.cc b/chrome/common/content_settings_pattern.cc index 9153de6..ee02312 100644 --- a/chrome/common/content_settings_pattern.cc +++ b/chrome/common/content_settings_pattern.cc @@ -26,7 +26,7 @@ std::string GetDefaultPort(const std::string& scheme) { return "80"; if (scheme == chrome::kHttpsScheme) return "443"; - return ""; + return std::string(); } // Returns true if |sub_domain| is a sub domain or equls |domain|. E.g. @@ -501,7 +501,7 @@ const std::string ContentSettingsPattern::ToString() const { if (IsValid()) return content_settings::PatternParser::ToString(parts_); else - return ""; + return std::string(); } ContentSettingsPattern::Relation ContentSettingsPattern::Compare( diff --git a/chrome/common/content_settings_pattern_parser.cc b/chrome/common/content_settings_pattern_parser.cc index 2f823cc..73da479 100644 --- a/chrome/common/content_settings_pattern_parser.cc +++ b/chrome/common/content_settings_pattern_parser.cc @@ -198,7 +198,7 @@ std::string PatternParser::ToString( parts.is_port_wildcard) return "*"; - std::string str = ""; + std::string str; if (!parts.is_scheme_wildcard) str += parts.scheme + content::kStandardSchemeSeparator; diff --git a/chrome/common/content_settings_pattern_unittest.cc b/chrome/common/content_settings_pattern_unittest.cc index 921f97b..c1c1e37 100644 --- a/chrome/common/content_settings_pattern_unittest.cc +++ b/chrome/common/content_settings_pattern_unittest.cc @@ -420,8 +420,8 @@ TEST(ContentSettingsPatternTest, InvalidPatterns) { EXPECT_STREQ("", ContentSettingsPattern().ToString().c_str()); // Empty pattern string - EXPECT_FALSE(Pattern("").IsValid()); - EXPECT_STREQ("", Pattern("").ToString().c_str()); + EXPECT_FALSE(Pattern(std::string()).IsValid()); + EXPECT_STREQ("", Pattern(std::string()).ToString().c_str()); // Pattern strings with invalid scheme part. EXPECT_FALSE(Pattern("ftp://myhost.org").IsValid()); @@ -630,8 +630,7 @@ TEST(ContentSettingsPatternTest, PatternSupport_Legacy) { EXPECT_TRUE( Pattern("file:///tmp/test.html").Matches( GURL("file:///tmp/test.html"))); - EXPECT_FALSE(Pattern("").Matches( - GURL("http://www.example.com/"))); + EXPECT_FALSE(Pattern(std::string()).Matches(GURL("http://www.example.com/"))); EXPECT_FALSE(Pattern("[*.]example.com").Matches( GURL("http://example.org/"))); EXPECT_FALSE(Pattern("example.com").Matches( diff --git a/chrome/common/extensions/api/commands/commands_handler.cc b/chrome/common/extensions/api/commands/commands_handler.cc index 309a204..b5ed3c4 100644 --- a/chrome/common/extensions/api/commands/commands_handler.cc +++ b/chrome/common/extensions/api/commands/commands_handler.cc @@ -137,8 +137,10 @@ void CommandsHandler::MaybeSetBrowserActionDefault(const Extension* extension, CommandsInfo* info) { if (extension->manifest()->HasKey(keys::kBrowserAction) && !info->browser_action_command.get()) { - info->browser_action_command.reset(new Command( - extension_manifest_values::kBrowserActionCommandEvent, string16(), "")); + info->browser_action_command.reset( + new Command(extension_manifest_values::kBrowserActionCommandEvent, + string16(), + std::string())); } } diff --git a/chrome/common/extensions/api/extension_action/browser_action_manifest_unittest.cc b/chrome/common/extensions/api/extension_action/browser_action_manifest_unittest.cc index 84277176..ac5040c 100644 --- a/chrome/common/extensions/api/extension_action/browser_action_manifest_unittest.cc +++ b/chrome/common/extensions/api/extension_action/browser_action_manifest_unittest.cc @@ -100,15 +100,13 @@ TEST_F(BrowserActionManifestTest, TEST_F(BrowserActionManifestTest, BrowserActionManifestIcons_InvalidDefaultIcon) { scoped_ptr<DictionaryValue> manifest_value = DictionaryBuilder() - .Set("name", "Invalid default icon") - .Set("version", "1.0.0") + .Set("name", "Invalid default icon").Set("version", "1.0.0") .Set("manifest_version", 2) - .Set("browser_action", DictionaryBuilder() - .Set("default_icon", DictionaryBuilder() - .Set("19", "") // Invalid value. - .Set("24", "icon24.png") - .Set("38", "icon38.png"))) - .Build(); + .Set("browser_action", + DictionaryBuilder().Set( + "default_icon", + DictionaryBuilder().Set("19", std::string()) // Invalid value. + .Set("24", "icon24.png").Set("38", "icon38.png"))).Build(); string16 error = ErrorUtils::FormatErrorMessageUTF16( errors::kInvalidIconPath, "19"); diff --git a/chrome/common/extensions/api/extension_api.cc b/chrome/common/extensions/api/extension_api.cc index b1095a4..97a2fdd 100644 --- a/chrome/common/extensions/api/extension_api.cc +++ b/chrome/common/extensions/api/extension_api.cc @@ -426,10 +426,11 @@ Feature::Availability ExtensionAPI::IsAvailable(const std::string& full_name, // Check APIs not using the feature system first. if (!feature) { - return IsNonFeatureAPIAvailable(api_name, context, extension, url) ? - Feature::CreateAvailability(Feature::IS_AVAILABLE, "") : - Feature::CreateAvailability(Feature::INVALID_CONTEXT, - kUnavailableMessage); + return IsNonFeatureAPIAvailable(api_name, context, extension, url) + ? Feature::CreateAvailability(Feature::IS_AVAILABLE, + std::string()) + : Feature::CreateAvailability(Feature::INVALID_CONTEXT, + kUnavailableMessage); } Feature::Availability availability = @@ -445,7 +446,7 @@ Feature::Availability ExtensionAPI::IsAvailable(const std::string& full_name, return dependency_availability; } - return Feature::CreateAvailability(Feature::IS_AVAILABLE, ""); + return Feature::CreateAvailability(Feature::IS_AVAILABLE, std::string()); } bool ExtensionAPI::IsPrivileged(const std::string& full_name) { @@ -634,7 +635,7 @@ std::string ExtensionAPI::GetAPINameFromFullName(const std::string& full_name, } *child_name = ""; - return ""; + return std::string(); } bool ExtensionAPI::IsAPIAllowed(const std::string& name, diff --git a/chrome/common/extensions/api/extension_api_unittest.cc b/chrome/common/extensions/api/extension_api_unittest.cc index 98830ea..f980b57 100644 --- a/chrome/common/extensions/api/extension_api_unittest.cc +++ b/chrome/common/extensions/api/extension_api_unittest.cc @@ -97,7 +97,7 @@ TEST_F(ExtensionAPITest, IsPrivileged) { EXPECT_TRUE(extension_api->IsPrivileged("runtime.lastError")); // Default unknown names to privileged for paranoia's sake. - EXPECT_TRUE(extension_api->IsPrivileged("")); + EXPECT_TRUE(extension_api->IsPrivileged(std::string())); EXPECT_TRUE(extension_api->IsPrivileged("<unknown-namespace>")); EXPECT_TRUE(extension_api->IsPrivileged("extension.<unknown-member>")); @@ -224,8 +224,8 @@ TEST(ExtensionAPI, APIFeatures) { TEST_F(ExtensionAPITest, LazyGetSchema) { scoped_ptr<ExtensionAPI> apis(ExtensionAPI::CreateWithDefaultConfiguration()); - EXPECT_EQ(NULL, apis->GetSchema("")); - EXPECT_EQ(NULL, apis->GetSchema("")); + EXPECT_EQ(NULL, apis->GetSchema(std::string())); + EXPECT_EQ(NULL, apis->GetSchema(std::string())); EXPECT_EQ(NULL, apis->GetSchema("experimental")); EXPECT_EQ(NULL, apis->GetSchema("experimental")); EXPECT_EQ(NULL, apis->GetSchema("foo")); diff --git a/chrome/common/extensions/csp_validator_unittest.cc b/chrome/common/extensions/csp_validator_unittest.cc index e96c42d..13cbfe8 100644 --- a/chrome/common/extensions/csp_validator_unittest.cc +++ b/chrome/common/extensions/csp_validator_unittest.cc @@ -23,10 +23,10 @@ TEST(ExtensionCSPValidator, IsLegal) { } TEST(ExtensionCSPValidator, IsSecure) { - EXPECT_FALSE(ContentSecurityPolicyIsSecure( - "", Manifest::TYPE_EXTENSION)); - EXPECT_FALSE(ContentSecurityPolicyIsSecure( - "img-src https://google.com", Manifest::TYPE_EXTENSION)); + EXPECT_FALSE( + ContentSecurityPolicyIsSecure(std::string(), Manifest::TYPE_EXTENSION)); + EXPECT_FALSE(ContentSecurityPolicyIsSecure("img-src https://google.com", + Manifest::TYPE_EXTENSION)); EXPECT_FALSE(ContentSecurityPolicyIsSecure( "default-src *", Manifest::TYPE_EXTENSION)); @@ -146,9 +146,10 @@ TEST(ExtensionCSPValidator, IsSecure) { } TEST(ExtensionCSPValidator, IsSandboxed) { - EXPECT_FALSE(ContentSecurityPolicyIsSandboxed("", Manifest::TYPE_EXTENSION)); - EXPECT_FALSE(ContentSecurityPolicyIsSandboxed( - "img-src https://google.com", Manifest::TYPE_EXTENSION)); + EXPECT_FALSE(ContentSecurityPolicyIsSandboxed(std::string(), + Manifest::TYPE_EXTENSION)); + EXPECT_FALSE(ContentSecurityPolicyIsSandboxed("img-src https://google.com", + Manifest::TYPE_EXTENSION)); // Sandbox directive is required. EXPECT_TRUE(ContentSecurityPolicyIsSandboxed( diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc index a941208..42407b8 100644 --- a/chrome/common/extensions/extension.cc +++ b/chrome/common/extensions/extension.cc @@ -437,8 +437,8 @@ bool Extension::ParsePermissions(const char* key, if (manifest_->HasKey(key)) { const ListValue* permissions = NULL; if (!manifest_->GetList(key, &permissions)) { - *error = ErrorUtils::FormatErrorMessageUTF16( - errors::kInvalidPermissions, ""); + *error = ErrorUtils::FormatErrorMessageUTF16(errors::kInvalidPermissions, + std::string()); return false; } diff --git a/chrome/common/extensions/extension_file_util_unittest.cc b/chrome/common/extensions/extension_file_util_unittest.cc index cb9260f..3f34f6e 100644 --- a/chrome/common/extensions/extension_file_util_unittest.cc +++ b/chrome/common/extensions/extension_file_util_unittest.cc @@ -304,7 +304,7 @@ TEST_F(ExtensionFileUtilTest, ExtensionResourceURLToFilePath) { // Setup filesystem for testing. base::FilePath root_path; ASSERT_TRUE(file_util::CreateNewTempDirectory( - FILE_PATH_LITERAL(""), &root_path)); + FILE_PATH_LITERAL(std::string()), &root_path)); ASSERT_TRUE(file_util::AbsolutePath(&root_path)); base::FilePath api_path = root_path.Append(FILE_PATH_LITERAL("apiname")); diff --git a/chrome/common/extensions/extension_icon_set_unittest.cc b/chrome/common/extensions/extension_icon_set_unittest.cc index 1202cda..c7300a7 100644 --- a/chrome/common/extensions/extension_icon_set_unittest.cc +++ b/chrome/common/extensions/extension_icon_set_unittest.cc @@ -62,7 +62,7 @@ TEST(ExtensionIconSet, Values) { EXPECT_TRUE(icons.ContainsPath("foo")); EXPECT_TRUE(icons.ContainsPath("bar")); EXPECT_FALSE(icons.ContainsPath("baz")); - EXPECT_FALSE(icons.ContainsPath("")); + EXPECT_FALSE(icons.ContainsPath(std::string())); icons.Clear(); EXPECT_FALSE(icons.ContainsPath("foo")); @@ -83,7 +83,7 @@ TEST(ExtensionIconSet, FindSize) { EXPECT_EQ(extension_misc::EXTENSION_ICON_INVALID, icons.GetIconSizeFromPath("baz")); EXPECT_EQ(extension_misc::EXTENSION_ICON_INVALID, - icons.GetIconSizeFromPath("")); + icons.GetIconSizeFromPath(std::string())); icons.Clear(); EXPECT_EQ(extension_misc::EXTENSION_ICON_INVALID, diff --git a/chrome/common/extensions/extension_l10n_util.cc b/chrome/common/extensions/extension_l10n_util.cc index b86ab49..d2dada0 100644 --- a/chrome/common/extensions/extension_l10n_util.cc +++ b/chrome/common/extensions/extension_l10n_util.cc @@ -44,7 +44,7 @@ std::string GetDefaultLocaleFromManifest(const DictionaryValue& manifest, return default_locale; *error = errors::kInvalidDefaultLocale; - return ""; + return std::string(); } diff --git a/chrome/common/extensions/extension_localization_peer_unittest.cc b/chrome/common/extensions/extension_localization_peer_unittest.cc index 92085ed..df74791 100644 --- a/chrome/common/extensions/extension_localization_peer_unittest.cc +++ b/chrome/common/extensions/extension_localization_peer_unittest.cc @@ -144,8 +144,8 @@ TEST_F(ExtensionLocalizationPeerTest, OnCompletedRequestBadURLRequestStatus) { EXPECT_CALL(*original_peer_, OnCompletedRequest( net::ERR_ABORTED, false, "", base::TimeTicks())); - filter_peer->OnCompletedRequest(net::ERR_FAILED, false, "", - base::TimeTicks()); + filter_peer->OnCompletedRequest( + net::ERR_FAILED, false, std::string(), base::TimeTicks()); } TEST_F(ExtensionLocalizationPeerTest, OnCompletedRequestEmptyData) { @@ -159,7 +159,8 @@ TEST_F(ExtensionLocalizationPeerTest, OnCompletedRequestEmptyData) { EXPECT_CALL(*original_peer_, OnCompletedRequest( net::OK, false, "", base::TimeTicks())); - filter_peer->OnCompletedRequest(net::OK, false, "", base::TimeTicks()); + filter_peer->OnCompletedRequest( + net::OK, false, std::string(), base::TimeTicks()); } TEST_F(ExtensionLocalizationPeerTest, OnCompletedRequestNoCatalogs) { @@ -178,14 +179,16 @@ TEST_F(ExtensionLocalizationPeerTest, OnCompletedRequestNoCatalogs) { EXPECT_CALL(*original_peer_, OnCompletedRequest( net::OK, false, "", base::TimeTicks())).Times(2); - filter_peer->OnCompletedRequest(net::OK, false, "", base::TimeTicks()); + filter_peer->OnCompletedRequest( + net::OK, false, std::string(), base::TimeTicks()); // Test if Send gets called again (it shouldn't be) when first call returned // an empty dictionary. filter_peer = CreateExtensionLocalizationPeer("text/css", GURL(kExtensionUrl_1)); SetData(filter_peer, "some text"); - filter_peer->OnCompletedRequest(net::OK, false, "", base::TimeTicks()); + filter_peer->OnCompletedRequest( + net::OK, false, std::string(), base::TimeTicks()); } TEST_F(ExtensionLocalizationPeerTest, OnCompletedRequestWithCatalogs) { @@ -213,7 +216,8 @@ TEST_F(ExtensionLocalizationPeerTest, OnCompletedRequestWithCatalogs) { EXPECT_CALL(*original_peer_, OnCompletedRequest( net::OK, false, "", base::TimeTicks())); - filter_peer->OnCompletedRequest(net::OK, false, "", base::TimeTicks()); + filter_peer->OnCompletedRequest( + net::OK, false, std::string(), base::TimeTicks()); } TEST_F(ExtensionLocalizationPeerTest, OnCompletedRequestReplaceMessagesFails) { @@ -241,5 +245,6 @@ TEST_F(ExtensionLocalizationPeerTest, OnCompletedRequestReplaceMessagesFails) { EXPECT_CALL(*original_peer_, OnCompletedRequest( net::OK, false, "", base::TimeTicks())); - filter_peer->OnCompletedRequest(net::OK, false, "", base::TimeTicks()); + filter_peer->OnCompletedRequest( + net::OK, false, std::string(), base::TimeTicks()); } diff --git a/chrome/common/extensions/extension_set.cc b/chrome/common/extensions/extension_set.cc index 84872b8..8b68fb6 100644 --- a/chrome/common/extensions/extension_set.cc +++ b/chrome/common/extensions/extension_set.cc @@ -77,11 +77,11 @@ std::string ExtensionSet::GetExtensionOrAppIDByURL( DCHECK(!info.origin().isNull()); if (info.url().SchemeIs(extensions::kExtensionScheme)) - return info.origin().isUnique() ? "" : info.url().host(); + return info.origin().isUnique() ? std::string() : info.url().host(); const Extension* extension = GetExtensionOrAppByURL(info); if (!extension) - return ""; + return std::string(); return extension->id(); } diff --git a/chrome/common/extensions/extension_set_unittest.cc b/chrome/common/extensions/extension_set_unittest.cc index 1703966..c27b0a9 100644 --- a/chrome/common/extensions/extension_set_unittest.cc +++ b/chrome/common/extensions/extension_set_unittest.cc @@ -59,7 +59,8 @@ TEST(ExtensionSetTest, ExtensionSet) { scoped_refptr<Extension> ext3(CreateTestExtension( "b", "http://dev.chromium.org/", "http://dev.chromium.org/")); - scoped_refptr<Extension> ext4(CreateTestExtension("c", "", "")); + scoped_refptr<Extension> ext4( + CreateTestExtension("c", std::string(), std::string())); ASSERT_TRUE(ext1 && ext2 && ext3 && ext4); @@ -118,8 +119,10 @@ TEST(ExtensionSetTest, ExtensionSet) { EXPECT_FALSE(extensions.GetByID(ext2->id())); // Make a union of a set with 3 more extensions (only 2 are new). - scoped_refptr<Extension> ext5(CreateTestExtension("d", "", "")); - scoped_refptr<Extension> ext6(CreateTestExtension("e", "", "")); + scoped_refptr<Extension> ext5( + CreateTestExtension("d", std::string(), std::string())); + scoped_refptr<Extension> ext6( + CreateTestExtension("e", std::string(), std::string())); ASSERT_TRUE(ext5 && ext6); scoped_ptr<ExtensionSet> to_add(new ExtensionSet()); diff --git a/chrome/common/extensions/extension_sync_type_unittest.cc b/chrome/common/extensions/extension_sync_type_unittest.cc index 3256c8d..b25e197 100644 --- a/chrome/common/extensions/extension_sync_type_unittest.cc +++ b/chrome/common/extensions/extension_sync_type_unittest.cc @@ -56,7 +56,7 @@ class ExtensionSyncTypeTest : public ExtensionTest { ListValue* plugins = new ListValue(); for (int i = 0; i < num_plugins; ++i) { DictionaryValue* plugin = new DictionaryValue(); - plugin->SetString(keys::kPluginsPath, ""); + plugin->SetString(keys::kPluginsPath, std::string()); plugins->Set(i, plugin); } source.Set(keys::kPlugins, plugins); @@ -158,7 +158,7 @@ TEST_F(ExtensionSyncTypeTest, DisplayInXManifestProperties) { manifest.SetString(keys::kName, "TestComponentApp"); manifest.SetString(keys::kVersion, "0.0.0.0"); manifest.SetString(keys::kApp, "true"); - manifest.SetString(keys::kPlatformAppBackgroundPage, ""); + manifest.SetString(keys::kPlatformAppBackgroundPage, std::string()); std::string error; scoped_refptr<Extension> app; diff --git a/chrome/common/extensions/extension_unittest.cc b/chrome/common/extensions/extension_unittest.cc index 6a3c80d..edf24c4 100644 --- a/chrome/common/extensions/extension_unittest.cc +++ b/chrome/common/extensions/extension_unittest.cc @@ -233,16 +233,22 @@ TEST_F(ExtensionTest, MimeTypeSniffing) { ASSERT_TRUE(file_util::ReadFileToString(path, &data)); std::string result; - EXPECT_TRUE(net::SniffMimeType(data.c_str(), data.size(), - GURL("http://www.example.com/foo.crx"), "", &result)); + EXPECT_TRUE(net::SniffMimeType(data.c_str(), + data.size(), + GURL("http://www.example.com/foo.crx"), + std::string(), + &result)); EXPECT_EQ(std::string(Extension::kMimeType), result); data.clear(); result.clear(); path = path.DirName().AppendASCII("bad_magic.crx"); ASSERT_TRUE(file_util::ReadFileToString(path, &data)); - EXPECT_TRUE(net::SniffMimeType(data.c_str(), data.size(), - GURL("http://www.example.com/foo.crx"), "", &result)); + EXPECT_TRUE(net::SniffMimeType(data.c_str(), + data.size(), + GURL("http://www.example.com/foo.crx"), + std::string(), + &result)); EXPECT_EQ("application/octet-stream", result); } diff --git a/chrome/common/extensions/features/api_feature.cc b/chrome/common/extensions/features/api_feature.cc index 0020632..f6d826e 100644 --- a/chrome/common/extensions/features/api_feature.cc +++ b/chrome/common/extensions/features/api_feature.cc @@ -26,7 +26,7 @@ std::string APIFeature::Parse(const DictionaryValue* value) { if (GetContexts()->empty()) return name() + ": API features must specify at least one context."; - return ""; + return std::string(); } } // namespace diff --git a/chrome/common/extensions/features/complex_feature.cc b/chrome/common/extensions/features/complex_feature.cc index f6f1c11..a4515d0e4 100644 --- a/chrome/common/extensions/features/complex_feature.cc +++ b/chrome/common/extensions/features/complex_feature.cc @@ -76,7 +76,7 @@ std::string ComplexFeature::GetAvailabilityMessage(AvailabilityResult result, Manifest::Type type, const GURL& url) const { if (result == IS_AVAILABLE) - return ""; + return std::string(); // TODO(justinlin): Form some kind of combined availabilities/messages from // SimpleFeatures. diff --git a/chrome/common/extensions/features/manifest_feature.cc b/chrome/common/extensions/features/manifest_feature.cc index cd4a53f..5196b52 100644 --- a/chrome/common/extensions/features/manifest_feature.cc +++ b/chrome/common/extensions/features/manifest_feature.cc @@ -47,7 +47,7 @@ std::string ManifestFeature::Parse(const DictionaryValue* value) { if (!GetContexts()->empty()) return name() + ": Manifest features do not support contexts."; - return ""; + return std::string(); } } // namespace diff --git a/chrome/common/extensions/features/permission_feature.cc b/chrome/common/extensions/features/permission_feature.cc index 72b261f..4681aa2 100644 --- a/chrome/common/extensions/features/permission_feature.cc +++ b/chrome/common/extensions/features/permission_feature.cc @@ -49,7 +49,7 @@ std::string PermissionFeature::Parse(const DictionaryValue* value) { if (!GetContexts()->empty()) return name() + ": Permission features do not support contexts."; - return ""; + return std::string(); } } // namespace diff --git a/chrome/common/extensions/features/simple_feature.cc b/chrome/common/extensions/features/simple_feature.cc index 13c8573..4b08c60 100644 --- a/chrome/common/extensions/features/simple_feature.cc +++ b/chrome/common/extensions/features/simple_feature.cc @@ -168,7 +168,7 @@ std::string GetDisplayTypeName(Manifest::Type type) { } NOTREACHED(); - return ""; + return std::string(); } } // namespace @@ -229,7 +229,7 @@ std::string SimpleFeature::Parse(const DictionaryValue* value) { return name() + ": Allowing web_page contexts requires supplying a value " + "for matches."; } - return ""; + return std::string(); } Feature::Availability SimpleFeature::IsAvailableToManifest( @@ -313,7 +313,7 @@ std::string SimpleFeature::GetAvailabilityMessage( AvailabilityResult result, Manifest::Type type, const GURL& url) const { switch (result) { case IS_AVAILABLE: - return ""; + return std::string(); case NOT_FOUND_IN_WHITELIST: return base::StringPrintf( "'%s' is not allowed for specified extension ID.", @@ -381,7 +381,7 @@ std::string SimpleFeature::GetAvailabilityMessage( } NOTREACHED(); - return ""; + return std::string(); } Feature::Availability SimpleFeature::CreateAvailability( diff --git a/chrome/common/extensions/features/simple_feature_unittest.cc b/chrome/common/extensions/features/simple_feature_unittest.cc index 443b152..4f92a34 100644 --- a/chrome/common/extensions/features/simple_feature_unittest.cc +++ b/chrome/common/extensions/features/simple_feature_unittest.cc @@ -91,9 +91,13 @@ TEST_F(ExtensionSimpleFeatureTest, Whitelist) { EXPECT_EQ(Feature::NOT_FOUND_IN_WHITELIST, feature.IsAvailableToManifest( kIdBaz, Manifest::TYPE_UNKNOWN, Feature::UNSPECIFIED_LOCATION, -1, Feature::UNSPECIFIED_PLATFORM).result()); - EXPECT_EQ(Feature::NOT_FOUND_IN_WHITELIST, feature.IsAvailableToManifest( - "", Manifest::TYPE_UNKNOWN, Feature::UNSPECIFIED_LOCATION, -1, - Feature::UNSPECIFIED_PLATFORM).result()); + EXPECT_EQ( + Feature::NOT_FOUND_IN_WHITELIST, + feature.IsAvailableToManifest(std::string(), + Manifest::TYPE_UNKNOWN, + Feature::UNSPECIFIED_LOCATION, + -1, + Feature::UNSPECIFIED_PLATFORM).result()); feature.extension_types()->insert(Manifest::TYPE_LEGACY_PACKAGED_APP); EXPECT_EQ(Feature::NOT_FOUND_IN_WHITELIST, feature.IsAvailableToManifest( @@ -133,19 +137,35 @@ TEST_F(ExtensionSimpleFeatureTest, PackageType) { feature.extension_types()->insert(Manifest::TYPE_EXTENSION); feature.extension_types()->insert(Manifest::TYPE_LEGACY_PACKAGED_APP); - EXPECT_EQ(Feature::IS_AVAILABLE, feature.IsAvailableToManifest( - "", Manifest::TYPE_EXTENSION, Feature::UNSPECIFIED_LOCATION, -1, - Feature::UNSPECIFIED_PLATFORM).result()); - EXPECT_EQ(Feature::IS_AVAILABLE, feature.IsAvailableToManifest( - "", Manifest::TYPE_LEGACY_PACKAGED_APP, Feature::UNSPECIFIED_LOCATION, - -1, Feature::UNSPECIFIED_PLATFORM).result()); - - EXPECT_EQ(Feature::INVALID_TYPE, feature.IsAvailableToManifest( - "", Manifest::TYPE_UNKNOWN, Feature::UNSPECIFIED_LOCATION, -1, - Feature::UNSPECIFIED_PLATFORM).result()); - EXPECT_EQ(Feature::INVALID_TYPE, feature.IsAvailableToManifest( - "", Manifest::TYPE_THEME, Feature::UNSPECIFIED_LOCATION, -1, - Feature::UNSPECIFIED_PLATFORM).result()); + EXPECT_EQ( + Feature::IS_AVAILABLE, + feature.IsAvailableToManifest(std::string(), + Manifest::TYPE_EXTENSION, + Feature::UNSPECIFIED_LOCATION, + -1, + Feature::UNSPECIFIED_PLATFORM).result()); + EXPECT_EQ( + Feature::IS_AVAILABLE, + feature.IsAvailableToManifest(std::string(), + Manifest::TYPE_LEGACY_PACKAGED_APP, + Feature::UNSPECIFIED_LOCATION, + -1, + Feature::UNSPECIFIED_PLATFORM).result()); + + EXPECT_EQ( + Feature::INVALID_TYPE, + feature.IsAvailableToManifest(std::string(), + Manifest::TYPE_UNKNOWN, + Feature::UNSPECIFIED_LOCATION, + -1, + Feature::UNSPECIFIED_PLATFORM).result()); + EXPECT_EQ( + Feature::INVALID_TYPE, + feature.IsAvailableToManifest(std::string(), + Manifest::TYPE_THEME, + Feature::UNSPECIFIED_LOCATION, + -1, + Feature::UNSPECIFIED_PLATFORM).result()); } TEST_F(ExtensionSimpleFeatureTest, Context) { @@ -220,64 +240,107 @@ TEST_F(ExtensionSimpleFeatureTest, Location) { // If the feature specifies "component" as its location, then only component // extensions can access it. feature.set_location(Feature::COMPONENT_LOCATION); - EXPECT_EQ(Feature::IS_AVAILABLE, feature.IsAvailableToManifest( - "", Manifest::TYPE_UNKNOWN, Feature::COMPONENT_LOCATION, -1, - Feature::UNSPECIFIED_PLATFORM).result()); - EXPECT_EQ(Feature::INVALID_LOCATION, feature.IsAvailableToManifest( - "", Manifest::TYPE_UNKNOWN, Feature::UNSPECIFIED_LOCATION, -1, - Feature::UNSPECIFIED_PLATFORM).result()); + EXPECT_EQ( + Feature::IS_AVAILABLE, + feature.IsAvailableToManifest(std::string(), + Manifest::TYPE_UNKNOWN, + Feature::COMPONENT_LOCATION, + -1, + Feature::UNSPECIFIED_PLATFORM).result()); + EXPECT_EQ( + Feature::INVALID_LOCATION, + feature.IsAvailableToManifest(std::string(), + Manifest::TYPE_UNKNOWN, + Feature::UNSPECIFIED_LOCATION, + -1, + Feature::UNSPECIFIED_PLATFORM).result()); // But component extensions can access anything else, whatever their location. feature.set_location(Feature::UNSPECIFIED_LOCATION); - EXPECT_EQ(Feature::IS_AVAILABLE, feature.IsAvailableToManifest( - "", Manifest::TYPE_UNKNOWN, Feature::COMPONENT_LOCATION, -1, - Feature::UNSPECIFIED_PLATFORM).result()); + EXPECT_EQ( + Feature::IS_AVAILABLE, + feature.IsAvailableToManifest(std::string(), + Manifest::TYPE_UNKNOWN, + Feature::COMPONENT_LOCATION, + -1, + Feature::UNSPECIFIED_PLATFORM).result()); } TEST_F(ExtensionSimpleFeatureTest, Platform) { SimpleFeature feature; feature.set_platform(Feature::CHROMEOS_PLATFORM); - EXPECT_EQ(Feature::IS_AVAILABLE, feature.IsAvailableToManifest( - "", Manifest::TYPE_UNKNOWN, Feature::UNSPECIFIED_LOCATION, -1, - Feature::CHROMEOS_PLATFORM).result()); - EXPECT_EQ(Feature::INVALID_PLATFORM, feature.IsAvailableToManifest( - "", Manifest::TYPE_UNKNOWN, Feature::UNSPECIFIED_LOCATION, -1, - Feature::UNSPECIFIED_PLATFORM).result()); + EXPECT_EQ(Feature::IS_AVAILABLE, + feature.IsAvailableToManifest(std::string(), + Manifest::TYPE_UNKNOWN, + Feature::UNSPECIFIED_LOCATION, + -1, + Feature::CHROMEOS_PLATFORM).result()); + EXPECT_EQ( + Feature::INVALID_PLATFORM, + feature.IsAvailableToManifest(std::string(), + Manifest::TYPE_UNKNOWN, + Feature::UNSPECIFIED_LOCATION, + -1, + Feature::UNSPECIFIED_PLATFORM).result()); } TEST_F(ExtensionSimpleFeatureTest, Version) { SimpleFeature feature; feature.set_min_manifest_version(5); - EXPECT_EQ(Feature::INVALID_MIN_MANIFEST_VERSION, - feature.IsAvailableToManifest( - "", Manifest::TYPE_UNKNOWN, Feature::UNSPECIFIED_LOCATION, - 0, Feature::UNSPECIFIED_PLATFORM).result()); - EXPECT_EQ(Feature::INVALID_MIN_MANIFEST_VERSION, - feature.IsAvailableToManifest( - "", Manifest::TYPE_UNKNOWN, Feature::UNSPECIFIED_LOCATION, - 4, Feature::UNSPECIFIED_PLATFORM).result()); - - EXPECT_EQ(Feature::IS_AVAILABLE, feature.IsAvailableToManifest( - "", Manifest::TYPE_UNKNOWN, Feature::UNSPECIFIED_LOCATION, - 5, Feature::UNSPECIFIED_PLATFORM).result()); - EXPECT_EQ(Feature::IS_AVAILABLE, feature.IsAvailableToManifest( - "", Manifest::TYPE_UNKNOWN, Feature::UNSPECIFIED_LOCATION, - 10, Feature::UNSPECIFIED_PLATFORM).result()); + EXPECT_EQ( + Feature::INVALID_MIN_MANIFEST_VERSION, + feature.IsAvailableToManifest(std::string(), + Manifest::TYPE_UNKNOWN, + Feature::UNSPECIFIED_LOCATION, + 0, + Feature::UNSPECIFIED_PLATFORM).result()); + EXPECT_EQ( + Feature::INVALID_MIN_MANIFEST_VERSION, + feature.IsAvailableToManifest(std::string(), + Manifest::TYPE_UNKNOWN, + Feature::UNSPECIFIED_LOCATION, + 4, + Feature::UNSPECIFIED_PLATFORM).result()); + + EXPECT_EQ( + Feature::IS_AVAILABLE, + feature.IsAvailableToManifest(std::string(), + Manifest::TYPE_UNKNOWN, + Feature::UNSPECIFIED_LOCATION, + 5, + Feature::UNSPECIFIED_PLATFORM).result()); + EXPECT_EQ( + Feature::IS_AVAILABLE, + feature.IsAvailableToManifest(std::string(), + Manifest::TYPE_UNKNOWN, + Feature::UNSPECIFIED_LOCATION, + 10, + Feature::UNSPECIFIED_PLATFORM).result()); feature.set_max_manifest_version(8); - EXPECT_EQ(Feature::INVALID_MAX_MANIFEST_VERSION, - feature.IsAvailableToManifest( - "", Manifest::TYPE_UNKNOWN, Feature::UNSPECIFIED_LOCATION, - 10, Feature::UNSPECIFIED_PLATFORM).result()); - EXPECT_EQ(Feature::IS_AVAILABLE, - feature.IsAvailableToManifest( - "", Manifest::TYPE_UNKNOWN, Feature::UNSPECIFIED_LOCATION, - 8, Feature::UNSPECIFIED_PLATFORM).result()); - EXPECT_EQ(Feature::IS_AVAILABLE, feature.IsAvailableToManifest( - "", Manifest::TYPE_UNKNOWN, Feature::UNSPECIFIED_LOCATION, - 7, Feature::UNSPECIFIED_PLATFORM).result()); + EXPECT_EQ( + Feature::INVALID_MAX_MANIFEST_VERSION, + feature.IsAvailableToManifest(std::string(), + Manifest::TYPE_UNKNOWN, + Feature::UNSPECIFIED_LOCATION, + 10, + Feature::UNSPECIFIED_PLATFORM).result()); + EXPECT_EQ( + Feature::IS_AVAILABLE, + feature.IsAvailableToManifest(std::string(), + Manifest::TYPE_UNKNOWN, + Feature::UNSPECIFIED_LOCATION, + 8, + Feature::UNSPECIFIED_PLATFORM).result()); + EXPECT_EQ( + Feature::IS_AVAILABLE, + feature.IsAvailableToManifest(std::string(), + Manifest::TYPE_UNKNOWN, + Feature::UNSPECIFIED_LOCATION, + 7, + Feature::UNSPECIFIED_PLATFORM).result()); } TEST_F(ExtensionSimpleFeatureTest, ParseNull) { @@ -549,15 +612,15 @@ TEST_F(ExtensionSimpleFeatureTest, SupportedChannel) { // Default supported channel (trunk). EXPECT_EQ(Feature::IS_AVAILABLE, - IsAvailableInChannel("", VersionInfo::CHANNEL_UNKNOWN)); + IsAvailableInChannel(std::string(), VersionInfo::CHANNEL_UNKNOWN)); EXPECT_EQ(Feature::UNSUPPORTED_CHANNEL, - IsAvailableInChannel("", VersionInfo::CHANNEL_CANARY)); + IsAvailableInChannel(std::string(), VersionInfo::CHANNEL_CANARY)); EXPECT_EQ(Feature::UNSUPPORTED_CHANNEL, - IsAvailableInChannel("", VersionInfo::CHANNEL_DEV)); + IsAvailableInChannel(std::string(), VersionInfo::CHANNEL_DEV)); EXPECT_EQ(Feature::UNSUPPORTED_CHANNEL, - IsAvailableInChannel("", VersionInfo::CHANNEL_BETA)); + IsAvailableInChannel(std::string(), VersionInfo::CHANNEL_BETA)); EXPECT_EQ(Feature::UNSUPPORTED_CHANNEL, - IsAvailableInChannel("", VersionInfo::CHANNEL_STABLE)); + IsAvailableInChannel(std::string(), VersionInfo::CHANNEL_STABLE)); } } // namespace diff --git a/chrome/common/extensions/manifest_tests/extension_manifest_test.cc b/chrome/common/extensions/manifest_tests/extension_manifest_test.cc index b61d5f7..4e72588 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifest_test.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifest_test.cc @@ -217,20 +217,16 @@ ExtensionManifestTest::Testcase::Testcase(std::string manifest_filename, ExtensionManifestTest::Testcase::Testcase(std::string manifest_filename) : manifest_filename_(manifest_filename), - expected_error_(""), location_(extensions::Manifest::INTERNAL), - flags_(Extension::NO_FLAGS) { -} + flags_(Extension::NO_FLAGS) {} ExtensionManifestTest::Testcase::Testcase( std::string manifest_filename, extensions::Manifest::Location location, int flags) : manifest_filename_(manifest_filename), - expected_error_(""), location_(location), - flags_(flags) { -} + flags_(flags) {} void ExtensionManifestTest::RunTestcases(const Testcase* testcases, size_t num_testcases, diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_platformapp_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_platformapp_unittest.cc index 1fdab49..bb93903 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifests_platformapp_unittest.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifests_platformapp_unittest.cc @@ -98,7 +98,7 @@ TEST_F(PlatformAppsManifestTest, PlatformAppContentSecurityPolicy) { EXPECT_TRUE(extension->is_platform_app()); EXPECT_EQ( "default-src 'self' https://www.google.com", - CSPInfo::GetResourceContentSecurityPolicy(extension, "")); + CSPInfo::GetResourceContentSecurityPolicy(extension, std::string())); // But even whitelisted ones must specify a secure policy. LoadAndExpectError( diff --git a/chrome/common/extensions/manifest_url_handler.cc b/chrome/common/extensions/manifest_url_handler.cc index 2e18eb1..690cc03 100644 --- a/chrome/common/extensions/manifest_url_handler.cc +++ b/chrome/common/extensions/manifest_url_handler.cc @@ -125,8 +125,8 @@ bool HomepageURLHandler::Parse(Extension* extension, string16* error) { std::string homepage_url_str; if (!extension->manifest()->GetString(keys::kHomepageURL, &homepage_url_str)) { - *error = ErrorUtils::FormatErrorMessageUTF16( - errors::kInvalidHomepageURL, ""); + *error = ErrorUtils::FormatErrorMessageUTF16(errors::kInvalidHomepageURL, + std::string()); return false; } manifest_url->url_ = GURL(homepage_url_str); @@ -156,8 +156,8 @@ bool UpdateURLHandler::Parse(Extension* extension, string16* error) { std::string tmp_update_url; if (!extension->manifest()->GetString(keys::kUpdateURL, &tmp_update_url)) { - *error = ErrorUtils::FormatErrorMessageUTF16( - errors::kInvalidUpdateURL, ""); + *error = ErrorUtils::FormatErrorMessageUTF16(errors::kInvalidUpdateURL, + std::string()); return false; } diff --git a/chrome/common/extensions/message_bundle.cc b/chrome/common/extensions/message_bundle.cc index 708e2e4..bb7d547 100644 --- a/chrome/common/extensions/message_bundle.cc +++ b/chrome/common/extensions/message_bundle.cc @@ -303,7 +303,7 @@ std::string MessageBundle::GetL10nMessage(const std::string& name, return it->second; } - return ""; + return std::string(); } /////////////////////////////////////////////////////////////////////////////// diff --git a/chrome/common/extensions/permissions/bluetooth_device_permission_data.cc b/chrome/common/extensions/permissions/bluetooth_device_permission_data.cc index 3698ebf..82c5acd 100644 --- a/chrome/common/extensions/permissions/bluetooth_device_permission_data.cc +++ b/chrome/common/extensions/permissions/bluetooth_device_permission_data.cc @@ -18,9 +18,7 @@ const char* kDeviceAddressKey = "deviceAddress"; namespace extensions { -BluetoothDevicePermissionData::BluetoothDevicePermissionData() - : device_address_("") { -} +BluetoothDevicePermissionData::BluetoothDevicePermissionData() {} BluetoothDevicePermissionData::BluetoothDevicePermissionData( const std::string& device_address) : device_address_(device_address) { diff --git a/chrome/common/extensions/permissions/socket_permission_unittest.cc b/chrome/common/extensions/permissions/socket_permission_unittest.cc index 6bb07be..05e7d3d 100644 --- a/chrome/common/extensions/permissions/socket_permission_unittest.cc +++ b/chrome/common/extensions/permissions/socket_permission_unittest.cc @@ -48,7 +48,7 @@ TEST_F(SocketPermissionTest, General) { TEST_F(SocketPermissionTest, Parse) { SocketPermissionData data; - EXPECT_FALSE(data.ParseForTest("")); + EXPECT_FALSE(data.ParseForTest(std::string())); EXPECT_FALSE(data.ParseForTest("*")); EXPECT_FALSE(data.ParseForTest("\00\00*")); EXPECT_FALSE(data.ParseForTest("\01*")); diff --git a/chrome/common/extensions/update_manifest_unittest.cc b/chrome/common/extensions/update_manifest_unittest.cc index 9af11df..2a16b9c 100644 --- a/chrome/common/extensions/update_manifest_unittest.cc +++ b/chrome/common/extensions/update_manifest_unittest.cc @@ -120,7 +120,7 @@ TEST(ExtensionUpdateManifestTest, TestUpdateManifest) { UpdateManifest parser; // Test parsing of a number of invalid xml cases - EXPECT_FALSE(parser.Parse("")); + EXPECT_FALSE(parser.Parse(std::string())); EXPECT_FALSE(parser.errors().empty()); EXPECT_TRUE(parser.Parse(kMissingAppId)); diff --git a/chrome/common/json_schema/json_schema_validator.cc b/chrome/common/json_schema/json_schema_validator.cc index a303442..6e5e070 100644 --- a/chrome/common/json_schema/json_schema_validator.cc +++ b/chrome/common/json_schema/json_schema_validator.cc @@ -99,7 +99,7 @@ std::string JSONSchemaValidator::GetJSONSchemaType(const Value* value) { return schema::kArray; default: NOTREACHED() << "Unexpected value type: " << value->GetType(); - return ""; + return std::string(); } } @@ -147,7 +147,7 @@ JSONSchemaValidator::~JSONSchemaValidator() {} bool JSONSchemaValidator::Validate(const Value* instance) { errors_.clear(); - Validate(instance, schema_root_, ""); + Validate(instance, schema_root_, std::string()); return errors_.empty(); } diff --git a/chrome/common/json_schema/json_schema_validator_unittest_base.cc b/chrome/common/json_schema/json_schema_validator_unittest_base.cc index ecd9846..8ce82b7 100644 --- a/chrome/common/json_schema/json_schema_validator_unittest_base.cc +++ b/chrome/common/json_schema/json_schema_validator_unittest_base.cc @@ -130,7 +130,9 @@ void JSONSchemaValidatorTestBase::TestStringPattern() { schema.get(), NULL); ExpectNotValid(TEST_SOURCE, scoped_ptr<base::Value>(new base::StringValue("bar")).get(), - schema.get(), NULL, "", + schema.get(), + NULL, + std::string(), JSONSchemaValidator::FormatErrorMessage( JSONSchemaValidator::kStringPattern, "foo+")); } @@ -150,10 +152,16 @@ void JSONSchemaValidatorTestBase::TestEnum() { ExpectNotValid(TEST_SOURCE, scoped_ptr<base::Value>(new base::StringValue("42")).get(), - schema.get(), NULL, "", JSONSchemaValidator::kInvalidEnum); + schema.get(), + NULL, + std::string(), + JSONSchemaValidator::kInvalidEnum); ExpectNotValid(TEST_SOURCE, scoped_ptr<base::Value>(base::Value::CreateNullValue()).get(), - schema.get(), NULL, "", JSONSchemaValidator::kInvalidEnum); + schema.get(), + NULL, + std::string(), + JSONSchemaValidator::kInvalidEnum); } void JSONSchemaValidatorTestBase::TestChoices() { @@ -173,14 +181,24 @@ void JSONSchemaValidatorTestBase::TestChoices() { ExpectNotValid(TEST_SOURCE, scoped_ptr<base::Value>(new base::StringValue("foo")).get(), - schema.get(), NULL, "", JSONSchemaValidator::kInvalidChoice); + schema.get(), + NULL, + std::string(), + JSONSchemaValidator::kInvalidChoice); ExpectNotValid(TEST_SOURCE, scoped_ptr<base::Value>(new base::ListValue()).get(), - schema.get(), NULL, "", JSONSchemaValidator::kInvalidChoice); + schema.get(), + NULL, + std::string(), + JSONSchemaValidator::kInvalidChoice); instance->SetInteger("foo", 42); - ExpectNotValid(TEST_SOURCE, instance.get(), - schema.get(), NULL, "", JSONSchemaValidator::kInvalidChoice); + ExpectNotValid(TEST_SOURCE, + instance.get(), + schema.get(), + NULL, + std::string(), + JSONSchemaValidator::kInvalidChoice); } void JSONSchemaValidatorTestBase::TestExtends() { @@ -333,7 +351,11 @@ void JSONSchemaValidatorTestBase::TestArrayTuple() { ExpectValid(TEST_SOURCE, instance.get(), schema.get(), NULL); instance->Append(new base::StringValue("anything")); - ExpectNotValid(TEST_SOURCE, instance.get(), schema.get(), NULL, "", + ExpectNotValid(TEST_SOURCE, + instance.get(), + schema.get(), + NULL, + std::string(), JSONSchemaValidator::FormatErrorMessage( JSONSchemaValidator::kArrayMaxItems, "2")); @@ -403,13 +425,21 @@ void JSONSchemaValidatorTestBase::TestArrayNonTuple() { ExpectValid(TEST_SOURCE, instance.get(), schema.get(), NULL); instance->Append(new base::StringValue("x")); - ExpectNotValid(TEST_SOURCE, instance.get(), schema.get(), NULL, "", + ExpectNotValid(TEST_SOURCE, + instance.get(), + schema.get(), + NULL, + std::string(), JSONSchemaValidator::FormatErrorMessage( JSONSchemaValidator::kArrayMaxItems, "3")); instance->Remove(1, NULL); instance->Remove(1, NULL); instance->Remove(1, NULL); - ExpectNotValid(TEST_SOURCE, instance.get(), schema.get(), NULL, "", + ExpectNotValid(TEST_SOURCE, + instance.get(), + schema.get(), + NULL, + std::string(), JSONSchemaValidator::FormatErrorMessage( JSONSchemaValidator::kArrayMinItems, "2")); @@ -436,15 +466,20 @@ void JSONSchemaValidatorTestBase::TestString() { new base::StringValue("xxxxxxxxxx")).get(), schema.get(), NULL); - ExpectNotValid(TEST_SOURCE, - scoped_ptr<base::Value>(new base::StringValue("")).get(), - schema.get(), NULL, "", - JSONSchemaValidator::FormatErrorMessage( - JSONSchemaValidator::kStringMinLength, "1")); + ExpectNotValid( + TEST_SOURCE, + scoped_ptr<base::Value>(new base::StringValue(std::string())).get(), + schema.get(), + NULL, + std::string(), + JSONSchemaValidator::FormatErrorMessage( + JSONSchemaValidator::kStringMinLength, "1")); ExpectNotValid( TEST_SOURCE, scoped_ptr<base::Value>(new base::StringValue("xxxxxxxxxxx")).get(), - schema.get(), NULL, "", + schema.get(), + NULL, + std::string(), JSONSchemaValidator::FormatErrorMessage( JSONSchemaValidator::kStringMaxLength, "10")); } @@ -469,16 +504,19 @@ void JSONSchemaValidatorTestBase::TestNumber() { scoped_ptr<base::Value>(new base::FundamentalValue(88.88)).get(), schema.get(), NULL); - ExpectNotValid( - TEST_SOURCE, - scoped_ptr<base::Value>(new base::FundamentalValue(0.5)).get(), - schema.get(), NULL, "", - JSONSchemaValidator::FormatErrorMessage( - JSONSchemaValidator::kNumberMinimum, "1")); + ExpectNotValid(TEST_SOURCE, + scoped_ptr<base::Value>(new base::FundamentalValue(0.5)).get(), + schema.get(), + NULL, + std::string(), + JSONSchemaValidator::FormatErrorMessage( + JSONSchemaValidator::kNumberMinimum, "1")); ExpectNotValid( TEST_SOURCE, scoped_ptr<base::Value>(new base::FundamentalValue(100.1)).get(), - schema.get(), NULL, "", + schema.get(), + NULL, + std::string(), JSONSchemaValidator::FormatErrorMessage( JSONSchemaValidator::kNumberMaximum, "100")); } @@ -606,73 +644,83 @@ void JSONSchemaValidatorTestBase::TestTypes() { // not valid schema->SetString(schema::kType, schema::kObject); - ExpectNotValid(TEST_SOURCE, - scoped_ptr<base::Value>(new base::ListValue()).get(), - schema.get(), NULL, "", - JSONSchemaValidator::FormatErrorMessage( - JSONSchemaValidator::kInvalidType, - schema::kObject, - schema::kArray)); + ExpectNotValid( + TEST_SOURCE, + scoped_ptr<base::Value>(new base::ListValue()).get(), + schema.get(), + NULL, + std::string(), + JSONSchemaValidator::FormatErrorMessage( + JSONSchemaValidator::kInvalidType, schema::kObject, schema::kArray)); schema->SetString(schema::kType, schema::kObject); - ExpectNotValid(TEST_SOURCE, - scoped_ptr<base::Value>(base::Value::CreateNullValue()).get(), - schema.get(), NULL, "", - JSONSchemaValidator::FormatErrorMessage( - JSONSchemaValidator::kInvalidType, - schema::kObject, - schema::kNull)); + ExpectNotValid( + TEST_SOURCE, + scoped_ptr<base::Value>(base::Value::CreateNullValue()).get(), + schema.get(), + NULL, + std::string(), + JSONSchemaValidator::FormatErrorMessage( + JSONSchemaValidator::kInvalidType, schema::kObject, schema::kNull)); schema->SetString(schema::kType, schema::kArray); - ExpectNotValid(TEST_SOURCE, - scoped_ptr<base::Value>(new base::FundamentalValue(42)).get(), - schema.get(), NULL, "", - JSONSchemaValidator::FormatErrorMessage( - JSONSchemaValidator::kInvalidType, - schema::kArray, - schema::kInteger)); + ExpectNotValid( + TEST_SOURCE, + scoped_ptr<base::Value>(new base::FundamentalValue(42)).get(), + schema.get(), + NULL, + std::string(), + JSONSchemaValidator::FormatErrorMessage( + JSONSchemaValidator::kInvalidType, schema::kArray, schema::kInteger)); schema->SetString(schema::kType, schema::kString); - ExpectNotValid(TEST_SOURCE, - scoped_ptr<base::Value>(new base::FundamentalValue(42)).get(), - schema.get(), NULL, "", - JSONSchemaValidator::FormatErrorMessage( - JSONSchemaValidator::kInvalidType, - schema::kString, - schema::kInteger)); + ExpectNotValid( + TEST_SOURCE, + scoped_ptr<base::Value>(new base::FundamentalValue(42)).get(), + schema.get(), + NULL, + std::string(), + JSONSchemaValidator::FormatErrorMessage(JSONSchemaValidator::kInvalidType, + schema::kString, + schema::kInteger)); schema->SetString(schema::kType, schema::kNumber); - ExpectNotValid(TEST_SOURCE, - scoped_ptr<base::Value>(new base::StringValue("42")).get(), - schema.get(), NULL, "", - JSONSchemaValidator::FormatErrorMessage( - JSONSchemaValidator::kInvalidType, - schema::kNumber, - schema::kString)); + ExpectNotValid( + TEST_SOURCE, + scoped_ptr<base::Value>(new base::StringValue("42")).get(), + schema.get(), + NULL, + std::string(), + JSONSchemaValidator::FormatErrorMessage( + JSONSchemaValidator::kInvalidType, schema::kNumber, schema::kString)); schema->SetString(schema::kType, schema::kInteger); - ExpectNotValid(TEST_SOURCE, - scoped_ptr<base::Value>( - new base::FundamentalValue(88.8)).get(), - schema.get(), NULL, "", - JSONSchemaValidator::kInvalidTypeIntegerNumber); + ExpectNotValid( + TEST_SOURCE, + scoped_ptr<base::Value>(new base::FundamentalValue(88.8)).get(), + schema.get(), + NULL, + std::string(), + JSONSchemaValidator::kInvalidTypeIntegerNumber); schema->SetString(schema::kType, schema::kBoolean); - ExpectNotValid(TEST_SOURCE, - scoped_ptr<base::Value>(new base::FundamentalValue(1)).get(), - schema.get(), NULL, "", - JSONSchemaValidator::FormatErrorMessage( - JSONSchemaValidator::kInvalidType, - schema::kBoolean, - schema::kInteger)); + ExpectNotValid( + TEST_SOURCE, + scoped_ptr<base::Value>(new base::FundamentalValue(1)).get(), + schema.get(), + NULL, + std::string(), + JSONSchemaValidator::FormatErrorMessage(JSONSchemaValidator::kInvalidType, + schema::kBoolean, + schema::kInteger)); schema->SetString(schema::kType, schema::kNull); - ExpectNotValid(TEST_SOURCE, - scoped_ptr<base::Value>( - new base::FundamentalValue(false)).get(), - schema.get(), NULL, "", - JSONSchemaValidator::FormatErrorMessage( - JSONSchemaValidator::kInvalidType, - schema::kNull, - schema::kBoolean)); + ExpectNotValid( + TEST_SOURCE, + scoped_ptr<base::Value>(new base::FundamentalValue(false)).get(), + schema.get(), + NULL, + std::string(), + JSONSchemaValidator::FormatErrorMessage( + JSONSchemaValidator::kInvalidType, schema::kNull, schema::kBoolean)); } diff --git a/chrome/common/metrics/entropy_provider_unittest.cc b/chrome/common/metrics/entropy_provider_unittest.cc index 9881d7e..c3547ab 100644 --- a/chrome/common/metrics/entropy_provider_unittest.cc +++ b/chrome/common/metrics/entropy_provider_unittest.cc @@ -200,7 +200,7 @@ TEST_F(EntropyProviderTest, UseOneTimeRandomizationSHA1) { trials[i]->UseOneTimeRandomization(); for (int j = 0; j < 100; ++j) - trials[i]->AppendGroup("", 1); + trials[i]->AppendGroup(std::string(), 1); } // The trials are most likely to give different results since they have @@ -228,7 +228,7 @@ TEST_F(EntropyProviderTest, UseOneTimeRandomizationPermuted) { trials[i]->UseOneTimeRandomization(); for (int j = 0; j < 100; ++j) - trials[i]->AppendGroup("", 1); + trials[i]->AppendGroup(std::string(), 1); } // The trials are most likely to give different results since they have diff --git a/chrome/common/net/x509_certificate_model.cc b/chrome/common/net/x509_certificate_model.cc index 950b4f2..e1f0847 100644 --- a/chrome/common/net/x509_certificate_model.cc +++ b/chrome/common/net/x509_certificate_model.cc @@ -61,7 +61,7 @@ std::string ProcessRawBytesWithSeparators(const unsigned char* data, size_t kMin = 0U; if (!data_length) - return ""; + return std::string(); ret.reserve(std::max(kMin, data_length * 3 - 1)); diff --git a/chrome/common/net/x509_certificate_model_nss.cc b/chrome/common/net/x509_certificate_model_nss.cc index 5f40ce3..51e2642 100644 --- a/chrome/common/net/x509_certificate_model_nss.cc +++ b/chrome/common/net/x509_certificate_model_nss.cc @@ -100,8 +100,8 @@ using net::X509Certificate; using std::string; string GetCertNameOrNickname(X509Certificate::OSCertHandle cert_handle) { - string name = ProcessIDN(Stringize(CERT_GetCommonName(&cert_handle->subject), - "")); + string name = ProcessIDN( + Stringize(CERT_GetCommonName(&cert_handle->subject), std::string())); if (!name.empty()) return name; return GetNickname(cert_handle); @@ -132,7 +132,7 @@ string GetVersion(X509Certificate::OSCertHandle cert_handle) { SEC_ASN1DecodeInteger(&cert_handle->version, &version) == SECSuccess) { return base::UintToString(version + 1); } - return ""; + return std::string(); } net::CertType GetType(X509Certificate::OSCertHandle cert_handle) { @@ -142,7 +142,7 @@ net::CertType GetType(X509Certificate::OSCertHandle cert_handle) { string GetEmailAddress(X509Certificate::OSCertHandle cert_handle) { if (cert_handle->emailAddr) return cert_handle->emailAddr; - return ""; + return std::string(); } void GetUsageStrings(X509Certificate::OSCertHandle cert_handle, @@ -346,14 +346,14 @@ string GetCMSString(const X509Certificate::OSCertHandles& cert_chain, message.get(), cert_chain[start], PR_FALSE)); if (!signed_data.get()) { DLOG(ERROR) << "NSS_CMSSignedData_Create failed"; - return ""; + return std::string(); } // Add the rest of the chain (if any). for (size_t i = start + 1; i < end; ++i) { if (NSS_CMSSignedData_AddCertificate(signed_data.get(), cert_chain[i]) != SECSuccess) { DLOG(ERROR) << "NSS_CMSSignedData_AddCertificate failed on " << i; - return ""; + return std::string(); } } @@ -363,7 +363,7 @@ string GetCMSString(const X509Certificate::OSCertHandles& cert_chain, ignore_result(signed_data.release()); } else { DLOG(ERROR) << "NSS_CMSMessage_GetContentInfo failed"; - return ""; + return std::string(); } SECItem cert_p7 = { siBuffer, NULL, 0 }; @@ -373,12 +373,12 @@ string GetCMSString(const X509Certificate::OSCertHandles& cert_chain, NULL); if (!ecx) { DLOG(ERROR) << "NSS_CMSEncoder_Start failed"; - return ""; + return std::string(); } if (NSS_CMSEncoder_Finish(ecx) != SECSuccess) { DLOG(ERROR) << "NSS_CMSEncoder_Finish failed"; - return ""; + return std::string(); } return string(reinterpret_cast<const char*>(cert_p7.data), cert_p7.len); diff --git a/chrome/common/pref_names_util_unittest.cc b/chrome/common/pref_names_util_unittest.cc index 2d1356a..9f215ea 100644 --- a/chrome/common/pref_names_util_unittest.cc +++ b/chrome/common/pref_names_util_unittest.cc @@ -28,7 +28,7 @@ void ExpectParse(const std::string& path, } // namespace TEST(PrefNamesUtilTest, Basic) { - ExpectNoParse(""); + ExpectNoParse(std::string()); ExpectNoParse("."); ExpectNoParse("....."); ExpectNoParse("webkit.webprefs.fonts."); @@ -43,8 +43,8 @@ TEST(PrefNamesUtilTest, Basic) { // We don't particularly care about the parsed family and script for these // inputs, but just want to make sure it does something reasonable. Returning // false may also be an option. - ExpectParse("webkit.webprefs.fonts...", "", "."); - ExpectParse("webkit.webprefs.fonts....", "", ".."); + ExpectParse("webkit.webprefs.fonts...", std::string(), "."); + ExpectParse("webkit.webprefs.fonts....", std::string(), ".."); // Check that passing NULL output params is okay. EXPECT_TRUE(pref_names_util::ParseFontNamePrefPath( diff --git a/chrome/renderer/autofill/password_autofill_agent_browsertest.cc b/chrome/renderer/autofill/password_autofill_agent_browsertest.cc index 4a619f5..567c305 100644 --- a/chrome/renderer/autofill/password_autofill_agent_browsertest.cc +++ b/chrome/renderer/autofill/password_autofill_agent_browsertest.cc @@ -251,7 +251,7 @@ TEST_F(PasswordAutofillAgentTest, NoInitialAutocompleteForReadOnly) { // Only the username should have been autocompleted. // TODO(jcivelli): may be we should not event fill the username? - CheckTextFieldsState(kAliceUsername, true, "", false); + CheckTextFieldsState(kAliceUsername, true, std::string(), false); } // Tests that having a non-matching username precludes the autocomplete. @@ -263,7 +263,7 @@ TEST_F(PasswordAutofillAgentTest, NoInitialAutocompleteForFilledField) { SimulateOnFillPasswordForm(fill_data_); // Neither field should be autocompleted. - CheckTextFieldsState("bogus", false, "", false); + CheckTextFieldsState("bogus", false, std::string(), false); } // Tests that having a matching username does not preclude the autocomplete. @@ -288,7 +288,7 @@ TEST_F(PasswordAutofillAgentTest, PasswordClearOnEdit) { SimulateUsernameChange("alicia", true); // The password should have been cleared. - CheckTextFieldsState("alicia", false, "", false); + CheckTextFieldsState("alicia", false, std::string(), false); } // Tests that we only autocomplete on focus lost and with a full username match @@ -299,27 +299,27 @@ TEST_F(PasswordAutofillAgentTest, WaitUsername) { SimulateOnFillPasswordForm(fill_data_); // No auto-fill should have taken place. - CheckTextFieldsState("", false, "", false); + CheckTextFieldsState(std::string(), false, std::string(), false); // No autocomplete should happen when text is entered in the username. SimulateUsernameChange("a", true); - CheckTextFieldsState("a", false, "", false); + CheckTextFieldsState("a", false, std::string(), false); SimulateUsernameChange("al", true); - CheckTextFieldsState("al", false, "", false); + CheckTextFieldsState("al", false, std::string(), false); SimulateUsernameChange(kAliceUsername, true); - CheckTextFieldsState(kAliceUsername, false, "", false); + CheckTextFieldsState(kAliceUsername, false, std::string(), false); // Autocomplete should happen only when the username textfield is blurred with // a full match. username_element_.setValue("a"); autofill_agent_->textFieldDidEndEditing(username_element_); - CheckTextFieldsState("a", false, "", false); + CheckTextFieldsState("a", false, std::string(), false); username_element_.setValue("al"); autofill_agent_->textFieldDidEndEditing(username_element_); - CheckTextFieldsState("al", false, "", false); + CheckTextFieldsState("al", false, std::string(), false); username_element_.setValue("alices"); autofill_agent_->textFieldDidEndEditing(username_element_); - CheckTextFieldsState("alices", false, "", false); + CheckTextFieldsState("alices", false, std::string(), false); username_element_.setValue(ASCIIToUTF16(kAliceUsername)); autofill_agent_->textFieldDidEndEditing(username_element_); CheckTextFieldsState(kAliceUsername, true, kAlicePassword, true); @@ -351,7 +351,7 @@ TEST_F(PasswordAutofillAgentTest, InlineAutocomplete) { // Test that deleting does not trigger autocomplete. SimulateKeyDownEvent(username_element_, ui::VKEY_BACK); SimulateUsernameChange("alic", true); - CheckTextFieldsState("alic", false, "", false); + CheckTextFieldsState("alic", false, std::string(), false); CheckUsernameSelection(4, 4); // No selection. // Reset the last pressed key to something other than backspace. SimulateKeyDownEvent(username_element_, ui::VKEY_A); @@ -361,7 +361,7 @@ TEST_F(PasswordAutofillAgentTest, InlineAutocomplete) { // practice the username should no longer be 'alice' and the selected range // should be empty. SimulateUsernameChange("alf", true); - CheckTextFieldsState("alf", false, "", false); + CheckTextFieldsState("alf", false, std::string(), false); CheckUsernameSelection(3, 3); // No selection. // Ok, so now the user removes all the text and enters the letter 'b'. @@ -379,7 +379,7 @@ TEST_F(PasswordAutofillAgentTest, InlineAutocomplete) { // want case-sensitive autocompletion, so the username and the selected range // should be empty. SimulateUsernameChange("c", true); - CheckTextFieldsState("c", false, "", false); + CheckTextFieldsState("c", false, std::string(), false); CheckUsernameSelection(1, 1); } @@ -419,7 +419,7 @@ TEST_F(PasswordAutofillAgentTest, SuggestionSelect) { WebKit::WebString(), 0); // Autocomplete should not have kicked in. - CheckTextFieldsState("", false, "", false); + CheckTextFieldsState(std::string(), false, std::string(), false); } } // namespace autofill diff --git a/chrome/renderer/automation/automation_renderer_helper_browsertest.cc b/chrome/renderer/automation/automation_renderer_helper_browsertest.cc index 659d312..65bd018 100644 --- a/chrome/renderer/automation/automation_renderer_helper_browsertest.cc +++ b/chrome/renderer/automation/automation_renderer_helper_browsertest.cc @@ -84,9 +84,9 @@ TEST_F(AutomationRendererHelperTest, RTLSnapshot) { } TEST_F(AutomationRendererHelperTest, ScriptChain) { - ScriptEvaluationRequest request("({'result': 10})", ""); - ScriptEvaluationRequest request_plus1( - "({'result': arguments[0].result + 1})", ""); + ScriptEvaluationRequest request("({'result': 10})", std::string()); + ScriptEvaluationRequest request_plus1("({'result': arguments[0].result + 1})", + std::string()); std::vector<ScriptEvaluationRequest> script_chain; script_chain.push_back(request); script_chain.push_back(request_plus1); @@ -102,10 +102,10 @@ TEST_F(AutomationRendererHelperTest, ScriptChain) { } TEST_F(AutomationRendererHelperTest, ScriptChainError) { - ScriptEvaluationRequest request("({'result': 10})", ""); + ScriptEvaluationRequest request("({'result': 10})", std::string()); ScriptEvaluationRequest error_request( "({'result': arguments[0].result + 1, 'error': {'msg': 'some msg'}})", - ""); + std::string()); std::vector<ScriptEvaluationRequest> script_chain; script_chain.push_back(request); script_chain.push_back(error_request); diff --git a/chrome/renderer/chrome_content_renderer_client_unittest.cc b/chrome/renderer/chrome_content_renderer_client_unittest.cc index b099eea..1387ff0 100644 --- a/chrome/renderer/chrome_content_renderer_client_unittest.cc +++ b/chrome/renderer/chrome_content_renderer_client_unittest.cc @@ -96,8 +96,8 @@ scoped_refptr<const extensions::Extension> CreateTestExtension( scoped_refptr<const extensions::Extension> CreateExtension( bool is_unrestricted, bool is_from_webstore) { - return CreateTestExtension(is_unrestricted, is_from_webstore, kNotHostedApp, - ""); + return CreateTestExtension( + is_unrestricted, is_from_webstore, kNotHostedApp, std::string()); } scoped_refptr<const extensions::Extension> CreateHostedApp( diff --git a/chrome/renderer/content_settings_observer_browsertest.cc b/chrome/renderer/content_settings_observer_browsertest.cc index f4777d2..8397c94 100644 --- a/chrome/renderer/content_settings_observer_browsertest.cc +++ b/chrome/renderer/content_settings_observer_browsertest.cc @@ -110,12 +110,11 @@ TEST_F(ChromeRenderViewTest, JSBlockSentAfterPageLoad) { ContentSettingsForOneType& script_setting_rules = content_setting_rules.script_rules; script_setting_rules.push_back( - ContentSettingPatternSource( - ContentSettingsPattern::Wildcard(), - ContentSettingsPattern::Wildcard(), - CONTENT_SETTING_BLOCK, - "", - false)); + ContentSettingPatternSource(ContentSettingsPattern::Wildcard(), + ContentSettingsPattern::Wildcard(), + CONTENT_SETTING_BLOCK, + std::string(), + false)); ContentSettingsObserver* observer = ContentSettingsObserver::Get(view_); observer->SetContentSettingRules(&content_setting_rules); @@ -193,7 +192,7 @@ TEST_F(ChromeRenderViewTest, ImagesBlockedByDefault) { ContentSettingPatternSource(ContentSettingsPattern::Wildcard(), ContentSettingsPattern::Wildcard(), CONTENT_SETTING_BLOCK, - "", + std::string(), false)); ContentSettingsObserver* observer = ContentSettingsObserver::Get(view_); @@ -211,7 +210,7 @@ TEST_F(ChromeRenderViewTest, ImagesBlockedByDefault) { ContentSettingsPattern::Wildcard(), ContentSettingsPattern::FromString(mock_observer.image_origin_), CONTENT_SETTING_ALLOW, - "", + std::string(), false)); EXPECT_CALL( @@ -236,7 +235,7 @@ TEST_F(ChromeRenderViewTest, ImagesAllowedByDefault) { ContentSettingPatternSource(ContentSettingsPattern::Wildcard(), ContentSettingsPattern::Wildcard(), CONTENT_SETTING_ALLOW, - "", + std::string(), false)); ContentSettingsObserver* observer = ContentSettingsObserver::Get(view_); @@ -255,7 +254,7 @@ TEST_F(ChromeRenderViewTest, ImagesAllowedByDefault) { ContentSettingsPattern::Wildcard(), ContentSettingsPattern::FromString(mock_observer.image_origin_), CONTENT_SETTING_BLOCK, - "", + std::string(), false)); EXPECT_CALL(mock_observer, OnContentBlocked(CONTENT_SETTINGS_TYPE_IMAGES, std::string())); @@ -270,12 +269,11 @@ TEST_F(ChromeRenderViewTest, ContentSettingsBlockScripts) { ContentSettingsForOneType& script_setting_rules = content_setting_rules.script_rules; script_setting_rules.push_back( - ContentSettingPatternSource( - ContentSettingsPattern::Wildcard(), - ContentSettingsPattern::Wildcard(), - CONTENT_SETTING_BLOCK, - "", - false)); + ContentSettingPatternSource(ContentSettingsPattern::Wildcard(), + ContentSettingsPattern::Wildcard(), + CONTENT_SETTING_BLOCK, + std::string(), + false)); ContentSettingsObserver* observer = ContentSettingsObserver::Get(view_); observer->SetContentSettingRules(&content_setting_rules); @@ -306,12 +304,11 @@ TEST_F(ChromeRenderViewTest, ContentSettingsAllowScripts) { ContentSettingsForOneType& script_setting_rules = content_setting_rules.script_rules; script_setting_rules.push_back( - ContentSettingPatternSource( - ContentSettingsPattern::Wildcard(), - ContentSettingsPattern::Wildcard(), - CONTENT_SETTING_ALLOW, - "", - false)); + ContentSettingPatternSource(ContentSettingsPattern::Wildcard(), + ContentSettingsPattern::Wildcard(), + CONTENT_SETTING_ALLOW, + std::string(), + false)); ContentSettingsObserver* observer = ContentSettingsObserver::Get(view_); observer->SetContentSettingRules(&content_setting_rules); @@ -343,18 +340,20 @@ TEST_F(ChromeRenderViewTest, ContentSettingsInterstitialPages) { ContentSettingsForOneType& script_setting_rules = content_setting_rules.script_rules; script_setting_rules.push_back( - ContentSettingPatternSource( - ContentSettingsPattern::Wildcard(), - ContentSettingsPattern::Wildcard(), - CONTENT_SETTING_BLOCK, "", false)); + ContentSettingPatternSource(ContentSettingsPattern::Wildcard(), + ContentSettingsPattern::Wildcard(), + CONTENT_SETTING_BLOCK, + std::string(), + false)); // Block images. ContentSettingsForOneType& image_setting_rules = content_setting_rules.image_rules; image_setting_rules.push_back( - ContentSettingPatternSource( - ContentSettingsPattern::Wildcard(), - ContentSettingsPattern::Wildcard(), - CONTENT_SETTING_BLOCK, "", false)); + ContentSettingPatternSource(ContentSettingsPattern::Wildcard(), + ContentSettingsPattern::Wildcard(), + CONTENT_SETTING_BLOCK, + std::string(), + false)); ContentSettingsObserver* observer = ContentSettingsObserver::Get(view_); observer->SetContentSettingRules(&content_setting_rules); diff --git a/chrome/renderer/extensions/chrome_v8_context.cc b/chrome/renderer/extensions/chrome_v8_context.cc index b4ae80e..5feff00 100644 --- a/chrome/renderer/extensions/chrome_v8_context.cc +++ b/chrome/renderer/extensions/chrome_v8_context.cc @@ -63,7 +63,7 @@ void ChromeV8Context::Invalidate() { } std::string ChromeV8Context::GetExtensionID() { - return extension_ ? extension_->id() : ""; + return extension_ ? extension_->id() : std::string(); } // static @@ -187,7 +187,7 @@ std::string ChromeV8Context::GetContextTypeDescription() { case Feature::WEB_PAGE_CONTEXT: return "WEB_PAGE"; } NOTREACHED(); - return ""; + return std::string(); } ChromeV8Context* ChromeV8Context::GetContext() { diff --git a/chrome/renderer/extensions/extension_helper.cc b/chrome/renderer/extensions/extension_helper.cc index a488cb7..ac456a8 100644 --- a/chrome/renderer/extensions/extension_helper.cc +++ b/chrome/renderer/extensions/extension_helper.cc @@ -313,8 +313,12 @@ void ExtensionHelper::OnExecuteCode( WebFrame* main_frame = webview->mainFrame(); if (!main_frame) { ListValue val; - Send(new ExtensionHostMsg_ExecuteCodeFinished( - routing_id(), params.request_id, "No main frame", -1, GURL(""), val)); + Send(new ExtensionHostMsg_ExecuteCodeFinished(routing_id(), + params.request_id, + "No main frame", + -1, + GURL(std::string()), + val)); return; } diff --git a/chrome/renderer/extensions/resource_request_policy.cc b/chrome/renderer/extensions/resource_request_policy.cc index 116b218..83ccb3f 100644 --- a/chrome/renderer/extensions/resource_request_policy.cc +++ b/chrome/renderer/extensions/resource_request_policy.cc @@ -51,7 +51,8 @@ bool ResourceRequestPolicy::CanRequestResource( // some extensions want to be able to do things like create their own // launchers. std::string resource_root_relative_path = - resource_url.path().empty() ? "" : resource_url.path().substr(1); + resource_url.path().empty() ? std::string() + : resource_url.path().substr(1); if (extension->is_hosted_app() && !IconsInfo::GetIcons(extension) .ContainsPath(resource_root_relative_path)) { diff --git a/chrome/renderer/extensions/user_script_scheduler.cc b/chrome/renderer/extensions/user_script_scheduler.cc index 3cb01ba..f194a23 100644 --- a/chrome/renderer/extensions/user_script_scheduler.cc +++ b/chrome/renderer/extensions/user_script_scheduler.cc @@ -147,13 +147,13 @@ void UserScriptScheduler::ExecuteCodeImpl( // Since extension info is sent separately from user script info, they can // be out of sync. We just ignore this situation. if (!extension) { - render_view->Send(new ExtensionHostMsg_ExecuteCodeFinished( - render_view->GetRoutingID(), - params.request_id, - "", // no error - -1, - GURL(""), - execution_results)); + render_view->Send( + new ExtensionHostMsg_ExecuteCodeFinished(render_view->GetRoutingID(), + params.request_id, + std::string(), // no error + -1, + GURL(std::string()), + execution_results)); return; } diff --git a/chrome/renderer/extensions/user_script_slave.cc b/chrome/renderer/extensions/user_script_slave.cc index f715207..3e64b7d 100644 --- a/chrome/renderer/extensions/user_script_slave.cc +++ b/chrome/renderer/extensions/user_script_slave.cc @@ -92,7 +92,7 @@ std::string UserScriptSlave::GetExtensionIdForIsolatedWorld( if (iter->second == isolated_world_id) return iter->first; } - return ""; + return std::string(); } // static diff --git a/chrome/renderer/plugins/plugin_uma_unittest.cc b/chrome/renderer/plugins/plugin_uma_unittest.cc index 99e6271..3b1950c 100644 --- a/chrome/renderer/plugins/plugin_uma_unittest.cc +++ b/chrome/renderer/plugins/plugin_uma_unittest.cc @@ -118,9 +118,8 @@ TEST_F(PluginUMATest, WidevineCdm) { } TEST_F(PluginUMATest, BySrcExtension) { - ExpectPluginType(PluginUMAReporter::QUICKTIME, - "", - GURL("file://file.mov")); + ExpectPluginType( + PluginUMAReporter::QUICKTIME, std::string(), GURL("file://file.mov")); // When plugin's mime type is given, we don't check extension. ExpectPluginType(PluginUMAReporter::UNSUPPORTED_MIMETYPE, @@ -128,40 +127,36 @@ TEST_F(PluginUMATest, BySrcExtension) { GURL("http://file.mov")); ExpectPluginType(PluginUMAReporter::WINDOWS_MEDIA_PLAYER, - "", + std::string(), GURL("file://file.asx")); - ExpectPluginType(PluginUMAReporter::REALPLAYER, - "", - GURL("file://file.rm")); + ExpectPluginType( + PluginUMAReporter::REALPLAYER, std::string(), GURL("file://file.rm")); ExpectPluginType(PluginUMAReporter::QUICKTIME, - "", + std::string(), GURL("http://aaa/file.mov?x=aaaa&y=b#c")); ExpectPluginType(PluginUMAReporter::QUICKTIME, - "", + std::string(), GURL("http://file.mov?x=aaaa&y=b#c")); ExpectPluginType(PluginUMAReporter::SHOCKWAVE_FLASH, - "", + std::string(), GURL("http://file.swf?x=aaaa&y=b#c")); ExpectPluginType(PluginUMAReporter::SHOCKWAVE_FLASH, - "", + std::string(), GURL("http://file.spl?x=aaaa&y=b#c")); ExpectPluginType(PluginUMAReporter::UNSUPPORTED_EXTENSION, - "", + std::string(), GURL("http://file.unknown_extension")); - ExpectPluginType(PluginUMAReporter::UNSUPPORTED_EXTENSION, - "", - GURL("http://")); - ExpectPluginType(PluginUMAReporter::UNSUPPORTED_EXTENSION, - "", - GURL("mov")); + ExpectPluginType( + PluginUMAReporter::UNSUPPORTED_EXTENSION, std::string(), GURL("http://")); + ExpectPluginType( + PluginUMAReporter::UNSUPPORTED_EXTENSION, std::string(), GURL("mov")); } TEST_F(PluginUMATest, CaseSensitivity) { ExpectPluginType(PluginUMAReporter::QUICKTIME, "video/QUICKTIME", GURL("http://file.aaa")); - ExpectPluginType(PluginUMAReporter::QUICKTIME, - "", - GURL("http://file.MoV")); + ExpectPluginType( + PluginUMAReporter::QUICKTIME, std::string(), GURL("http://file.MoV")); } diff --git a/chrome/renderer/safe_browsing/malware_dom_details_browsertest.cc b/chrome/renderer/safe_browsing/malware_dom_details_browsertest.cc index 034655f..8a120cb 100644 --- a/chrome/renderer/safe_browsing/malware_dom_details_browsertest.cc +++ b/chrome/renderer/safe_browsing/malware_dom_details_browsertest.cc @@ -97,7 +97,7 @@ TEST_F(MalwareDOMDetailsTest, Everything) { } { // >50 subframes, to verify kMaxNodes. - std::string html = ""; + std::string html; for (int i = 0; i < 55; ++i) { // The iframe contents is just a number. GURL iframe_url(base::StringPrintf("%s%d", urlprefix, i)); @@ -113,7 +113,7 @@ TEST_F(MalwareDOMDetailsTest, Everything) { } { // A page with >50 scripts, to verify kMaxNodes. - std::string html = ""; + std::string html; for (int i = 0; i < 55; ++i) { // The iframe contents is just a number. GURL script_url(base::StringPrintf("%s%d", urlprefix, i)); diff --git a/chrome/service/cloud_print/cloud_print_proxy.cc b/chrome/service/cloud_print/cloud_print_proxy.cc index a65da81..12eee70 100644 --- a/chrome/service/cloud_print/cloud_print_proxy.cc +++ b/chrome/service/cloud_print/cloud_print_proxy.cc @@ -85,10 +85,10 @@ void CloudPrintProxy::EnableForUser(const std::string& lsid) { DCHECK(backend_.get()); // Read persisted robot credentials because we may decide to reuse it if the // passed in LSID belongs the same user. - std::string robot_refresh_token = - service_prefs_->GetString(prefs::kCloudPrintRobotRefreshToken, ""); + std::string robot_refresh_token = service_prefs_->GetString( + prefs::kCloudPrintRobotRefreshToken, std::string()); std::string robot_email = - service_prefs_->GetString(prefs::kCloudPrintRobotEmail, ""); + service_prefs_->GetString(prefs::kCloudPrintRobotEmail, std::string()); user_email_ = service_prefs_->GetString(prefs::kCloudPrintEmail, user_email_); // If we have been passed in an LSID, we want to use this to authenticate. @@ -104,7 +104,7 @@ void CloudPrintProxy::EnableForUser(const std::string& lsid) { } else { // Finally see if we have persisted user credentials (legacy case). std::string cloud_print_token = - service_prefs_->GetString(prefs::kCloudPrintAuthToken, ""); + service_prefs_->GetString(prefs::kCloudPrintAuthToken, std::string()); DCHECK(!cloud_print_token.empty()); backend_->InitializeWithToken(cloud_print_token); } @@ -124,7 +124,7 @@ void CloudPrintProxy::EnableForUserWithRobot( ShutdownBackend(); std::string proxy_id( - service_prefs_->GetString(prefs::kCloudPrintProxyId, "")); + service_prefs_->GetString(prefs::kCloudPrintProxyId, std::string())); service_prefs_->RemovePref(prefs::kCloudPrintRoot); if (!proxy_id.empty()) { // Keep only proxy id; @@ -204,7 +204,8 @@ void CloudPrintProxy::GetProxyInfo(CloudPrintProxyInfo* info) { // If the Cloud Print service is not enabled, we may need to read the old // value of proxy_id from prefs. if (info->proxy_id.empty()) - info->proxy_id = service_prefs_->GetString(prefs::kCloudPrintProxyId, ""); + info->proxy_id = + service_prefs_->GetString(prefs::kCloudPrintProxyId, std::string()); } void CloudPrintProxy::CheckCloudPrintProxyPolicy() { diff --git a/chrome/service/cloud_print/cloud_print_url_fetcher_unittest.cc b/chrome/service/cloud_print/cloud_print_url_fetcher_unittest.cc index 343eaa8..a86d24c 100644 --- a/chrome/service/cloud_print/cloud_print_url_fetcher_unittest.cc +++ b/chrome/service/cloud_print/cloud_print_url_fetcher_unittest.cc @@ -217,9 +217,9 @@ void CloudPrintURLFetcherTest::CreateFetcher(const GURL& url, int max_retries) { // Registers an entry for test url. It only allows 3 requests to be sent // in 200 milliseconds. - scoped_refptr<net::URLRequestThrottlerEntry> entry( - new net::URLRequestThrottlerEntry( - fetcher_->throttler_manager(), "", 200, 3, 1, 2.0, 0.0, 256)); + scoped_refptr<net::URLRequestThrottlerEntry> + entry(new net::URLRequestThrottlerEntry( + fetcher_->throttler_manager(), std::string(), 200, 3, 1, 2.0, 0.0, 256)); fetcher_->throttler_manager()->OverrideEntryForTests(url, entry); max_retries_ = max_retries; diff --git a/chrome/service/cloud_print/connector_settings.cc b/chrome/service/cloud_print/connector_settings.cc index 2b43b15..1e9b761 100644 --- a/chrome/service/cloud_print/connector_settings.cc +++ b/chrome/service/cloud_print/connector_settings.cc @@ -32,7 +32,7 @@ ConnectorSettings::~ConnectorSettings() { void ConnectorSettings::InitFrom(ServiceProcessPrefs* prefs) { CopyFrom(ConnectorSettings()); - proxy_id_ = prefs->GetString(prefs::kCloudPrintProxyId, ""); + proxy_id_ = prefs->GetString(prefs::kCloudPrintProxyId, std::string()); if (proxy_id_.empty()) { proxy_id_ = PrintSystem::GenerateProxyId(); prefs->SetString(prefs::kCloudPrintProxyId, proxy_id_); @@ -51,7 +51,8 @@ void ConnectorSettings::InitFrom(ServiceProcessPrefs* prefs) { } // Check if there is an override for the cloud print server URL. - server_url_ = GURL(prefs->GetString(prefs::kCloudPrintServiceURL, "")); + server_url_ = + GURL(prefs->GetString(prefs::kCloudPrintServiceURL, std::string())); DCHECK(server_url_.is_empty() || server_url_.is_valid()); if (server_url_.is_empty() || !server_url_.is_valid()) { server_url_ = GURL(kDefaultCloudPrintServerUrl); diff --git a/chrome/service/cloud_print/printer_job_handler_unittest.cc b/chrome/service/cloud_print/printer_job_handler_unittest.cc index 9e19519..0576bb0 100644 --- a/chrome/service/cloud_print/printer_job_handler_unittest.cc +++ b/chrome/service/cloud_print/printer_job_handler_unittest.cc @@ -194,7 +194,7 @@ const char kExamplePrinterDescription[] = "Example Description"; // These are functions used to construct the various sample strings. std::string JobListResponse(int num_jobs) { - std::string job_objects = ""; + std::string job_objects; for (int i = 0; i < num_jobs; i++) { job_objects = job_objects + StringPrintf(kExampleJobObject, i+1, i+1, i+1, i+1); @@ -683,7 +683,7 @@ TEST_F(PrinterJobHandlerTest, TicketDownloadFailureTest) { JobListResponse(2), true); factory_.SetFakeResponse(JobListURI(kJobFetchReasonQueryMore), JobListResponse(0), true); - factory_.SetFakeResponse(TicketURI(1), "", false); + factory_.SetFakeResponse(TicketURI(1), std::string(), false); EXPECT_CALL(url_callback_, OnRequestCreate(GURL(TicketURI(1)), _)) .Times(AtLeast(1)); @@ -734,7 +734,7 @@ TEST_F(PrinterJobHandlerTest, DISABLED_ManyFailureTest) { SetUpJobSuccessTest(1); - factory_.SetFakeResponse(TicketURI(1), "", false); + factory_.SetFakeResponse(TicketURI(1), std::string(), false); loop_.PostDelayedTask(FROM_HERE, base::Bind(&net::FakeURLFetcherFactory::SetFakeResponse, @@ -759,7 +759,7 @@ TEST_F(PrinterJobHandlerTest, DISABLED_CompleteFailureTest) { factory_.SetFakeResponse(JobListURI(kJobFetchReasonRetry), JobListResponse(1), true); factory_.SetFakeResponse(ErrorURI(1), StatusResponse(1, "ERROR"), true); - factory_.SetFakeResponse(TicketURI(1), "", false); + factory_.SetFakeResponse(TicketURI(1), std::string(), false); EXPECT_CALL(url_callback_, OnRequestCreate(GURL(JobListURI(kJobFetchReasonStartup)), _)) diff --git a/chrome/service/cloud_print/printer_job_queue_handler_unittest.cc b/chrome/service/cloud_print/printer_job_queue_handler_unittest.cc index 05532b9..b29f5a4 100644 --- a/chrome/service/cloud_print/printer_job_queue_handler_unittest.cc +++ b/chrome/service/cloud_print/printer_job_queue_handler_unittest.cc @@ -81,7 +81,7 @@ TEST_F(PrinterJobQueueHandlerTest, BasicJobReadTest) { std::set<std::string> expected_tags; expected_tags.insert("^own"); - expected_tags.insert(""); + expected_tags.insert(std::string()); std::set<std::string> actual_tags; actual_tags.insert(jobs[0].tags_.begin(), jobs[0].tags_.end()); diff --git a/chrome/service/service_process.cc b/chrome/service/service_process.cc index 2cae376..32d5cc2 100644 --- a/chrome/service/service_process.cc +++ b/chrome/service/service_process.cc @@ -175,7 +175,8 @@ bool ServiceProcess::Initialize(MessageLoopForUI* message_loop, } else { // If no command-line value was specified, read the last used locale from // the prefs. - locale = service_prefs_->GetString(prefs::kApplicationLocale, ""); + locale = + service_prefs_->GetString(prefs::kApplicationLocale, std::string()); // If no locale was specified anywhere, use the default one. if (locale.empty()) locale = kDefaultServiceProcessLocale; diff --git a/chrome/service/service_process_prefs_unittest.cc b/chrome/service/service_process_prefs_unittest.cc index 5d68ab3..3d7ae1f 100644 --- a/chrome/service/service_process_prefs_unittest.cc +++ b/chrome/service/service_process_prefs_unittest.cc @@ -39,9 +39,8 @@ TEST_F(ServiceProcessPrefsTest, RetrievePrefs) { prefs_->WritePrefs(); message_loop_.RunUntilIdle(); prefs_->SetBoolean("testb", false); // overwrite - prefs_->SetString("tests", ""); // overwrite + prefs_->SetString("tests", std::string()); // overwrite prefs_->ReadPrefs(); EXPECT_EQ(prefs_->GetBoolean("testb", false), true); - EXPECT_EQ(prefs_->GetString("tests", ""), "testvalue"); + EXPECT_EQ(prefs_->GetString("tests", std::string()), "testvalue"); } - diff --git a/chrome/test/base/ui_test_utils.cc b/chrome/test/base/ui_test_utils.cc index f3b91f6..fbf366d 100644 --- a/chrome/test/base/ui_test_utils.cc +++ b/chrome/test/base/ui_test_utils.cc @@ -187,7 +187,7 @@ bool GetCurrentTabTitle(const Browser* browser, string16* title) { NavigationEntry* last_entry = web_contents->GetController().GetActiveEntry(); if (!last_entry) return false; - title->assign(last_entry->GetTitleForDisplay("")); + title->assign(last_entry->GetTitleForDisplay(std::string())); return true; } diff --git a/chrome/test/chromedriver/capabilities_unittest.cc b/chrome/test/chromedriver/capabilities_unittest.cc index f6ac5ec..9bf6c32 100644 --- a/chrome/test/chromedriver/capabilities_unittest.cc +++ b/chrome/test/chromedriver/capabilities_unittest.cc @@ -21,7 +21,7 @@ TEST(ParseCapabilities, WithAndroidPackage) { TEST(ParseCapabilities, EmptyAndroidPackage) { Capabilities capabilities; base::DictionaryValue caps; - caps.SetString("chromeOptions.android_package", ""); + caps.SetString("chromeOptions.android_package", std::string()); Status status = capabilities.Parse(caps); ASSERT_FALSE(status.IsOk()); } diff --git a/chrome/test/chromedriver/chrome/automation_extension.cc b/chrome/test/chromedriver/chrome/automation_extension.cc index 0a91cf5..63ad223 100644 --- a/chrome/test/chromedriver/chrome/automation_extension.cc +++ b/chrome/test/chromedriver/chrome/automation_extension.cc @@ -52,8 +52,11 @@ Status AutomationExtension::GetWindowInfo(int* x, int* height) { base::ListValue args; scoped_ptr<base::Value> result; - Status status = web_view_->CallAsyncFunction( - "", "getWindowInfo", args, base::TimeDelta::FromSeconds(10), &result); + Status status = web_view_->CallAsyncFunction(std::string(), + "getWindowInfo", + args, + base::TimeDelta::FromSeconds(10), + &result); if (status.IsError()) return status; @@ -78,6 +81,9 @@ Status AutomationExtension::UpdateWindow( base::ListValue args; args.Append(update_info.DeepCopy()); scoped_ptr<base::Value> result; - return web_view_->CallAsyncFunction( - "", "updateWindow", args, base::TimeDelta::FromSeconds(10), &result); + return web_view_->CallAsyncFunction(std::string(), + "updateWindow", + args, + base::TimeDelta::FromSeconds(10), + &result); } diff --git a/chrome/test/chromedriver/chrome/chrome_desktop_impl.cc b/chrome/test/chromedriver/chrome/chrome_desktop_impl.cc index bee5bd2..49dfad2 100644 --- a/chrome/test/chromedriver/chrome/chrome_desktop_impl.cc +++ b/chrome/test/chromedriver/chrome/chrome_desktop_impl.cc @@ -67,7 +67,7 @@ Status ChromeDesktopImpl::GetAutomationExtension( return status; // Wait for the extension background page to load. - status = web_view->WaitForPendingNavigations(""); + status = web_view->WaitForPendingNavigations(std::string()); if (status.IsError()) return status; diff --git a/chrome/test/chromedriver/chrome/devtools_http_client.cc b/chrome/test/chromedriver/chrome/devtools_http_client.cc index c0fc841..3cfcdae 100644 --- a/chrome/test/chromedriver/chrome/devtools_http_client.cc +++ b/chrome/test/chromedriver/chrome/devtools_http_client.cc @@ -169,7 +169,8 @@ Status DevToolsHttpClient::CloseFrontends(const std::string& for_client_id) { scoped_ptr<base::Value> result; status = web_view->EvaluateScript( - "", "document.querySelector('*[id^=\"close-button-\"').click();", + std::string(), + "document.querySelector('*[id^=\"close-button-\"').click();", &result); // Ignore disconnected error, because it may be closed already. if (status.IsError() && status.code() != kDisconnected) diff --git a/chrome/test/chromedriver/chrome/devtools_http_client_unittest.cc b/chrome/test/chromedriver/chrome/devtools_http_client_unittest.cc index eff9b3f..c92abb8 100644 --- a/chrome/test/chromedriver/chrome/devtools_http_client_unittest.cc +++ b/chrome/test/chromedriver/chrome/devtools_http_client_unittest.cc @@ -64,8 +64,7 @@ TEST(ParseWebViewsInfo, WithoutDebuggerUrl) { ASSERT_TRUE(status.IsOk()); ASSERT_EQ(1u, views_info.GetSize()); ExpectEqual( - WebViewInfo( - "1", "", "http://page1", WebViewInfo::kPage), + WebViewInfo("1", std::string(), "http://page1", WebViewInfo::kPage), views_info.Get(0)); } diff --git a/chrome/test/chromedriver/chrome/javascript_dialog_manager_unittest.cc b/chrome/test/chromedriver/chrome/javascript_dialog_manager_unittest.cc index fcc3dce..1333090 100644 --- a/chrome/test/chromedriver/chrome/javascript_dialog_manager_unittest.cc +++ b/chrome/test/chromedriver/chrome/javascript_dialog_manager_unittest.cc @@ -19,7 +19,7 @@ TEST(JavaScriptDialogManager, NoDialog) { ASSERT_EQ(kNoAlertOpen, manager.GetDialogMessage(&message).code()); ASSERT_FALSE(manager.IsDialogOpen()); ASSERT_STREQ("HI", message.c_str()); - ASSERT_EQ(kNoAlertOpen, manager.HandleDialog(false, "").code()); + ASSERT_EQ(kNoAlertOpen, manager.HandleDialog(false, std::string()).code()); } namespace { @@ -73,7 +73,7 @@ TEST(JavaScriptDialogManager, ReconnectClearsStateAndSendsEnable) { ASSERT_EQ("Page.enable", client.method_); ASSERT_FALSE(manager.IsDialogOpen()); ASSERT_EQ(kNoAlertOpen, manager.GetDialogMessage(&message).code()); - ASSERT_EQ(kNoAlertOpen, manager.HandleDialog(false, "").code()); + ASSERT_EQ(kNoAlertOpen, manager.HandleDialog(false, std::string()).code()); } namespace { @@ -125,10 +125,10 @@ TEST(JavaScriptDialogManager, OneDialog) { ASSERT_EQ("hi", message); client.set_closing_count(1); - ASSERT_EQ(kOk, manager.HandleDialog(false, "").code()); + ASSERT_EQ(kOk, manager.HandleDialog(false, std::string()).code()); ASSERT_FALSE(manager.IsDialogOpen()); ASSERT_EQ(kNoAlertOpen, manager.GetDialogMessage(&message).code()); - ASSERT_EQ(kNoAlertOpen, manager.HandleDialog(false, "").code()); + ASSERT_EQ(kNoAlertOpen, manager.HandleDialog(false, std::string()).code()); } TEST(JavaScriptDialogManager, TwoDialogs) { @@ -145,16 +145,16 @@ TEST(JavaScriptDialogManager, TwoDialogs) { ASSERT_TRUE(manager.IsDialogOpen()); ASSERT_EQ("1", message); - ASSERT_EQ(kOk, manager.HandleDialog(false, "").code()); + ASSERT_EQ(kOk, manager.HandleDialog(false, std::string()).code()); ASSERT_TRUE(manager.IsDialogOpen()); ASSERT_EQ(kOk, manager.GetDialogMessage(&message).code()); ASSERT_EQ("2", message); client.set_closing_count(2); - ASSERT_EQ(kOk, manager.HandleDialog(false, "").code()); + ASSERT_EQ(kOk, manager.HandleDialog(false, std::string()).code()); ASSERT_FALSE(manager.IsDialogOpen()); ASSERT_EQ(kNoAlertOpen, manager.GetDialogMessage(&message).code()); - ASSERT_EQ(kNoAlertOpen, manager.HandleDialog(false, "").code()); + ASSERT_EQ(kNoAlertOpen, manager.HandleDialog(false, std::string()).code()); } TEST(JavaScriptDialogManager, OneDialogManualClose) { @@ -174,5 +174,5 @@ TEST(JavaScriptDialogManager, OneDialogManualClose) { manager.OnEvent("Page.javascriptDialogClosing", params); ASSERT_FALSE(manager.IsDialogOpen()); ASSERT_EQ(kNoAlertOpen, manager.GetDialogMessage(&message).code()); - ASSERT_EQ(kNoAlertOpen, manager.HandleDialog(false, "").code()); + ASSERT_EQ(kNoAlertOpen, manager.HandleDialog(false, std::string()).code()); } diff --git a/chrome/test/chromedriver/chrome/navigation_tracker_unittest.cc b/chrome/test/chromedriver/chrome/navigation_tracker_unittest.cc index 79cc0f6..19a78ef3 100644 --- a/chrome/test/chromedriver/chrome/navigation_tracker_unittest.cc +++ b/chrome/test/chromedriver/chrome/navigation_tracker_unittest.cc @@ -173,7 +173,7 @@ class DeterminingLoadStateDevToolsClient : public StubDevToolsClient { TEST(NavigationTracker, UnknownStateForcesStart) { base::DictionaryValue params; - DeterminingLoadStateDevToolsClient client(true, "", ¶ms); + DeterminingLoadStateDevToolsClient client(true, std::string(), ¶ms); NavigationTracker tracker(&client); ASSERT_NO_FATAL_FAILURE(AssertPendingState(&tracker, "f", true)); } diff --git a/chrome/test/chromedriver/chrome/stub_chrome.cc b/chrome/test/chromedriver/chrome/stub_chrome.cc index 39888a8..d990d4e 100644 --- a/chrome/test/chromedriver/chrome/stub_chrome.cc +++ b/chrome/test/chromedriver/chrome/stub_chrome.cc @@ -11,7 +11,7 @@ StubChrome::StubChrome() {} StubChrome::~StubChrome() {} std::string StubChrome::GetVersion() { - return ""; + return std::string(); } int StubChrome::GetBuildNo() { @@ -49,7 +49,7 @@ Status StubChrome::GetAutomationExtension(AutomationExtension** extension) { } std::string StubChrome::GetOperatingSystemName() { - return ""; + return std::string(); } Status StubChrome::Quit() { diff --git a/chrome/test/chromedriver/chrome/web_view_impl_unittest.cc b/chrome/test/chromedriver/chrome/web_view_impl_unittest.cc index 37e3284..ecdc85b 100644 --- a/chrome/test/chromedriver/chrome/web_view_impl_unittest.cc +++ b/chrome/test/chromedriver/chrome/web_view_impl_unittest.cc @@ -60,8 +60,8 @@ void AssertEvalFails(const base::DictionaryValue& command_result) { scoped_ptr<base::DictionaryValue> result; FakeDevToolsClient client; client.set_result(command_result); - Status status = internal::EvaluateScript(&client, 0, "", - internal::ReturnByValue, &result); + Status status = internal::EvaluateScript( + &client, 0, std::string(), internal::ReturnByValue, &result); ASSERT_EQ(kUnknownError, status.code()); ASSERT_FALSE(result); } @@ -72,8 +72,8 @@ TEST(EvaluateScript, CommandError) { scoped_ptr<base::DictionaryValue> result; FakeDevToolsClient client; client.set_status(Status(kUnknownError)); - Status status = internal::EvaluateScript(&client, 0, "", - internal::ReturnByValue, &result); + Status status = internal::EvaluateScript( + &client, 0, std::string(), internal::ReturnByValue, &result); ASSERT_EQ(kUnknownError, status.code()); ASSERT_FALSE(result); } @@ -104,7 +104,7 @@ TEST(EvaluateScript, Ok) { FakeDevToolsClient client; client.set_result(dict); ASSERT_TRUE(internal::EvaluateScript( - &client, 0, "", internal::ReturnByValue, &result).IsOk()); + &client, 0, std::string(), internal::ReturnByValue, &result).IsOk()); ASSERT_TRUE(result); ASSERT_TRUE(result->HasKey("key")); } @@ -117,7 +117,7 @@ TEST(EvaluateScriptAndGetValue, MissingType) { dict.SetInteger("result.value", 1); client.set_result(dict); ASSERT_TRUE(internal::EvaluateScriptAndGetValue( - &client, 0, "", &result).IsError()); + &client, 0, std::string(), &result).IsError()); } TEST(EvaluateScriptAndGetValue, Undefined) { @@ -127,8 +127,8 @@ TEST(EvaluateScriptAndGetValue, Undefined) { dict.SetBoolean("wasThrown", false); dict.SetString("result.type", "undefined"); client.set_result(dict); - Status status = internal::EvaluateScriptAndGetValue( - &client, 0, "", &result); + Status status = + internal::EvaluateScriptAndGetValue(&client, 0, std::string(), &result); ASSERT_EQ(kOk, status.code()); ASSERT_TRUE(result && result->IsType(base::Value::TYPE_NULL)); } @@ -141,8 +141,8 @@ TEST(EvaluateScriptAndGetValue, Ok) { dict.SetString("result.type", "integer"); dict.SetInteger("result.value", 1); client.set_result(dict); - Status status = internal::EvaluateScriptAndGetValue( - &client, 0, "", &result); + Status status = + internal::EvaluateScriptAndGetValue(&client, 0, std::string(), &result); ASSERT_EQ(kOk, status.code()); int value; ASSERT_TRUE(result && result->GetAsInteger(&value)); @@ -158,7 +158,7 @@ TEST(EvaluateScriptAndGetObject, NoObject) { bool got_object; std::string object_id; ASSERT_TRUE(internal::EvaluateScriptAndGetObject( - &client, 0, "", &got_object, &object_id).IsOk()); + &client, 0, std::string(), &got_object, &object_id).IsOk()); ASSERT_FALSE(got_object); ASSERT_TRUE(object_id.empty()); } @@ -172,7 +172,7 @@ TEST(EvaluateScriptAndGetObject, Ok) { bool got_object; std::string object_id; ASSERT_TRUE(internal::EvaluateScriptAndGetObject( - &client, 0, "", &got_object, &object_id).IsOk()); + &client, 0, std::string(), &got_object, &object_id).IsOk()); ASSERT_TRUE(got_object); ASSERT_STREQ("id", object_id.c_str()); } diff --git a/chrome/test/chromedriver/chromedriver.cc b/chrome/test/chromedriver/chromedriver.cc index 40e48fc..8f7ddce0 100644 --- a/chrome/test/chromedriver/chromedriver.cc +++ b/chrome/test/chromedriver/chromedriver.cc @@ -36,7 +36,7 @@ void SetError(const std::string& error_msg, std::string* response) { base::DictionaryValue value; value.SetString("message", error_msg); - SetResponse(kUnknownError, &value, "", response); + SetResponse(kUnknownError, &value, std::string(), response); } } // namespace @@ -120,6 +120,6 @@ void Shutdown() { scoped_ptr<base::Value> value; std::string session_id; g_command_executor->ExecuteCommand( - "quitAll", params, "", &status_code, &value, &session_id); + "quitAll", params, std::string(), &status_code, &value, &session_id); delete g_command_executor; } diff --git a/chrome/test/chromedriver/chromedriver_unittest.cc b/chrome/test/chromedriver/chromedriver_unittest.cc index 91e1e06..9e585e3 100644 --- a/chrome/test/chromedriver/chromedriver_unittest.cc +++ b/chrome/test/chromedriver/chromedriver_unittest.cc @@ -164,7 +164,7 @@ TEST(ChromeDriver, ExecuteCommand) { base::DictionaryValue params; scoped_ptr<base::Value> value(base::Value::CreateNullValue()); mock->Expect(scoped_ptr<ExpectedCommand>(new ExpectedCommand( - "quitAll", params, "", kOk, value.Pass(), ""))); + "quitAll", params, std::string(), kOk, value.Pass(), std::string()))); } Shutdown(); } diff --git a/chrome/test/chromedriver/command_executor_impl_unittest.cc b/chrome/test/chromedriver/command_executor_impl_unittest.cc index f538d06..dafa6e4 100644 --- a/chrome/test/chromedriver/command_executor_impl_unittest.cc +++ b/chrome/test/chromedriver/command_executor_impl_unittest.cc @@ -118,8 +118,11 @@ TEST(CommandExecutorImplTest, CommandThatReturnsError) { StatusCode status_code; scoped_ptr<base::Value> value; std::string out_session_id; - executor.ExecuteCommand("simpleCommand", params, "", - &status_code, &value, + executor.ExecuteCommand("simpleCommand", + params, + std::string(), + &status_code, + &value, &out_session_id); ASSERT_EQ(kUnknownError, status_code); ASSERT_TRUE(value); diff --git a/chrome/test/chromedriver/commands_unittest.cc b/chrome/test/chromedriver/commands_unittest.cc index dabe0e2..dcfc06f 100644 --- a/chrome/test/chromedriver/commands_unittest.cc +++ b/chrome/test/chromedriver/commands_unittest.cc @@ -28,7 +28,8 @@ TEST(CommandsTest, GetStatus) { base::DictionaryValue params; scoped_ptr<base::Value> value; std::string session_id; - ASSERT_EQ(kOk, ExecuteGetStatus(params, "", &value, &session_id).code()); + ASSERT_EQ( + kOk, ExecuteGetStatus(params, std::string(), &value, &session_id).code()); base::DictionaryValue* dict; ASSERT_TRUE(value->GetAsDictionary(&dict)); base::Value* unused; @@ -72,7 +73,7 @@ TEST(CommandsTest, QuitAll) { scoped_ptr<base::Value> value; std::string session_id; Status status = - ExecuteQuitAll(cmd, &map, params, "", &value, &session_id); + ExecuteQuitAll(cmd, &map, params, std::string(), &value, &session_id); ASSERT_EQ(kOk, status.code()); ASSERT_FALSE(value.get()); ASSERT_EQ(2, count); @@ -243,7 +244,7 @@ TEST(CommandsTest, SuccessfulFindElement) { FindElementWebView web_view(true, kElementExistsQueryTwice); Session session("id"); session.implicit_wait = 1000; - session.SwitchToSubFrame("frame_id1", ""); + session.SwitchToSubFrame("frame_id1", std::string()); base::DictionaryValue params; params.SetString("using", "id"); params.SetString("value", "a"); @@ -272,7 +273,7 @@ TEST(CommandsTest, SuccessfulFindElements) { FindElementWebView web_view(false, kElementExistsQueryTwice); Session session("id"); session.implicit_wait = 1000; - session.SwitchToSubFrame("frame_id2", ""); + session.SwitchToSubFrame("frame_id2", std::string()); base::DictionaryValue params; params.SetString("using", "name"); params.SetString("value", "b"); @@ -306,7 +307,7 @@ TEST(CommandsTest, SuccessfulFindChildElement) { FindElementWebView web_view(true, kElementExistsQueryTwice); Session session("id"); session.implicit_wait = 1000; - session.SwitchToSubFrame("frame_id3", ""); + session.SwitchToSubFrame("frame_id3", std::string()); base::DictionaryValue params; params.SetString("using", "tag name"); params.SetString("value", "div"); @@ -344,7 +345,7 @@ TEST(CommandsTest, SuccessfulFindChildElements) { FindElementWebView web_view(false, kElementExistsQueryTwice); Session session("id"); session.implicit_wait = 1000; - session.SwitchToSubFrame("frame_id4", ""); + session.SwitchToSubFrame("frame_id4", std::string()); base::DictionaryValue params; params.SetString("using", "class name"); params.SetString("value", "c"); diff --git a/chrome/test/chromedriver/key_converter.cc b/chrome/test/chromedriver/key_converter.cc index 64c6099..49b95f3 100644 --- a/chrome/test/chromedriver/key_converter.cc +++ b/chrome/test/chromedriver/key_converter.cc @@ -158,11 +158,13 @@ bool KeyCodeFromShorthandKey(char16 key_utf16, } // namespace KeyEvent CreateKeyDownEvent(ui::KeyboardCode key_code, int modifiers) { - return KeyEvent(kRawKeyDownEventType, modifiers, "", "", key_code); + return KeyEvent( + kRawKeyDownEventType, modifiers, std::string(), std::string(), key_code); } KeyEvent CreateKeyUpEvent(ui::KeyboardCode key_code, int modifiers) { - return KeyEvent(kKeyUpEventType, modifiers, "", "", key_code); + return KeyEvent( + kKeyUpEventType, modifiers, std::string(), std::string(), key_code); } KeyEvent CreateCharEvent(const std::string& unmodified_text, diff --git a/chrome/test/chromedriver/keycode_text_conversion_x.cc b/chrome/test/chromedriver/keycode_text_conversion_x.cc index 5b89935..7cf3b32 100644 --- a/chrome/test/chromedriver/keycode_text_conversion_x.cc +++ b/chrome/test/chromedriver/keycode_text_conversion_x.cc @@ -180,7 +180,7 @@ bool GetXModifierMask(Display* display, int modifier, int* x_modifier) { std::string ConvertKeyCodeToText(ui::KeyboardCode key_code, int modifiers) { int x_key_code = KeyboardCodeToXKeyCode(key_code); if (x_key_code == -1) - return ""; + return std::string(); XEvent event; memset(&event, 0, sizeof(XEvent)); @@ -211,7 +211,7 @@ std::string ConvertKeyCodeToText(ui::KeyboardCode key_code, int modifiers) { uint16 character = ui::GetCharacterFromXEvent(&event); if (!character) - return ""; + return std::string(); return UTF16ToUTF8(string16(1, character)); } diff --git a/chrome/test/chromedriver/server/http_handler_unittest.cc b/chrome/test/chromedriver/server/http_handler_unittest.cc index d516902..a4d81a4 100644 --- a/chrome/test/chromedriver/server/http_handler_unittest.cc +++ b/chrome/test/chromedriver/server/http_handler_unittest.cc @@ -56,7 +56,7 @@ TEST(HttpHandlerTest, HandleUnknownCommand) { scoped_ptr<CommandExecutor>(new DummyExecutor()), scoped_ptr<HttpHandler::CommandMap>(new HttpHandler::CommandMap()), "/"); - HttpRequest request(kGet, "/path", ""); + HttpRequest request(kGet, "/path", std::string()); HttpResponse response; handler.Handle(request, &response); ASSERT_EQ(HttpResponse::kNotFound, response.status()); @@ -68,7 +68,7 @@ TEST(HttpHandlerTest, HandleNewSession) { HttpHandler handler( scoped_ptr<CommandExecutor>(new DummyExecutor()), map.Pass(), "/base/"); - HttpRequest request(kPost, "/base/session", ""); + HttpRequest request(kPost, "/base/session", std::string()); HttpResponse response; handler.Handle(request, &response); ASSERT_EQ(HttpResponse::kSeeOther, response.status()); @@ -96,7 +96,7 @@ TEST(HttpHandlerTest, HandleUnimplementedCommand) { HttpHandler handler( scoped_ptr<CommandExecutor>(new DummyExecutor(kUnknownCommand)), map.Pass(), "/"); - HttpRequest request(kPost, "/path", ""); + HttpRequest request(kPost, "/path", std::string()); HttpResponse response; handler.Handle(request, &response); ASSERT_EQ(HttpResponse::kNotImplemented, response.status()); @@ -108,7 +108,7 @@ TEST(HttpHandlerTest, HandleCommand) { HttpHandler handler( scoped_ptr<CommandExecutor>(new DummyExecutor()), map.Pass(), "/"); - HttpRequest request(kPost, "/path", ""); + HttpRequest request(kPost, "/path", std::string()); HttpResponse response; handler.Handle(request, &response); ASSERT_EQ(HttpResponse::kOk, response.status()); @@ -140,9 +140,9 @@ TEST(MatchesCommandTest, DiffPathLength) { ASSERT_FALSE(internal::MatchesCommand( kPost, "path", command, &session_id, ¶ms)); ASSERT_FALSE(internal::MatchesCommand( - kPost, "", command, &session_id, ¶ms)); - ASSERT_FALSE(internal::MatchesCommand( - kPost, "/", command, &session_id, ¶ms)); + kPost, std::string(), command, &session_id, ¶ms)); + ASSERT_FALSE( + internal::MatchesCommand(kPost, "/", command, &session_id, ¶ms)); ASSERT_FALSE(internal::MatchesCommand( kPost, "path/path/path", command, &session_id, ¶ms)); } diff --git a/chrome/test/chromedriver/session.cc b/chrome/test/chromedriver/session.cc index d6f6673..ae10238 100644 --- a/chrome/test/chromedriver/session.cc +++ b/chrome/test/chromedriver/session.cc @@ -67,7 +67,7 @@ void Session::SwitchToSubFrame(const std::string& frame_id, std::string Session::GetCurrentFrameId() const { if (frames.empty()) - return ""; + return std::string(); return frames.back().frame_id; } diff --git a/chrome/test/chromedriver/session_commands.cc b/chrome/test/chromedriver/session_commands.cc index 8fdea23..4be22c4 100644 --- a/chrome/test/chromedriver/session_commands.cc +++ b/chrome/test/chromedriver/session_commands.cc @@ -201,7 +201,8 @@ Status ExecuteSwitchToWindow( status = web_view->ConnectIfNecessary(); if (status.IsError()) return status; - status = web_view->CallFunction("", kGetWindowNameScript, args, &result); + status = web_view->CallFunction( + std::string(), kGetWindowNameScript, args, &result); if (status.IsError()) return status; std::string window_name; diff --git a/chrome/test/chromedriver/window_commands.cc b/chrome/test/chromedriver/window_commands.cc index 557d572..e7b7cd1 100644 --- a/chrome/test/chromedriver/window_commands.cc +++ b/chrome/test/chromedriver/window_commands.cc @@ -347,7 +347,8 @@ Status ExecuteGoBack( WebView* web_view, const base::DictionaryValue& params, scoped_ptr<base::Value>* value) { - return web_view->EvaluateScript("", "window.history.back();", value); + return web_view->EvaluateScript( + std::string(), "window.history.back();", value); } Status ExecuteGoForward( @@ -355,7 +356,8 @@ Status ExecuteGoForward( WebView* web_view, const base::DictionaryValue& params, scoped_ptr<base::Value>* value) { - return web_view->EvaluateScript("", "window.history.forward();", value); + return web_view->EvaluateScript( + std::string(), "window.history.forward();", value); } Status ExecuteRefresh( diff --git a/chrome/test/gpu/gpu_pixel_browsertest.cc b/chrome/test/gpu/gpu_pixel_browsertest.cc index 71d9478..82972a0 100644 --- a/chrome/test/gpu/gpu_pixel_browsertest.cc +++ b/chrome/test/gpu/gpu_pixel_browsertest.cc @@ -145,7 +145,7 @@ class GpuPixelBrowserTest : public InProcessBrowserTest { const char* test_status_prefixes[] = {"DISABLED_", "FLAKY_", "FAILS_"}; for (size_t i = 0; i < arraysize(test_status_prefixes); ++i) { ReplaceFirstSubstringAfterOffset( - &test_name_, 0, test_status_prefixes[i], ""); + &test_name_, 0, test_status_prefixes[i], std::string()); } ui::DisableTestCompositor(); diff --git a/chrome/test/perf/dom_checker_uitest.cc b/chrome/test/perf/dom_checker_uitest.cc index f966250..f22cce4 100644 --- a/chrome/test/perf/dom_checker_uitest.cc +++ b/chrome/test/perf/dom_checker_uitest.cc @@ -143,20 +143,24 @@ class DomCheckerTest : public UITest { } bool WaitUntilTestCompletes(TabProxy* tab) { - return WaitUntilJavaScriptCondition(tab, L"", + return WaitUntilJavaScriptCondition( + tab, + std::wstring(), L"window.domAutomationController.send(automation.IsDone());", TestTimeouts::large_test_timeout()); } bool GetTestCount(TabProxy* tab, int* test_count) { - return tab->ExecuteAndExtractInt(L"", + return tab->ExecuteAndExtractInt( + std::wstring(), L"window.domAutomationController.send(automation.GetTestCount());", test_count); } bool GetTestsFailed(TabProxy* tab, ResultsSet* tests_failed) { std::wstring json_wide; - bool succeeded = tab->ExecuteAndExtractString(L"", + bool succeeded = tab->ExecuteAndExtractString( + std::wstring(), L"window.domAutomationController.send(" L" JSON.stringify(automation.GetFailures()));", &json_wide); diff --git a/chrome/test/perf/feature_startup_test.cc b/chrome/test/perf/feature_startup_test.cc index c11a386..0caaa44 100644 --- a/chrome/test/perf/feature_startup_test.cc +++ b/chrome/test/perf/feature_startup_test.cc @@ -38,7 +38,8 @@ class NewTabUIStartupTest : public UIPerfTest { std::string times; for (int i = 0; i < kNumCycles; ++i) base::StringAppendF(×, "%.2f,", timings[i].InMillisecondsF()); - perf_test::PrintResultList("new_tab", "", label, times, "ms", important); + perf_test::PrintResultList( + "new_tab", std::string(), label, times, "ms", important); } void InitProfile(UITestBase::ProfileType profile_type) { diff --git a/chrome/test/perf/frame_rate/frame_rate_tests.cc b/chrome/test/perf/frame_rate/frame_rate_tests.cc index 7be2b36..7b36b27 100644 --- a/chrome/test/perf/frame_rate/frame_rate_tests.cc +++ b/chrome/test/perf/frame_rate/frame_rate_tests.cc @@ -196,8 +196,10 @@ class FrameRateTest // race condition caused by an html redirect. If that is the case, verify // that flag kHasRedirect is enabled for the current test. ASSERT_TRUE(WaitUntilJavaScriptCondition( - tab, L"", L"window.domAutomationController.send(__initialized);", - TestTimeouts::large_test_timeout())); + tab, + std::wstring(), + L"window.domAutomationController.send(__initialized);", + TestTimeouts::large_test_timeout())); if (HasFlag(kForceGpuComposited)) { ASSERT_TRUE(tab->NavigateToURLAsync( @@ -209,7 +211,9 @@ class FrameRateTest // Block until the tests completes. ASSERT_TRUE(WaitUntilJavaScriptCondition( - tab, L"", L"window.domAutomationController.send(!__running_all);", + tab, + std::wstring(), + L"window.domAutomationController.send(!__running_all);", TestTimeouts::large_test_timeout())); // TODO(jbates): remove this check when ref builds are updated. @@ -225,7 +229,7 @@ class FrameRateTest // Read out the results. std::wstring json; ASSERT_TRUE(tab->ExecuteAndExtractString( - L"", + std::wstring(), L"window.domAutomationController.send(" L"JSON.stringify(__calc_results_total()));", &json)); @@ -247,8 +251,12 @@ class FrameRateTest results["sigmas"].c_str()); std::string mean_and_error = results["mean"] + "," + results["sigma"]; - perf_test::PrintResultMeanAndError(name, "", trace_name, mean_and_error, - "milliseconds-per-frame", true); + perf_test::PrintResultMeanAndError(name, + std::string(), + trace_name, + mean_and_error, + "milliseconds-per-frame", + true); // Navigate back to NTP so that we can quit without timing out during the // wait-for-idle stage in test framework. diff --git a/chrome/test/perf/indexeddb_uitest.cc b/chrome/test/perf/indexeddb_uitest.cc index 787f2bf1..48db062 100644 --- a/chrome/test/perf/indexeddb_uitest.cc +++ b/chrome/test/perf/indexeddb_uitest.cc @@ -63,7 +63,8 @@ class IndexedDBTest : public UIPerfTest { bool GetResults(TabProxy* tab, ResultsMap* results) { std::wstring json_wide; - bool succeeded = tab->ExecuteAndExtractString(L"", + bool succeeded = tab->ExecuteAndExtractString( + std::wstring(), L"window.domAutomationController.send(" L" JSON.stringify(automation.getResults()));", &json_wide); @@ -84,8 +85,8 @@ class IndexedDBTest : public UIPerfTest { ResultsMap::const_iterator it = results.begin(); for (; it != results.end(); ++it) - perf_test::PrintResultList(it->first, "", trace_name, it->second, "ms", - false); + perf_test::PrintResultList( + it->first, std::string(), trace_name, it->second, "ms", false); } DISALLOW_COPY_AND_ASSIGN(IndexedDBTest); diff --git a/chrome/test/perf/page_cycler_test.cc b/chrome/test/perf/page_cycler_test.cc index 4354faf..9d13000 100644 --- a/chrome/test/perf/page_cycler_test.cc +++ b/chrome/test/perf/page_cycler_test.cc @@ -215,10 +215,11 @@ class PageCyclerTest : public UIPerfTest { // Get the timing cookie value from the DOM automation. std::wstring wcookie; - ASSERT_TRUE(tab->ExecuteAndExtractString(L"", - L"window.domAutomationController.send(" - L"JSON.stringify(__get_timings()));", - &wcookie)); + ASSERT_TRUE(tab->ExecuteAndExtractString( + std::wstring(), + L"window.domAutomationController.send(" + L"JSON.stringify(__get_timings()));", + &wcookie)); cookie = base::SysWideToNativeMB(wcookie); // JSON.stringify() encapsulates the returned string in quotes, strip them. @@ -260,8 +261,8 @@ class PageCyclerTest : public UIPerfTest { printf("Pages: [%s]\n", base::SysWideToNativeMB(pages).c_str()); - perf_test::PrintResultList(graph, "", trace_name, timings, "ms", - true /* important */); + perf_test::PrintResultList( + graph, std::string(), trace_name, timings, "ms", true /* important */); } void RunTest(const char* graph, const char* name, bool use_http) { @@ -275,7 +276,7 @@ class PageCyclerTest : public UIPerfTest { ASSERT_TRUE(tab.get()); std::wstring whistogram; ASSERT_TRUE(tab->ExecuteAndExtractString( - L"", + std::wstring(), L"window.domAutomationController.send(" L"window.domAutomationController.getHistogram ? " L"window.domAutomationController.getHistogram(\"" + diff --git a/chrome/test/perf/perf_test.cc b/chrome/test/perf/perf_test.cc index 68c92e1..ec1d214 100644 --- a/chrome/test/perf/perf_test.cc +++ b/chrome/test/perf/perf_test.cc @@ -54,8 +54,14 @@ void PrintResult(const std::string& measurement, size_t value, const std::string& units, bool important) { - PrintResultsImpl(measurement, modifier, trace, base::UintToString(value), - "", "", units, important); + PrintResultsImpl(measurement, + modifier, + trace, + base::UintToString(value), + std::string(), + std::string(), + units, + important); } void AppendResult(std::string& output, @@ -65,9 +71,14 @@ void AppendResult(std::string& output, size_t value, const std::string& units, bool important) { - output += ResultsToString(measurement, modifier, trace, + output += ResultsToString(measurement, + modifier, + trace, base::UintToString(value), - "", "", units, important); + std::string(), + std::string(), + units, + important); } void PrintResult(const std::string& measurement, @@ -76,7 +87,13 @@ void PrintResult(const std::string& measurement, const std::string& value, const std::string& units, bool important) { - PrintResultsImpl(measurement, modifier, trace, value, "", "", units, + PrintResultsImpl(measurement, + modifier, + trace, + value, + std::string(), + std::string(), + units, important); } @@ -87,7 +104,13 @@ void AppendResult(std::string& output, const std::string& value, const std::string& units, bool important) { - output += ResultsToString(measurement, modifier, trace, value, "", "", units, + output += ResultsToString(measurement, + modifier, + trace, + value, + std::string(), + std::string(), + units, important); } @@ -233,40 +256,120 @@ std::string IOPerfInfoToString(const std::string& test_name, } std::string t_name(test_name); - AppendResult(output, "read_op_b", "", "r_op_b" + t_name, read_op_b, "ops", + AppendResult(output, + "read_op_b", + std::string(), + "r_op_b" + t_name, + read_op_b, + "ops", false); - AppendResult(output, "write_op_b", "", "w_op_b" + t_name, write_op_b, "ops", + AppendResult(output, + "write_op_b", + std::string(), + "w_op_b" + t_name, + write_op_b, + "ops", false); - AppendResult(output, "other_op_b", "", "o_op_b" + t_name, other_op_b, "ops", + AppendResult(output, + "other_op_b", + std::string(), + "o_op_b" + t_name, + other_op_b, + "ops", false); - AppendResult(output, "total_op_b", "", "IO_op_b" + t_name, total_op_b, "ops", + AppendResult(output, + "total_op_b", + std::string(), + "IO_op_b" + t_name, + total_op_b, + "ops", false); - AppendResult(output, "read_byte_b", "", "r_b" + t_name, read_byte_b, "kb", + AppendResult(output, + "read_byte_b", + std::string(), + "r_b" + t_name, + read_byte_b, + "kb", false); - AppendResult(output, "write_byte_b", "", "w_b" + t_name, write_byte_b, "kb", + AppendResult(output, + "write_byte_b", + std::string(), + "w_b" + t_name, + write_byte_b, + "kb", false); - AppendResult(output, "other_byte_b", "", "o_b" + t_name, other_byte_b, "kb", + AppendResult(output, + "other_byte_b", + std::string(), + "o_b" + t_name, + other_byte_b, + "kb", false); - AppendResult(output, "total_byte_b", "", "IO_b" + t_name, total_byte_b, "kb", + AppendResult(output, + "total_byte_b", + std::string(), + "IO_b" + t_name, + total_byte_b, + "kb", false); - AppendResult(output, "read_op_r", "", "r_op_r" + t_name, read_op_r, "ops", + AppendResult(output, + "read_op_r", + std::string(), + "r_op_r" + t_name, + read_op_r, + "ops", false); - AppendResult(output, "write_op_r", "", "w_op_r" + t_name, write_op_r, "ops", + AppendResult(output, + "write_op_r", + std::string(), + "w_op_r" + t_name, + write_op_r, + "ops", false); - AppendResult(output, "other_op_r", "", "o_op_r" + t_name, other_op_r, "ops", + AppendResult(output, + "other_op_r", + std::string(), + "o_op_r" + t_name, + other_op_r, + "ops", false); - AppendResult(output, "total_op_r", "", "IO_op_r" + t_name, total_op_r, "ops", + AppendResult(output, + "total_op_r", + std::string(), + "IO_op_r" + t_name, + total_op_r, + "ops", false); - AppendResult(output, "read_byte_r", "", "r_r" + t_name, read_byte_r, "kb", + AppendResult(output, + "read_byte_r", + std::string(), + "r_r" + t_name, + read_byte_r, + "kb", false); - AppendResult(output, "write_byte_r", "", "w_r" + t_name, write_byte_r, "kb", + AppendResult(output, + "write_byte_r", + std::string(), + "w_r" + t_name, + write_byte_r, + "kb", false); - AppendResult(output, "other_byte_r", "", "o_r" + t_name, other_byte_r, "kb", + AppendResult(output, + "other_byte_r", + std::string(), + "o_r" + t_name, + other_byte_r, + "kb", false); - AppendResult(output, "total_byte_r", "", "IO_r" + t_name, total_byte_r, "kb", + AppendResult(output, + "total_byte_r", + std::string(), + "IO_r" + t_name, + total_byte_r, + "kb", false); return output; @@ -392,29 +495,57 @@ std::string MemoryUsageInfoToString(const std::string& test_name, total_working_set_size, "bytes", false /* not important */); #elif defined(OS_LINUX) || defined(OS_MACOSX) || defined(OS_ANDROID) - AppendResult(output, "vm_size_final_b", "", "vm_size_f_b" + trace_name, - browser_virtual_size, "bytes", + AppendResult(output, + "vm_size_final_b", + std::string(), + "vm_size_f_b" + trace_name, + browser_virtual_size, + "bytes", false /* not important */); - AppendResult(output, "vm_rss_final_b", "", "vm_rss_f_b" + trace_name, - browser_working_set_size, "bytes", + AppendResult(output, + "vm_rss_final_b", + std::string(), + "vm_rss_f_b" + trace_name, + browser_working_set_size, + "bytes", false /* not important */); - AppendResult(output, "vm_size_final_r", "", "vm_size_f_r" + trace_name, - renderer_virtual_size, "bytes", + AppendResult(output, + "vm_size_final_r", + std::string(), + "vm_size_f_r" + trace_name, + renderer_virtual_size, + "bytes", false /* not important */); - AppendResult(output, "vm_rss_final_r", "", "vm_rss_f_r" + trace_name, - renderer_working_set_size, "bytes", + AppendResult(output, + "vm_rss_final_r", + std::string(), + "vm_rss_f_r" + trace_name, + renderer_working_set_size, + "bytes", false /* not important */); - AppendResult(output, "vm_size_final_t", "", "vm_size_f_t" + trace_name, - total_virtual_size, "bytes", + AppendResult(output, + "vm_size_final_t", + std::string(), + "vm_size_f_t" + trace_name, + total_virtual_size, + "bytes", false /* not important */); - AppendResult(output, "vm_rss_final_t", "", "vm_rss_f_t" + trace_name, - total_working_set_size, "bytes", + AppendResult(output, + "vm_rss_final_t", + std::string(), + "vm_rss_f_t" + trace_name, + total_working_set_size, + "bytes", false /* not important */); #else NOTIMPLEMENTED(); #endif - AppendResult(output, "processes", "", "proc_" + trace_name, - chrome_processes.size(), "count", + AppendResult(output, + "processes", + std::string(), + "proc_" + trace_name, + chrome_processes.size(), + "count", false /* not important */); return output; @@ -439,7 +570,12 @@ std::string SystemCommitChargeToString(const std::string& test_name, bool important) { std::string trace_name(test_name); std::string output; - AppendResult(output, "commit_charge", "", "cc" + trace_name, charge, "kb", + AppendResult(output, + "commit_charge", + std::string(), + "cc" + trace_name, + charge, + "kb", important); return output; } diff --git a/chrome/test/perf/rendering/latency_tests.cc b/chrome/test/perf/rendering/latency_tests.cc index 70939fd..fdd00d7 100644 --- a/chrome/test/perf/rendering/latency_tests.cc +++ b/chrome/test/perf/rendering/latency_tests.cc @@ -153,7 +153,7 @@ class LatencyTest return "software"; default: NOTREACHED() << "invalid mode"; - return ""; + return std::string(); } } @@ -586,8 +586,12 @@ double LatencyTest::CalculateLatency() { std::string trace_name = GetTraceName(test_flags_); std::string mean_and_error = base::StringPrintf("%f,%f", mean_latency, mean_error); - perf_test::PrintResultMeanAndError(GetModeString(), "", trace_name, - mean_and_error, "frames", true); + perf_test::PrintResultMeanAndError(GetModeString(), + std::string(), + trace_name, + mean_and_error, + "frames", + true); return mean_latency; } diff --git a/chrome/test/perf/rendering/throughput_tests.cc b/chrome/test/perf/rendering/throughput_tests.cc index 79d6bbb..08a1483 100644 --- a/chrome/test/perf/rendering/throughput_tests.cc +++ b/chrome/test/perf/rendering/throughput_tests.cc @@ -383,8 +383,12 @@ class ThroughputTest : public BrowserPerfTest { ran_on_gpu ? "gpu" : "software"; std::string mean_and_error = base::StringPrintf("%f,%f", mean_ms, std_dev_ms); - perf_test::PrintResultMeanAndError(test_name, "", trace_name, - mean_and_error, "frame_time", true); + perf_test::PrintResultMeanAndError(test_name, + std::string(), + trace_name, + mean_and_error, + "frame_time", + true); if (flags & kAllowExternalDNS) ResetAllowExternalDNS(); diff --git a/chrome/test/perf/shutdown_test.cc b/chrome/test/perf/shutdown_test.cc index 7cbc7b6..d97c58b 100644 --- a/chrome/test/perf/shutdown_test.cc +++ b/chrome/test/perf/shutdown_test.cc @@ -114,7 +114,8 @@ class ShutdownTest : public UIPerfTest { std::string times; for (int i = 0; i < numCycles; ++i) base::StringAppendF(×, "%.2f,", timings[i].InMillisecondsF()); - perf_test::PrintResultList(graph, "", trace, times, "ms", important); + perf_test::PrintResultList( + graph, std::string(), trace, times, "ms", important); } }; diff --git a/chrome/test/perf/startup_test.cc b/chrome/test/perf/startup_test.cc index 1d8243f..0a07ce8 100644 --- a/chrome/test/perf/startup_test.cc +++ b/chrome/test/perf/startup_test.cc @@ -295,7 +295,8 @@ class StartupTest : public UIPerfTest { "%.2f,", timings[i].end_to_end.InMillisecondsF()); } - perf_test::PrintResultList(graph, "", trace, times, "ms", important); + perf_test::PrintResultList( + graph, std::string(), trace, times, "ms", important); if (num_tabs > 0) { std::string name_base = trace; @@ -305,15 +306,15 @@ class StartupTest : public UIPerfTest { name = name_base + "-start"; for (int i = 0; i < numCycles; ++i) base::StringAppendF(×, "%.2f,", timings[i].first_start_ms); - perf_test::PrintResultList(graph, "", name.c_str(), times, "ms", - important); + perf_test::PrintResultList( + graph, std::string(), name.c_str(), times, "ms", important); times.clear(); name = name_base + "-first"; for (int i = 0; i < numCycles; ++i) base::StringAppendF(×, "%.2f,", timings[i].first_stop_ms); - perf_test::PrintResultList(graph, "", name.c_str(), times, "ms", - important); + perf_test::PrintResultList( + graph, std::string(), name.c_str(), times, "ms", important); if (nth_timed_tab > 0) { // Display only the time necessary to load the first n tabs. @@ -321,8 +322,8 @@ class StartupTest : public UIPerfTest { name = name_base + "-" + base::IntToString(nth_timed_tab); for (int i = 0; i < numCycles; ++i) base::StringAppendF(×, "%.2f,", timings[i].nth_tab_stop_ms); - perf_test::PrintResultList(graph, "", name.c_str(), times, "ms", - important); + perf_test::PrintResultList( + graph, std::string(), name.c_str(), times, "ms", important); } if (num_tabs > 1) { @@ -331,8 +332,8 @@ class StartupTest : public UIPerfTest { name = name_base + "-all"; for (int i = 0; i < numCycles; ++i) base::StringAppendF(×, "%.2f,", timings[i].last_stop_ms); - perf_test::PrintResultList(graph, "", name.c_str(), times, "ms", - important); + perf_test::PrintResultList( + graph, std::string(), name.c_str(), times, "ms", important); } } } diff --git a/chrome/test/perf/tab_switching_test.cc b/chrome/test/perf/tab_switching_test.cc index 45a0891..a56c792 100644 --- a/chrome/test/perf/tab_switching_test.cc +++ b/chrome/test/perf/tab_switching_test.cc @@ -69,7 +69,8 @@ class TabSwitchingUITest : public UIPerfTest { std::string times; for (int i = 0; i < kNumCycles; ++i) base::StringAppendF(×, "%.2f,", timings[i].InMillisecondsF()); - perf_test::PrintResultList("times", "", label, times, "ms", important); + perf_test::PrintResultList( + "times", std::string(), label, times, "ms", important); } void RunTabSwitchingUITest(const char* label, bool important) { diff --git a/chrome/test/perf/url_fetch_test.cc b/chrome/test/perf/url_fetch_test.cc index 6c8712f..2cffb68 100644 --- a/chrome/test/perf/url_fetch_test.cc +++ b/chrome/test/perf/url_fetch_test.cc @@ -77,8 +77,8 @@ class UrlFetchTest : public UIPerfTest { "window.domAutomationController.send(%s);", var_to_fetch); std::wstring value; - bool success = tab->ExecuteAndExtractString(L"", ASCIIToWide(script), - &value); + bool success = tab->ExecuteAndExtractString( + std::wstring(), ASCIIToWide(script), &value); ASSERT_TRUE(success); result->javascript_variable = WideToUTF8(value); } diff --git a/chrome/test/ppapi/ppapi_test.cc b/chrome/test/ppapi/ppapi_test.cc index bec32a6..4cc99f4 100644 --- a/chrome/test/ppapi/ppapi_test.cc +++ b/chrome/test/ppapi/ppapi_test.cc @@ -156,7 +156,7 @@ GURL PPAPITestBase::GetTestFileUrl(const std::string& test_case) { GURL test_url = net::FilePathToFileURL(test_path); GURL::Replacements replacements; - std::string query = BuildQuery("", test_case); + std::string query = BuildQuery(std::string(), test_case); replacements.SetQuery(query.c_str(), url_parse::Component(0, query.size())); return test_url.ReplaceComponents(replacements); } @@ -182,7 +182,7 @@ void PPAPITestBase::RunTestViaHTTP(const std::string& test_case) { net::TestServer::kLocalhost, document_root); ASSERT_TRUE(http_server.Start()); - RunTestURL(GetTestURL(http_server, test_case, "")); + RunTestURL(GetTestURL(http_server, test_case, std::string())); } void PPAPITestBase::RunTestWithSSLServer(const std::string& test_case) { diff --git a/chrome/test/reliability/automated_ui_tests.cc b/chrome/test/reliability/automated_ui_tests.cc index fd50b23..4654082 100644 --- a/chrome/test/reliability/automated_ui_tests.cc +++ b/chrome/test/reliability/automated_ui_tests.cc @@ -505,7 +505,7 @@ bool AutomatedUITest::ChangeEncoding() { std::string cur_locale = g_browser_process->GetApplicationLocale(); const std::vector<CharacterEncoding::EncodingInfo>* encodings = CharacterEncoding::GetCurrentDisplayEncodings( - cur_locale, "ISO-8859-1,windows-1252", ""); + cur_locale, "ISO-8859-1,windows-1252", std::string()); DCHECK(encodings); DCHECK(!encodings->empty()); unsigned len = static_cast<unsigned>(encodings->size()); diff --git a/chrome/test/ui/ui_test.cc b/chrome/test/ui/ui_test.cc index cf839fb..40bdf16 100644 --- a/chrome/test/ui/ui_test.cc +++ b/chrome/test/ui/ui_test.cc @@ -516,7 +516,7 @@ bool UITestBase::BeginTracing(const std::string& categories) { std::string UITestBase::EndTracing() { std::string json_trace_output; if (!automation()->EndTracing(&json_trace_output)) - return ""; + return std::string(); return json_trace_output; } diff --git a/chrome/test/webdriver/commands/command.cc b/chrome/test/webdriver/commands/command.cc index 1471e0a..dfde908 100644 --- a/chrome/test/webdriver/commands/command.cc +++ b/chrome/test/webdriver/commands/command.cc @@ -32,7 +32,7 @@ bool Command::Init(Response* const response) { void Command::Finish(Response* const response) {} std::string Command::GetPathVariable(const size_t i) const { - return i < path_segments_.size() ? path_segments_.at(i) : ""; + return i < path_segments_.size() ? path_segments_.at(i) : std::string(); } bool Command::HasParameter(const std::string& key) const { diff --git a/chrome/test/webdriver/commands/set_timeout_commands_unittest.cc b/chrome/test/webdriver/commands/set_timeout_commands_unittest.cc index 2db4f4c..767fbb1 100644 --- a/chrome/test/webdriver/commands/set_timeout_commands_unittest.cc +++ b/chrome/test/webdriver/commands/set_timeout_commands_unittest.cc @@ -55,7 +55,7 @@ TEST(ImplicitWaitCommandTest, SettingImplicitWaits) { ASSERT_EQ(0, test_session.implicit_wait()) << "Sanity check failed"; std::vector<std::string> path_segments; - path_segments.push_back(""); + path_segments.push_back(std::string()); path_segments.push_back("session"); path_segments.push_back(test_session.id()); path_segments.push_back("timeouts"); diff --git a/chrome/test/webdriver/frame_path.cc b/chrome/test/webdriver/frame_path.cc index bce634d9..fd45a8d 100644 --- a/chrome/test/webdriver/frame_path.cc +++ b/chrome/test/webdriver/frame_path.cc @@ -8,7 +8,7 @@ namespace webdriver { -FramePath::FramePath() : path_("") {} +FramePath::FramePath() {} FramePath::FramePath(const FramePath& other) : path_(other.path_) {} diff --git a/chrome/test/webdriver/keycode_text_conversion_gtk.cc b/chrome/test/webdriver/keycode_text_conversion_gtk.cc index 05b17db..302d708 100644 --- a/chrome/test/webdriver/keycode_text_conversion_gtk.cc +++ b/chrome/test/webdriver/keycode_text_conversion_gtk.cc @@ -23,7 +23,7 @@ std::string ConvertKeyCodeToText(ui::KeyboardCode key_code, int modifiers) { gdk_key_code = gdk_keyval_to_upper(gdk_key_code); guint32 unicode_char = gdk_keyval_to_unicode(gdk_key_code); if (!unicode_char) - return ""; + return std::string(); gchar buffer[6]; gint length = g_unichar_to_utf8(unicode_char, buffer); return std::string(buffer, length); diff --git a/chrome/test/webdriver/webdriver_dispatch_unittest.cc b/chrome/test/webdriver/webdriver_dispatch_unittest.cc index 855711d..8e75edb 100644 --- a/chrome/test/webdriver/webdriver_dispatch_unittest.cc +++ b/chrome/test/webdriver/webdriver_dispatch_unittest.cc @@ -158,7 +158,7 @@ class ParseRequestInfoTest : public testing::Test { virtual ~ParseRequestInfoTest() {} virtual void TearDown() { - SessionManager::GetInstance()->set_url_base(""); + SessionManager::GetInstance()->set_url_base(std::string()); } private: @@ -178,7 +178,7 @@ TEST_F(ParseRequestInfoTest, ParseRequestWithEmptyUrlBase) { base::DictionaryValue* parameters; Response response; - SessionManager::GetInstance()->set_url_base(""); + SessionManager::GetInstance()->set_url_base(std::string()); EXPECT_TRUE(internal::ParseRequestInfo( &request_info, NULL, // NULL is ok because GET not POST is used diff --git a/chrome/test/webdriver/webdriver_key_converter.cc b/chrome/test/webdriver/webdriver_key_converter.cc index e19e9dc..b83d3cb 100644 --- a/chrome/test/webdriver/webdriver_key_converter.cc +++ b/chrome/test/webdriver/webdriver_key_converter.cc @@ -162,11 +162,19 @@ bool KeyCodeFromShorthandKey(char16 key_utf16, namespace webdriver { WebKeyEvent CreateKeyDownEvent(ui::KeyboardCode key_code, int modifiers) { - return WebKeyEvent(automation::kRawKeyDownType, key_code, "", "", modifiers); + return WebKeyEvent(automation::kRawKeyDownType, + key_code, + std::string(), + std::string(), + modifiers); } WebKeyEvent CreateKeyUpEvent(ui::KeyboardCode key_code, int modifiers) { - return WebKeyEvent(automation::kKeyUpType, key_code, "", "", modifiers); + return WebKeyEvent(automation::kKeyUpType, + key_code, + std::string(), + std::string(), + modifiers); } WebKeyEvent CreateCharEvent(const std::string& unmodified_text, diff --git a/chrome/test/webdriver/webdriver_session.cc b/chrome/test/webdriver/webdriver_session.cc index 953120a..6ed89d9 100644 --- a/chrome/test/webdriver/webdriver_session.cc +++ b/chrome/test/webdriver/webdriver_session.cc @@ -942,9 +942,11 @@ Error* Session::GetElementRegionInView( // Find the frame element for the current frame path. FrameId frame_id(current_target_.view_id, frame_path.Parent()); ElementId frame_element; - error = FindElement( - frame_id, ElementId(""), - LocatorType::kXpath, frame_path.BaseName().value(), &frame_element); + error = FindElement(frame_id, + ElementId(std::string()), + LocatorType::kXpath, + frame_path.BaseName().value(), + &frame_element); if (error) { std::string context = base::StringPrintf( "Could not find frame element (%s) in frame (%s)", diff --git a/chrome/test/webdriver/webdriver_session_manager.cc b/chrome/test/webdriver/webdriver_session_manager.cc index 8dc42e2..aa5aeca 100644 --- a/chrome/test/webdriver/webdriver_session_manager.cc +++ b/chrome/test/webdriver/webdriver_session_manager.cc @@ -49,7 +49,7 @@ std::string SessionManager::url_base() const { return url_base_; } -SessionManager::SessionManager() : port_(""), url_base_("") {} +SessionManager::SessionManager() {} SessionManager::~SessionManager() {} diff --git a/chrome/tools/ipclist/ipcfuzz.cc b/chrome/tools/ipclist/ipcfuzz.cc index 0eafb14..1d288c5 100644 --- a/chrome/tools/ipclist/ipcfuzz.cc +++ b/chrome/tools/ipclist/ipcfuzz.cc @@ -180,17 +180,17 @@ class DefaultFuzzer : public IPC::Fuzzer { } virtual void FuzzString(std::string* value) OVERRIDE { - FuzzStringType<std::string>(value, frequency_, "BORKED", ""); + FuzzStringType<std::string>(value, frequency_, "BORKED", std::string()); } virtual void FuzzWString(std::wstring* value) OVERRIDE { - FuzzStringType<std::wstring>(value, frequency_, L"BORKED", L""); + FuzzStringType<std::wstring>(value, frequency_, L"BORKED", std::wstring()); } virtual void FuzzString16(string16* value) OVERRIDE { FuzzStringType<string16>(value, frequency_, WideToUTF16(L"BORKED"), - WideToUTF16(L"")); + WideToUTF16(std::wstring())); } virtual void FuzzData(char* data, int length) OVERRIDE { diff --git a/chrome/utility/profile_import_handler.cc b/chrome/utility/profile_import_handler.cc index 473581c..413feea 100644 --- a/chrome/utility/profile_import_handler.cc +++ b/chrome/utility/profile_import_handler.cc @@ -68,7 +68,7 @@ void ProfileImportHandler::OnImportItemFinished(uint16 item) { items_to_import_ ^= item; // Remove finished item from mask. // If we've finished with all items, notify the browser process. if (items_to_import_ == 0) { - Send(new ProfileImportProcessHostMsg_Import_Finished(true, "")); + Send(new ProfileImportProcessHostMsg_Import_Finished(true, std::string())); ImporterCleanup(); } } diff --git a/components/autofill/browser/phone_number_i18n_unittest.cc b/components/autofill/browser/phone_number_i18n_unittest.cc index 7744272..0547520 100644 --- a/components/autofill/browser/phone_number_i18n_unittest.cc +++ b/components/autofill/browser/phone_number_i18n_unittest.cc @@ -337,7 +337,7 @@ TEST(PhoneNumberI18NTest, PhoneNumbersMatch) { // Same numbers, undefined country code. EXPECT_TRUE(PhoneNumbersMatch(ASCIIToUTF16("4158889999"), ASCIIToUTF16("4158889999"), - "", + std::string(), "en-US")); // Numbers differ by country code only. diff --git a/components/autofill/browser/wallet/full_wallet_unittest.cc b/components/autofill/browser/wallet/full_wallet_unittest.cc index 9eead30..5a65940 100644 --- a/components/autofill/browser/wallet/full_wallet_unittest.cc +++ b/components/autofill/browser/wallet/full_wallet_unittest.cc @@ -402,8 +402,8 @@ TEST_F(FullWalletTest, CreateFullWalletWithRequiredActions) { FullWallet full_wallet(-1, -1, - "", - "", + std::string(), + std::string(), scoped_ptr<Address>(), scoped_ptr<Address>(), required_actions); @@ -411,14 +411,13 @@ TEST_F(FullWalletTest, CreateFullWalletWithRequiredActions) { ASSERT_FALSE(required_actions.empty()); required_actions.pop_back(); - FullWallet different_required_actions( - -1, - -1, - "", - "", - scoped_ptr<Address>(), - scoped_ptr<Address>(), - required_actions); + FullWallet different_required_actions(-1, + -1, + std::string(), + std::string(), + scoped_ptr<Address>(), + scoped_ptr<Address>(), + required_actions); EXPECT_NE(full_wallet, different_required_actions); } diff --git a/components/autofill/browser/wallet/wallet_address_unittest.cc b/components/autofill/browser/wallet/wallet_address_unittest.cc index 0949c6a..7ac92f7 100644 --- a/components/autofill/browser/wallet/wallet_address_unittest.cc +++ b/components/autofill/browser/wallet/wallet_address_unittest.cc @@ -176,7 +176,7 @@ TEST_F(WalletAddressTest, CreateAddressMissingObjectId) { ASCIIToUTF16("administrative_area_name"), ASCIIToUTF16("postal_code_number"), ASCIIToUTF16("phone_number"), - ""); + std::string()); ASSERT_EQ(address, *Address::CreateAddress(*dict_)); } @@ -243,7 +243,7 @@ TEST_F(WalletAddressTest, CreateDisplayAddress) { ASCIIToUTF16("state"), ASCIIToUTF16("postal_code"), ASCIIToUTF16("phone_number"), - ""); + std::string()); ASSERT_EQ(address, *Address::CreateDisplayAddress(*dict_)); } @@ -272,7 +272,7 @@ TEST_F(WalletAddressTest, ToDictionaryWithoutID) { ASCIIToUTF16("administrative_area_name"), ASCIIToUTF16("postal_code_number"), ASCIIToUTF16("phone_number"), - ""); + std::string()); EXPECT_TRUE(expected.Equals(address.ToDictionaryWithoutID().get())); } diff --git a/components/autofill/browser/wallet/wallet_client_unittest.cc b/components/autofill/browser/wallet/wallet_client_unittest.cc index 27d1a2d..6229847 100644 --- a/components/autofill/browser/wallet/wallet_client_unittest.cc +++ b/components/autofill/browser/wallet/wallet_client_unittest.cc @@ -810,9 +810,8 @@ TEST_F(WalletClientTest, NetworkFailureOnExpectedVoidResponse) { delegate_.ExpectBaselineMetrics(NO_ESCROW_REQUEST, HAS_WALLET_REQUEST); delegate_.ExpectWalletErrorMetric(AutofillMetrics::WALLET_NETWORK_ERROR); - wallet_client_->SendAutocheckoutStatus(autofill::SUCCESS, - GURL(kMerchantUrl), - ""); + wallet_client_->SendAutocheckoutStatus( + autofill::SUCCESS, GURL(kMerchantUrl), std::string()); net::TestURLFetcher* fetcher = factory_.GetFetcherByID(0); ASSERT_TRUE(fetcher); fetcher->set_response_code(net::HTTP_UNAUTHORIZED); @@ -840,9 +839,8 @@ TEST_F(WalletClientTest, RequestError) { delegate_.ExpectBaselineMetrics(NO_ESCROW_REQUEST, HAS_WALLET_REQUEST); delegate_.ExpectWalletErrorMetric(AutofillMetrics::WALLET_BAD_REQUEST); - wallet_client_->SendAutocheckoutStatus(autofill::SUCCESS, - GURL(kMerchantUrl), - ""); + wallet_client_->SendAutocheckoutStatus( + autofill::SUCCESS, GURL(kMerchantUrl), std::string()); net::TestURLFetcher* fetcher = factory_.GetFetcherByID(0); ASSERT_TRUE(fetcher); fetcher->set_response_code(net::HTTP_BAD_REQUEST); diff --git a/components/autofill/browser/wallet/wallet_items_unittest.cc b/components/autofill/browser/wallet/wallet_items_unittest.cc index 552a31b..9495d8b 100644 --- a/components/autofill/browser/wallet/wallet_items_unittest.cc +++ b/components/autofill/browser/wallet/wallet_items_unittest.cc @@ -418,7 +418,7 @@ TEST_F(WalletItemsTest, CreateMaskedInstrument) { ASCIIToUTF16("state"), ASCIIToUTF16("postal_code"), ASCIIToUTF16("phone_number"), - "")); + std::string())); std::vector<string16> supported_currencies; supported_currencies.push_back(ASCIIToUTF16("currency")); WalletItems::MaskedInstrument masked_instrument( @@ -520,7 +520,7 @@ TEST_F(WalletItemsTest, CreateWalletItems) { ASCIIToUTF16("state"), ASCIIToUTF16("postal_code"), ASCIIToUTF16("phone_number"), - "")); + std::string())); std::vector<string16> supported_currencies; supported_currencies.push_back(ASCIIToUTF16("currency")); scoped_ptr<WalletItems::MaskedInstrument> masked_instrument( diff --git a/components/autofill/browser/wallet/wallet_signin_helper_unittest.cc b/components/autofill/browser/wallet/wallet_signin_helper_unittest.cc index e574d55..20175b1 100644 --- a/components/autofill/browser/wallet/wallet_signin_helper_unittest.cc +++ b/components/autofill/browser/wallet/wallet_signin_helper_unittest.cc @@ -120,9 +120,10 @@ class WalletSigninHelperTest : public testing::Test { void MockFailedOAuthLoginResponse404() { SetUpFetcherResponseAndCompleteRequest( - GaiaUrls::GetInstance()->client_login_url(), 404, + GaiaUrls::GetInstance()->client_login_url(), + 404, net::ResponseCookies(), - ""); + std::string()); } void MockSuccessfulGaiaUserInfoResponse(const std::string& username) { @@ -134,9 +135,10 @@ class WalletSigninHelperTest : public testing::Test { void MockFailedGaiaUserInfoResponse404() { SetUpFetcherResponseAndCompleteRequest( - GaiaUrls::GetInstance()->get_user_info_url(), 404, + GaiaUrls::GetInstance()->get_user_info_url(), + 404, net::ResponseCookies(), - ""); + std::string()); } void MockSuccessfulGetAccountInfoResponse(const std::string& username) { @@ -150,23 +152,24 @@ class WalletSigninHelperTest : public testing::Test { void MockFailedGetAccountInfoResponse404() { SetUpFetcherResponseAndCompleteRequest( - signin_helper_->GetGetAccountInfoUrlForTesting(), 404, + signin_helper_->GetGetAccountInfoUrlForTesting(), + 404, net::ResponseCookies(), - ""); + std::string()); } void MockSuccessfulPassiveAuthUrlMergeAndRedirectResponse() { - SetUpFetcherResponseAndCompleteRequest( - wallet::GetPassiveAuthUrl().spec(), 200, - net::ResponseCookies(), - ""); + SetUpFetcherResponseAndCompleteRequest(wallet::GetPassiveAuthUrl().spec(), + 200, + net::ResponseCookies(), + std::string()); } void MockFailedPassiveAuthUrlMergeAndRedirectResponse404() { - SetUpFetcherResponseAndCompleteRequest( - wallet::GetPassiveAuthUrl().spec(), 404, - net::ResponseCookies(), - ""); + SetUpFetcherResponseAndCompleteRequest(wallet::GetPassiveAuthUrl().spec(), + 404, + net::ResponseCookies(), + std::string()); } WalletSigninHelperForTesting::State state() const { diff --git a/content/browser/accessibility/accessibility_tree_formatter.cc b/content/browser/accessibility/accessibility_tree_formatter.cc index cbe0629..b1bc110 100644 --- a/content/browser/accessibility/accessibility_tree_formatter.cc +++ b/content/browser/accessibility/accessibility_tree_formatter.cc @@ -80,28 +80,28 @@ void AccessibilityTreeFormatter::Initialize() {} // static const base::FilePath::StringType AccessibilityTreeFormatter::GetActualFileSuffix() { - return FILE_PATH_LITERAL(""); + return FILE_PATH_LITERAL(std::string()); } // static const base::FilePath::StringType AccessibilityTreeFormatter::GetExpectedFileSuffix() { - return FILE_PATH_LITERAL(""); + return FILE_PATH_LITERAL(std::string()); } // static const std::string AccessibilityTreeFormatter::GetAllowEmptyString() { - return ""; + return std::string(); } // static const std::string AccessibilityTreeFormatter::GetAllowString() { - return ""; + return std::string(); } // static const std::string AccessibilityTreeFormatter::GetDenyString() { - return ""; + return std::string(); } #endif diff --git a/content/browser/accessibility/cross_platform_accessibility_browsertest.cc b/content/browser/accessibility/cross_platform_accessibility_browsertest.cc index 9fe99c4..ff5789a 100644 --- a/content/browser/accessibility/cross_platform_accessibility_browsertest.cc +++ b/content/browser/accessibility/cross_platform_accessibility_browsertest.cc @@ -107,7 +107,7 @@ std::string CrossPlatformAccessibilityBrowserTest::GetAttr( if (iter != node.string_attributes.end()) return UTF16ToUTF8(iter->second); else - return ""; + return std::string(); } // Convenience method to get the value of a particular AccessibilityNodeData diff --git a/content/browser/browser_plugin/browser_plugin_guest.cc b/content/browser/browser_plugin/browser_plugin_guest.cc index 14dbc9a..3248afd 100644 --- a/content/browser/browser_plugin/browser_plugin_guest.cc +++ b/content/browser/browser_plugin/browser_plugin_guest.cc @@ -92,7 +92,7 @@ static std::string RetrieveDownloadURLFromRequestId( ResourceDispatcherHostImpl::Get()->GetURLRequest(global_id); if (url_request) return url_request->url().possibly_invalid_spec(); - return ""; + return std::string(); } } diff --git a/content/browser/browser_plugin/browser_plugin_host_browsertest.cc b/content/browser/browser_plugin/browser_plugin_host_browsertest.cc index 23977a5..94568493 100644 --- a/content/browser/browser_plugin/browser_plugin_host_browsertest.cc +++ b/content/browser/browser_plugin/browser_plugin_host_browsertest.cc @@ -388,7 +388,8 @@ IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, TestShortHangTimeoutGuestFactory::GetInstance()); const char kEmbedderURL[] = "files/browser_plugin_embedder_guest_unresponsive.html"; - StartBrowserPluginTest(kEmbedderURL, kHTMLForGuestBusyLoop, true, ""); + StartBrowserPluginTest( + kEmbedderURL, kHTMLForGuestBusyLoop, true, std::string()); // Wait until the busy loop starts. { const string16 expected_title = ASCIIToUTF16("start"); @@ -453,7 +454,7 @@ IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, NavigateAfterResize) { IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, AdvanceFocus) { const char kEmbedderURL[] = "files/browser_plugin_focus.html"; const char* kGuestURL = "files/browser_plugin_focus_child.html"; - StartBrowserPluginTest(kEmbedderURL, kGuestURL, false, ""); + StartBrowserPluginTest(kEmbedderURL, kGuestURL, false, std::string()); SimulateMouseClick(test_embedder()->web_contents(), 0, WebKit::WebMouseEvent::ButtonLeft); @@ -484,7 +485,7 @@ IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, EmbedderChangedAfterSwap) { // 1. Load an embedder page with one guest in it. const char kEmbedderURL[] = "files/browser_plugin_embedder.html"; - StartBrowserPluginTest(kEmbedderURL, kHTMLForGuest, true, ""); + StartBrowserPluginTest(kEmbedderURL, kHTMLForGuest, true, std::string()); // 2. Navigate to a URL in https, so we trigger a RenderViewHost swap. GURL test_https_url(https_server.GetURL( @@ -510,7 +511,7 @@ IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, EmbedderChangedAfterSwap) { // web_contents. IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, EmbedderSameAfterNav) { const char kEmbedderURL[] = "files/browser_plugin_embedder.html"; - StartBrowserPluginTest(kEmbedderURL, kHTMLForGuest, true, ""); + StartBrowserPluginTest(kEmbedderURL, kHTMLForGuest, true, std::string()); WebContentsImpl* embedder_web_contents = test_embedder()->web_contents(); // Navigate to another page in same host and port, so RenderViewHost swap @@ -535,7 +536,7 @@ IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, EmbedderSameAfterNav) { // This test verifies that hiding the embedder also hides the guest. IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, BrowserPluginVisibilityChanged) { const char kEmbedderURL[] = "files/browser_plugin_embedder.html"; - StartBrowserPluginTest(kEmbedderURL, kHTMLForGuest, true, ""); + StartBrowserPluginTest(kEmbedderURL, kHTMLForGuest, true, std::string()); // Hide the Browser Plugin. RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( @@ -549,7 +550,7 @@ IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, BrowserPluginVisibilityChanged) { IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, EmbedderVisibilityChanged) { const char kEmbedderURL[] = "files/browser_plugin_embedder.html"; - StartBrowserPluginTest(kEmbedderURL, kHTMLForGuest, true, ""); + StartBrowserPluginTest(kEmbedderURL, kHTMLForGuest, true, std::string()); // Hide the embedder. test_embedder()->web_contents()->WasHidden(); @@ -561,7 +562,7 @@ IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, EmbedderVisibilityChanged) { // This test verifies that calling the reload method reloads the guest. IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, ReloadGuest) { const char kEmbedderURL[] = "files/browser_plugin_embedder.html"; - StartBrowserPluginTest(kEmbedderURL, kHTMLForGuest, true, ""); + StartBrowserPluginTest(kEmbedderURL, kHTMLForGuest, true, std::string()); test_guest()->ResetUpdateRectCount(); @@ -575,7 +576,7 @@ IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, ReloadGuest) { // to the guest's WebContents. IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, StopGuest) { const char kEmbedderURL[] = "files/browser_plugin_embedder.html"; - StartBrowserPluginTest(kEmbedderURL, kHTMLForGuest, true, ""); + StartBrowserPluginTest(kEmbedderURL, kHTMLForGuest, true, std::string()); RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( test_embedder()->web_contents()->GetRenderViewHost()); @@ -587,7 +588,8 @@ IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, StopGuest) { // plugin correctly updates the touch-event handling state in the embedder. IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, AcceptTouchEvents) { const char kEmbedderURL[] = "files/browser_plugin_embedder.html"; - StartBrowserPluginTest(kEmbedderURL, kHTMLForGuestTouchHandler, true, ""); + StartBrowserPluginTest( + kEmbedderURL, kHTMLForGuestTouchHandler, true, std::string()); RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( test_embedder()->web_contents()->GetRenderViewHost()); @@ -615,7 +617,7 @@ IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, AcceptTouchEvents) { IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, Renavigate) { const char kEmbedderURL[] = "files/browser_plugin_embedder.html"; StartBrowserPluginTest( - kEmbedderURL, GetHTMLForGuestWithTitle("P1"), true, ""); + kEmbedderURL, GetHTMLForGuestWithTitle("P1"), true, std::string()); RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( test_embedder()->web_contents()->GetRenderViewHost()); @@ -710,7 +712,7 @@ IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, Renavigate) { // and that the guest is reset. IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, ReloadEmbedder) { const char kEmbedderURL[] = "files/browser_plugin_embedder.html"; - StartBrowserPluginTest(kEmbedderURL, kHTMLForGuest, true, ""); + StartBrowserPluginTest(kEmbedderURL, kHTMLForGuest, true, std::string()); RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( test_embedder()->web_contents()->GetRenderViewHost()); @@ -761,7 +763,7 @@ IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, ReloadEmbedder) { IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, TerminateGuest) { const char kEmbedderURL[] = "files/browser_plugin_embedder.html"; - StartBrowserPluginTest(kEmbedderURL, kHTMLForGuest, true, ""); + StartBrowserPluginTest(kEmbedderURL, kHTMLForGuest, true, std::string()); RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( test_embedder()->web_contents()->GetRenderViewHost()); @@ -776,7 +778,7 @@ IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, TerminateGuest) { IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, BackAfterTerminateGuest) { const char* kEmbedderURL = "files/browser_plugin_embedder.html"; StartBrowserPluginTest( - kEmbedderURL, GetHTMLForGuestWithTitle("P1"), true, ""); + kEmbedderURL, GetHTMLForGuestWithTitle("P1"), true, std::string()); RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( test_embedder()->web_contents()->GetRenderViewHost()); @@ -818,7 +820,7 @@ IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, BackAfterTerminateGuest) { IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, LoadStart) { const char kEmbedderURL[] = "files/browser_plugin_embedder.html"; - StartBrowserPluginTest(kEmbedderURL, "about:blank", true, ""); + StartBrowserPluginTest(kEmbedderURL, "about:blank", true, std::string()); const string16 expected_title = ASCIIToUTF16(kHTMLForGuest); content::TitleWatcher title_watcher(test_embedder()->web_contents(), @@ -835,7 +837,7 @@ IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, LoadStart) { IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, LoadAbort) { const char kEmbedderURL[] = "files/browser_plugin_embedder.html"; - StartBrowserPluginTest(kEmbedderURL, "about:blank", true, ""); + StartBrowserPluginTest(kEmbedderURL, "about:blank", true, std::string()); { // Navigate the guest to "close-socket". @@ -882,7 +884,7 @@ IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, LoadAbort) { IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, LoadRedirect) { const char kEmbedderURL[] = "files/browser_plugin_embedder.html"; - StartBrowserPluginTest(kEmbedderURL, "about:blank", true, ""); + StartBrowserPluginTest(kEmbedderURL, "about:blank", true, std::string()); const string16 expected_title = ASCIIToUTF16("redirected"); content::TitleWatcher title_watcher(test_embedder()->web_contents(), @@ -922,7 +924,8 @@ IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, LoadRedirect) { // correctly. IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, MAYBE_AcceptDragEvents) { const char kEmbedderURL[] = "files/browser_plugin_dragging.html"; - StartBrowserPluginTest(kEmbedderURL, kHTMLForGuestAcceptDrag, true, ""); + StartBrowserPluginTest( + kEmbedderURL, kHTMLForGuestAcceptDrag, true, std::string()); RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( test_embedder()->web_contents()->GetRenderViewHost()); @@ -978,7 +981,7 @@ IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, PostMessage) { const char* kTesting = "testing123"; const char* kEmbedderURL = "files/browser_plugin_embedder.html"; const char* kGuestURL = "files/browser_plugin_post_message_guest.html"; - StartBrowserPluginTest(kEmbedderURL, kGuestURL, false, ""); + StartBrowserPluginTest(kEmbedderURL, kGuestURL, false, std::string()); RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( test_embedder()->web_contents()->GetRenderViewHost()); { @@ -1006,7 +1009,7 @@ IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, DISABLED_PostMessageToIFrame) { const char* kTesting = "testing123"; const char* kEmbedderURL = "files/browser_plugin_embedder.html"; const char* kGuestURL = "files/browser_plugin_post_message_guest.html"; - StartBrowserPluginTest(kEmbedderURL, kGuestURL, false, ""); + StartBrowserPluginTest(kEmbedderURL, kGuestURL, false, std::string()); RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( test_embedder()->web_contents()->GetRenderViewHost()); { @@ -1052,7 +1055,7 @@ IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, DISABLED_PostMessageToIFrame) { IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, LoadStop) { const char* kEmbedderURL = "files/browser_plugin_embedder.html"; - StartBrowserPluginTest(kEmbedderURL, "about:blank", true, ""); + StartBrowserPluginTest(kEmbedderURL, "about:blank", true, std::string()); const string16 expected_title = ASCIIToUTF16("loadStop"); content::TitleWatcher title_watcher( @@ -1069,7 +1072,7 @@ IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, LoadStop) { IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, LoadCommit) { const char* kEmbedderURL = "files/browser_plugin_embedder.html"; - StartBrowserPluginTest(kEmbedderURL, "about:blank", true, ""); + StartBrowserPluginTest(kEmbedderURL, "about:blank", true, std::string()); const string16 expected_title = ASCIIToUTF16( base::StringPrintf("loadCommit:%s", kHTMLForGuest)); @@ -1105,7 +1108,7 @@ IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, HiddenBeforeNavigation) { // the new guest will inherit the visibility state of the old guest. IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, VisibilityPreservation) { const char* kEmbedderURL = "files/browser_plugin_embedder.html"; - StartBrowserPluginTest(kEmbedderURL, kHTMLForGuest, true, ""); + StartBrowserPluginTest(kEmbedderURL, kHTMLForGuest, true, std::string()); RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( test_embedder()->web_contents()->GetRenderViewHost()); // Hide the BrowserPlugin. @@ -1145,7 +1148,7 @@ IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, FocusBeforeNavigation) { // crbug.com/170249 IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, DISABLED_FocusPreservation) { const char* kEmbedderURL = "files/browser_plugin_embedder.html"; - StartBrowserPluginTest(kEmbedderURL, kHTMLForGuest, true, ""); + StartBrowserPluginTest(kEmbedderURL, kHTMLForGuest, true, std::string()); RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( test_embedder()->web_contents()->GetRenderViewHost()); RenderViewHostImpl* guest_rvh = static_cast<RenderViewHostImpl*>( @@ -1184,7 +1187,7 @@ IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, DISABLED_FocusPreservation) { IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, FocusTracksEmbedder) { const char* kEmbedderURL = "files/browser_plugin_embedder.html"; - StartBrowserPluginTest(kEmbedderURL, kHTMLForGuest, true, ""); + StartBrowserPluginTest(kEmbedderURL, kHTMLForGuest, true, std::string()); RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( test_embedder()->web_contents()->GetRenderViewHost()); RenderViewHostImpl* guest_rvh = static_cast<RenderViewHostImpl*>( @@ -1229,7 +1232,7 @@ IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, AutoSizeBeforeNavigation) { IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, AutoSizeAfterNavigation) { const char* kEmbedderURL = "files/browser_plugin_embedder.html"; StartBrowserPluginTest( - kEmbedderURL, kHTMLForGuestWithSize, true, ""); + kEmbedderURL, kHTMLForGuestWithSize, true, std::string()); RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( test_embedder()->web_contents()->GetRenderViewHost()); @@ -1283,7 +1286,7 @@ IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, GetRenderViewHostAtPositionTest) { IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, ChangeWindowName) { const char kEmbedderURL[] = "files/browser_plugin_naming_embedder.html"; const char* kGuestURL = "files/browser_plugin_naming_guest.html"; - StartBrowserPluginTest(kEmbedderURL, kGuestURL, false, ""); + StartBrowserPluginTest(kEmbedderURL, kGuestURL, false, std::string()); RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( test_embedder()->web_contents()->GetRenderViewHost()); diff --git a/content/browser/database_browsertest.cc b/content/browser/database_browsertest.cc index 48f7304..29030ad 100644 --- a/content/browser/database_browsertest.cc +++ b/content/browser/database_browsertest.cc @@ -102,7 +102,7 @@ IN_PROC_BROWSER_TEST_F(DatabaseTest, DeleteRecord) { CreateTable(shell()); InsertRecord(shell(), "text"); DeleteRecord(shell(), 0); - CompareRecords(shell(), ""); + CompareRecords(shell(), std::string()); InsertRecord(shell(), "0"); InsertRecord(shell(), "1"); @@ -151,12 +151,12 @@ IN_PROC_BROWSER_TEST_F(DatabaseTest, DatabaseOperations) { for (int i = 0; i < 10; ++i) DeleteRecord(shell(), 0); - CompareRecords(shell(), ""); + CompareRecords(shell(), std::string()); RunScriptAndCheckResult( shell(), "deleteRecord(1)", "could not find row with index: 1"); - CompareRecords(shell(), ""); + CompareRecords(shell(), std::string()); } // Create records in the database and verify they persist after reload. @@ -186,7 +186,7 @@ IN_PROC_BROWSER_TEST_F(DatabaseTest, OffTheRecordCannotReadRegularDatabase) { ASSERT_FALSE(HasTable(otr)); CreateTable(otr); - CompareRecords(otr, ""); + CompareRecords(otr, std::string()); } // Attempt to read a database created in an off the record browser from a @@ -200,7 +200,7 @@ IN_PROC_BROWSER_TEST_F(DatabaseTest, RegularCannotReadOffTheRecordDatabase) { Navigate(shell()); ASSERT_FALSE(HasTable(shell())); CreateTable(shell()); - CompareRecords(shell(), ""); + CompareRecords(shell(), std::string()); } // Verify DB changes within first window are present in the second window. diff --git a/content/browser/devtools/devtools_http_handler_impl.cc b/content/browser/devtools/devtools_http_handler_impl.cc index 414785e..4869c2b 100644 --- a/content/browser/devtools/devtools_http_handler_impl.cc +++ b/content/browser/devtools/devtools_http_handler_impl.cc @@ -459,7 +459,7 @@ void DevToolsHttpHandlerImpl::OnJsonRequestUI( content::GetContentClient()->GetProduct()); version.SetString("User-Agent", webkit_glue::GetUserAgent(GURL(chrome::kAboutBlankURL))); - SendJson(connection_id, net::HTTP_OK, &version, ""); + SendJson(connection_id, net::HTTP_OK, &version, std::string()); return; } @@ -506,7 +506,7 @@ void DevToolsHttpHandlerImpl::OnJsonRequestUI( } std::string host = info.headers["Host"]; scoped_ptr<base::DictionaryValue> dictionary(SerializePageInfo(rvh, host)); - SendJson(connection_id, net::HTTP_OK, dictionary.get(), ""); + SendJson(connection_id, net::HTTP_OK, dictionary.get(), std::string()); return; } @@ -552,7 +552,7 @@ void DevToolsHttpHandlerImpl::CollectWorkerInfo(ListValue* target_list, void DevToolsHttpHandlerImpl::SendTargetList(int connection_id, ListValue* target_list) { - SendJson(connection_id, net::HTTP_OK, target_list, ""); + SendJson(connection_id, net::HTTP_OK, target_list, std::string()); delete target_list; Release(); // Balanced OnJsonRequestUI. } diff --git a/content/browser/devtools/devtools_http_handler_unittest.cc b/content/browser/devtools/devtools_http_handler_unittest.cc index 839ef60..c926015 100644 --- a/content/browser/devtools/devtools_http_handler_unittest.cc +++ b/content/browser/devtools/devtools_http_handler_unittest.cc @@ -56,20 +56,20 @@ class DummyListenSocketFactory : public net::StreamListenSocketFactory { class DummyDelegate : public DevToolsHttpHandlerDelegate { public: - virtual std::string GetDiscoveryPageHTML() OVERRIDE { return ""; } + virtual std::string GetDiscoveryPageHTML() OVERRIDE { return std::string(); } virtual bool BundlesFrontendResources() OVERRIDE { return true; } virtual base::FilePath GetDebugFrontendDir() OVERRIDE { return base::FilePath(); } virtual std::string GetPageThumbnailData(const GURL& url) OVERRIDE { - return ""; + return std::string(); } virtual RenderViewHost* CreateNewTarget() OVERRIDE { return NULL; } virtual TargetType GetTargetType(RenderViewHost*) OVERRIDE { return kTargetTypeTab; } virtual std::string GetViewDescription(content::RenderViewHost*) OVERRIDE { - return ""; + return std::string(); } }; @@ -98,9 +98,9 @@ TEST_F(DevToolsHttpHandlerTest, TestStartStop) { base::RunLoop run_loop, run_loop_2; content::DevToolsHttpHandler* devtools_http_handler_ = content::DevToolsHttpHandler::Start( - new DummyListenSocketFactory( - run_loop.QuitClosure(), run_loop_2.QuitClosure()), - "", + new DummyListenSocketFactory(run_loop.QuitClosure(), + run_loop_2.QuitClosure()), + std::string(), new DummyDelegate()); // Our dummy socket factory will post a quit message once the server will // become ready. diff --git a/content/browser/devtools/renderer_overrides_handler.cc b/content/browser/devtools/renderer_overrides_handler.cc index 94395d1..f7db2e8 100644 --- a/content/browser/devtools/renderer_overrides_handler.cc +++ b/content/browser/devtools/renderer_overrides_handler.cc @@ -145,8 +145,8 @@ RendererOverridesHandler::PageNavigate( if (host) { WebContents* web_contents = host->GetDelegate()->GetAsWebContents(); if (web_contents) { - web_contents->GetController().LoadURL( - gurl, Referrer(), PAGE_TRANSITION_TYPED, ""); + web_contents->GetController() + .LoadURL(gurl, Referrer(), PAGE_TRANSITION_TYPED, std::string()); return command->SuccessResponse(new base::DictionaryValue()); } } diff --git a/content/browser/download/base_file.cc b/content/browser/download/base_file.cc index b5ded45..0b1db97 100644 --- a/content/browser/download/base_file.cc +++ b/content/browser/download/base_file.cc @@ -232,11 +232,11 @@ bool BaseFile::GetHash(std::string* hash) { std::string BaseFile::GetHashState() { if (!calculate_hash_) - return ""; + return std::string(); Pickle hash_state; if (!secure_hash_->Serialize(&hash_state)) - return ""; + return std::string(); return std::string(reinterpret_cast<const char*>(hash_state.data()), hash_state.size()); diff --git a/content/browser/download/base_file_unittest.cc b/content/browser/download/base_file_unittest.cc index 799076d..0e6239f 100644 --- a/content/browser/download/base_file_unittest.cc +++ b/content/browser/download/base_file_unittest.cc @@ -54,7 +54,7 @@ class BaseFileTest : public testing::Test { GURL(), 0, false, - "", + std::string(), scoped_ptr<net::FileStream>(), net::BoundNetLog())); } @@ -105,7 +105,7 @@ class BaseFileTest : public testing::Test { GURL(), 0, true, - "", + std::string(), scoped_ptr<net::FileStream>(), net::BoundNetLog())); } @@ -145,7 +145,7 @@ class BaseFileTest : public testing::Test { GURL(), 0, false, - "", + std::string(), scoped_ptr<net::FileStream>(), net::BoundNetLog()); @@ -171,7 +171,7 @@ class BaseFileTest : public testing::Test { GURL(), 0, false, - "", + std::string(), scoped_ptr<net::FileStream>(), net::BoundNetLog()); EXPECT_EQ(DOWNLOAD_INTERRUPT_REASON_NONE, @@ -503,7 +503,7 @@ TEST_F(BaseFileTest, MultipleWritesWithError) { GURL(), 0, false, - "", + std::string(), mock_file_stream_scoped_ptr.Pass(), net::BoundNetLog())); ASSERT_TRUE(InitializeFile()); @@ -550,7 +550,7 @@ TEST_F(BaseFileTest, AppendToBaseFile) { GURL(), kTestDataLength4, false, - "", + std::string(), scoped_ptr<net::FileStream>(), net::BoundNetLog())); @@ -584,7 +584,7 @@ TEST_F(BaseFileTest, ReadonlyBaseFile) { GURL(), 0, false, - "", + std::string(), scoped_ptr<net::FileStream>(), net::BoundNetLog())); @@ -609,7 +609,7 @@ TEST_F(BaseFileTest, IsEmptyHash) { EXPECT_TRUE(BaseFile::IsEmptyHash(empty)); std::string not_empty(BaseFile::kSha256HashLen, '\x01'); EXPECT_FALSE(BaseFile::IsEmptyHash(not_empty)); - EXPECT_FALSE(BaseFile::IsEmptyHash("")); + EXPECT_FALSE(BaseFile::IsEmptyHash(std::string())); } // Test that calculating speed after no writes. diff --git a/content/browser/download/download_file_impl.cc b/content/browser/download/download_file_impl.cc index ab95900..a16fbe8 100644 --- a/content/browser/download/download_file_impl.cc +++ b/content/browser/download/download_file_impl.cc @@ -108,8 +108,8 @@ void DownloadFileImpl::RenameAndUniquify( base::FilePath new_path(full_path); - int uniquifier = - file_util::GetUniquePathNumber(new_path, FILE_PATH_LITERAL("")); + int uniquifier = file_util::GetUniquePathNumber( + new_path, FILE_PATH_LITERAL(std::string())); if (uniquifier > 0) { new_path = new_path.InsertBeforeExtensionASCII( base::StringPrintf(" (%d)", uniquifier)); diff --git a/content/browser/download/download_item_impl_unittest.cc b/content/browser/download/download_item_impl_unittest.cc index 83b0cf0..caee4ae 100644 --- a/content/browser/download/download_item_impl_unittest.cc +++ b/content/browser/download/download_item_impl_unittest.cc @@ -344,7 +344,7 @@ TEST_F(DownloadItemTest, NotificationAfterUpdate) { DownloadItemImpl* item = CreateDownloadItem(); MockObserver observer(item); - item->UpdateProgress(kDownloadChunkSize, kDownloadSpeed, ""); + item->UpdateProgress(kDownloadChunkSize, kDownloadSpeed, std::string()); ASSERT_TRUE(observer.CheckUpdated()); EXPECT_EQ(kDownloadSpeed, item->CurrentSpeed()); } @@ -545,7 +545,7 @@ TEST_F(DownloadItemTest, NotificationAfterOnContentCheckCompleted) { DownloadItemImpl* safe_item = CreateDownloadItem(); MockObserver safe_observer(safe_item); - safe_item->OnAllDataSaved(""); + safe_item->OnAllDataSaved(std::string()); EXPECT_TRUE(safe_observer.CheckUpdated()); safe_item->OnContentCheckCompleted(DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS); EXPECT_TRUE(safe_observer.CheckUpdated()); @@ -555,7 +555,7 @@ TEST_F(DownloadItemTest, NotificationAfterOnContentCheckCompleted) { CreateDownloadItem(); MockObserver unsafeurl_observer(unsafeurl_item); - unsafeurl_item->OnAllDataSaved(""); + unsafeurl_item->OnAllDataSaved(std::string()); EXPECT_TRUE(unsafeurl_observer.CheckUpdated()); unsafeurl_item->OnContentCheckCompleted(DOWNLOAD_DANGER_TYPE_DANGEROUS_URL); EXPECT_TRUE(unsafeurl_observer.CheckUpdated()); @@ -567,7 +567,7 @@ TEST_F(DownloadItemTest, NotificationAfterOnContentCheckCompleted) { CreateDownloadItem(); MockObserver unsafefile_observer(unsafefile_item); - unsafefile_item->OnAllDataSaved(""); + unsafefile_item->OnAllDataSaved(std::string()); EXPECT_TRUE(unsafefile_observer.CheckUpdated()); unsafefile_item->OnContentCheckCompleted(DOWNLOAD_DANGER_TYPE_DANGEROUS_FILE); EXPECT_TRUE(unsafefile_observer.CheckUpdated()); @@ -697,7 +697,7 @@ TEST_F(DownloadItemTest, CallbackAfterRename) { .WillOnce(ScheduleRenameCallback(DOWNLOAD_INTERRUPT_REASON_NONE, final_path)); EXPECT_CALL(*download_file, Detach()); - item->DestinationObserverAsWeakPtr()->DestinationCompleted(""); + item->DestinationObserverAsWeakPtr()->DestinationCompleted(std::string()); RunAllPendingInMessageLoops(); ::testing::Mock::VerifyAndClearExpectations(download_file); mock_delegate()->VerifyAndClearExpectations(); @@ -862,7 +862,7 @@ TEST_F(DownloadItemTest, EnabledActionsForNormalDownload) { EXPECT_CALL(*mock_delegate(), ShouldCompleteDownload(item, _)) .WillOnce(Return(true)); EXPECT_CALL(*download_file, Detach()); - item->DestinationObserverAsWeakPtr()->DestinationCompleted(""); + item->DestinationObserverAsWeakPtr()->DestinationCompleted(std::string()); RunAllPendingInMessageLoops(); ASSERT_TRUE(item->IsComplete()); @@ -889,7 +889,7 @@ TEST_F(DownloadItemTest, EnabledActionsForTemporaryDownload) { .WillOnce(ScheduleRenameCallback(DOWNLOAD_INTERRUPT_REASON_NONE, base::FilePath(kDummyPath))); EXPECT_CALL(*download_file, Detach()); - item->DestinationObserverAsWeakPtr()->DestinationCompleted(""); + item->DestinationObserverAsWeakPtr()->DestinationCompleted(std::string()); RunAllPendingInMessageLoops(); ASSERT_TRUE(item->IsComplete()); @@ -937,7 +937,7 @@ TEST_F(DownloadItemTest, CompleteDelegate_ReturnTrue) { // Drive the delegate interaction. EXPECT_CALL(*mock_delegate(), ShouldCompleteDownload(item, _)) .WillOnce(Return(true)); - item->DestinationObserverAsWeakPtr()->DestinationCompleted(""); + item->DestinationObserverAsWeakPtr()->DestinationCompleted(std::string()); EXPECT_EQ(DownloadItem::IN_PROGRESS, item->GetState()); EXPECT_FALSE(item->IsDangerous()); @@ -966,7 +966,7 @@ TEST_F(DownloadItemTest, CompleteDelegate_BlockOnce) { .WillOnce(DoAll(SaveArg<1>(&delegate_callback), Return(false))) .WillOnce(Return(true)); - item->DestinationObserverAsWeakPtr()->DestinationCompleted(""); + item->DestinationObserverAsWeakPtr()->DestinationCompleted(std::string()); ASSERT_FALSE(delegate_callback.is_null()); copy_delegate_callback = delegate_callback; delegate_callback.Reset(); @@ -1001,7 +1001,7 @@ TEST_F(DownloadItemTest, CompleteDelegate_SetDanger) { .WillOnce(DoAll(SaveArg<1>(&delegate_callback), Return(false))) .WillOnce(Return(true)); - item->DestinationObserverAsWeakPtr()->DestinationCompleted(""); + item->DestinationObserverAsWeakPtr()->DestinationCompleted(std::string()); ASSERT_FALSE(delegate_callback.is_null()); copy_delegate_callback = delegate_callback; delegate_callback.Reset(); @@ -1047,7 +1047,7 @@ TEST_F(DownloadItemTest, CompleteDelegate_BlockTwice) { .WillOnce(DoAll(SaveArg<1>(&delegate_callback), Return(false))) .WillOnce(Return(true)); - item->DestinationObserverAsWeakPtr()->DestinationCompleted(""); + item->DestinationObserverAsWeakPtr()->DestinationCompleted(std::string()); ASSERT_FALSE(delegate_callback.is_null()); copy_delegate_callback = delegate_callback; delegate_callback.Reset(); diff --git a/content/browser/download/download_manager_impl_unittest.cc b/content/browser/download/download_manager_impl_unittest.cc index 4a33159..e08402e 100644 --- a/content/browser/download/download_manager_impl_unittest.cc +++ b/content/browser/download/download_manager_impl_unittest.cc @@ -169,7 +169,9 @@ class MockDownloadItemImpl : public DownloadItemImpl { MOCK_CONST_METHOD0(GetUserVerifiedFilePath, base::FilePath()); MOCK_METHOD0(NotifyRemoved, void()); // May be called when vlog is on. - virtual std::string DebugString(bool verbose) const OVERRIDE { return ""; } + virtual std::string DebugString(bool verbose) const OVERRIDE { + return std::string(); + } }; class MockDownloadManagerDelegate : public DownloadManagerDelegate { diff --git a/content/browser/download/download_stats.cc b/content/browser/download/download_stats.cc index cad6cbe..e13200e 100644 --- a/content/browser/download/download_stats.cc +++ b/content/browser/download/download_stats.cc @@ -305,8 +305,8 @@ void RecordDownloadContentDisposition( const std::string& content_disposition_string) { if (content_disposition_string.empty()) return; - net::HttpContentDisposition content_disposition( - content_disposition_string, ""); + net::HttpContentDisposition content_disposition(content_disposition_string, + std::string()); int result = content_disposition.parse_result_flags(); bool is_valid = !content_disposition.filename().empty(); diff --git a/content/browser/download/save_file.cc b/content/browser/download/save_file.cc index 3e7f7bd..80caf13 100644 --- a/content/browser/download/save_file.cc +++ b/content/browser/download/save_file.cc @@ -20,7 +20,7 @@ SaveFile::SaveFile(const SaveFileCreateInfo* info, bool calculate_hash) GURL(), 0, calculate_hash, - "", + std::string(), scoped_ptr<net::FileStream>(), net::BoundNetLog()), info_(info) { diff --git a/content/browser/download/save_package.cc b/content/browser/download/save_package.cc index cbff60a..f97d2d6 100644 --- a/content/browser/download/save_package.cc +++ b/content/browser/download/save_package.cc @@ -365,7 +365,7 @@ void SavePackage::OnMHTMLGenerated(const base::FilePath& path, int64 size) { // with SavePackage flow. if (download_->IsInProgress()) { download_->SetTotalBytes(size); - download_->UpdateProgress(size, 0, ""); + download_->UpdateProgress(size, 0, std::string()); // Must call OnAllDataSaved here in order for // GDataDownloadObserver::ShouldUpload() to return true. // ShouldCompleteDownload() may depend on the gdata uploader to finish. @@ -449,7 +449,11 @@ bool SavePackage::GenerateFileName(const std::string& disposition, base::FilePath::StringType* generated_name) { // TODO(jungshik): Figure out the referrer charset when having one // makes sense and pass it to GenerateFileName. - base::FilePath file_path = net::GenerateFileName(url, disposition, "", "", "", + base::FilePath file_path = net::GenerateFileName(url, + disposition, + std::string(), + std::string(), + std::string(), kDefaultSaveName); DCHECK(!file_path.empty()); @@ -788,7 +792,8 @@ void SavePackage::Finish() { // with SavePackage flow. if (download_->IsInProgress()) { if (save_type_ != SAVE_PAGE_TYPE_AS_MHTML) { - download_->UpdateProgress(all_save_items_count_, CurrentSpeed(), ""); + download_->UpdateProgress( + all_save_items_count_, CurrentSpeed(), std::string()); download_->OnAllDataSaved(DownloadItem::kEmptyFileHash); } download_->MarkAsComplete(); @@ -818,7 +823,7 @@ void SavePackage::SaveFinished(int32 save_id, int64 size, bool is_success) { // TODO(rdsmith/benjhayden): Integrate canceling on DownloadItem // with SavePackage flow. if (download_ && download_->IsInProgress()) - download_->UpdateProgress(completed_count(), CurrentSpeed(), ""); + download_->UpdateProgress(completed_count(), CurrentSpeed(), std::string()); if (save_item->save_source() == SaveFileCreateInfo::SAVE_FILE_FROM_DOM && save_item->url() == page_url_ && !save_item->received_bytes()) { @@ -863,7 +868,7 @@ void SavePackage::SaveFailed(const GURL& save_url) { // TODO(rdsmith/benjhayden): Integrate canceling on DownloadItem // with SavePackage flow. if (download_ && download_->IsInProgress()) - download_->UpdateProgress(completed_count(), CurrentSpeed(), ""); + download_->UpdateProgress(completed_count(), CurrentSpeed(), std::string()); if ((save_type_ == SAVE_PAGE_TYPE_AS_ONLY_HTML) || (save_type_ == SAVE_PAGE_TYPE_AS_MHTML) || diff --git a/content/browser/download/save_package_unittest.cc b/content/browser/download/save_package_unittest.cc index b5a07ae..e40af08 100644 --- a/content/browser/download/save_package_unittest.cc +++ b/content/browser/download/save_package_unittest.cc @@ -221,20 +221,21 @@ TEST_F(SavePackageTest, MAYBE_TestLongSavePackageFilename) { base::FilePath::StringType filename; // Test that the filename is successfully shortened to fit. - ASSERT_TRUE(GetGeneratedFilename(true, "", url, false, &filename)); + ASSERT_TRUE(GetGeneratedFilename(true, std::string(), url, false, &filename)); EXPECT_TRUE(filename.length() < long_file.length()); EXPECT_FALSE(HasOrdinalNumber(filename)); // Test that the filename is successfully shortened to fit, and gets an // an ordinal appended. - ASSERT_TRUE(GetGeneratedFilename(true, "", url, false, &filename)); + ASSERT_TRUE(GetGeneratedFilename(true, std::string(), url, false, &filename)); EXPECT_TRUE(filename.length() < long_file.length()); EXPECT_TRUE(HasOrdinalNumber(filename)); // Test that the filename is successfully shortened to fit, and gets a // different ordinal appended. base::FilePath::StringType filename2; - ASSERT_TRUE(GetGeneratedFilename(true, "", url, false, &filename2)); + ASSERT_TRUE( + GetGeneratedFilename(true, std::string(), url, false, &filename2)); EXPECT_TRUE(filename2.length() < long_file.length()); EXPECT_TRUE(HasOrdinalNumber(filename2)); EXPECT_NE(filename, filename2); diff --git a/content/browser/geolocation/network_location_provider_unittest.cc b/content/browser/geolocation/network_location_provider_unittest.cc index fb01795..3b91466 100644 --- a/content/browser/geolocation/network_location_provider_unittest.cc +++ b/content/browser/geolocation/network_location_provider_unittest.cc @@ -344,7 +344,7 @@ TEST_F(GeolocationNetworkProviderTest, StartProvider) { EXPECT_TRUE(provider->StartProvider(false)); net::TestURLFetcher* fetcher = get_url_fetcher_and_advance_id(); ASSERT_TRUE(fetcher != NULL); - CheckRequestIsValid(*fetcher, 0, 0, 0, ""); + CheckRequestIsValid(*fetcher, 0, 0, 0, std::string()); } TEST_F(GeolocationNetworkProviderTest, StartProviderDefaultUrl) { @@ -353,10 +353,9 @@ TEST_F(GeolocationNetworkProviderTest, StartProviderDefaultUrl) { EXPECT_TRUE(provider->StartProvider(false)); net::TestURLFetcher* fetcher = get_url_fetcher_and_advance_id(); ASSERT_TRUE(fetcher != NULL); - CheckRequestIsValid(*fetcher, 0, 0, 0, ""); + CheckRequestIsValid(*fetcher, 0, 0, 0, std::string()); } - TEST_F(GeolocationNetworkProviderTest, StartProviderLongRequest) { scoped_ptr<LocationProviderBase> provider(CreateProvider(true)); EXPECT_TRUE(provider->StartProvider(false)); @@ -369,7 +368,7 @@ TEST_F(GeolocationNetworkProviderTest, StartProviderLongRequest) { // in length by not including access points with the lowest signal strength // in the request. EXPECT_LT(fetcher->GetOriginalURL().spec().size(), size_t(2048)); - CheckRequestIsValid(*fetcher, 0, 16, 4, ""); + CheckRequestIsValid(*fetcher, 0, 16, 4, std::string()); } TEST_F(GeolocationNetworkProviderTest, MultiRegistrations) { @@ -418,7 +417,7 @@ TEST_F(GeolocationNetworkProviderTest, MultipleWifiScansComplete) { fetcher = get_url_fetcher_and_advance_id(); ASSERT_TRUE(fetcher != NULL); // The request should have the wifi data. - CheckRequestIsValid(*fetcher, 0, kFirstScanAps, 0, ""); + CheckRequestIsValid(*fetcher, 0, kFirstScanAps, 0, std::string()); // Send a reply with good position fix. const char* kReferenceNetworkResponse = @@ -472,7 +471,7 @@ TEST_F(GeolocationNetworkProviderTest, MultipleWifiScansComplete) { fetcher->set_url(test_server_url_); fetcher->set_status(net::URLRequestStatus(net::URLRequestStatus::FAILED, -1)); fetcher->set_response_code(200); // should be ignored - fetcher->SetResponseString(""); + fetcher->SetResponseString(std::string()); fetcher->delegate()->OnURLFetchComplete(fetcher); // Error means we now no longer have a fix. diff --git a/content/browser/geolocation/wifi_data_provider_linux.cc b/content/browser/geolocation/wifi_data_provider_linux.cc index 709063a..c8d68ac 100644 --- a/content/browser/geolocation/wifi_data_provider_linux.cc +++ b/content/browser/geolocation/wifi_data_provider_linux.cc @@ -270,7 +270,7 @@ bool NetworkManagerWlanApi::GetAccessPointsForAdapter( continue; } - ReplaceSubstringsAfterOffset(&mac, 0U, ":", ""); + ReplaceSubstringsAfterOffset(&mac, 0U, ":", std::string()); std::vector<uint8> mac_bytes; if (!base::HexStringToBytes(mac, &mac_bytes) || mac_bytes.size() != 6) { LOG(WARNING) << "Can't parse mac address (found " << mac_bytes.size() diff --git a/content/browser/gpu/gpu_control_list.cc b/content/browser/gpu/gpu_control_list.cc index 3592505..0fba7c8 100644 --- a/content/browser/gpu/gpu_control_list.cc +++ b/content/browser/gpu/gpu_control_list.cc @@ -217,8 +217,8 @@ GpuControlList::OsInfo::OsInfo(const std::string& os, const std::string& version_string2) { type_ = StringToOsType(os); if (type_ != kOsUnknown) { - version_info_.reset( - new VersionInfo(version_op, "", version_string, version_string2)); + version_info_.reset(new VersionInfo( + version_op, std::string(), version_string, version_string2)); } } @@ -265,8 +265,8 @@ GpuControlList::MachineModelInfo::MachineModelInfo( const std::string& version_string, const std::string& version_string2) { name_info_.reset(new StringInfo(name_op, name_value)); - version_info_.reset( - new VersionInfo(version_op, "", version_string, version_string2)); + version_info_.reset(new VersionInfo( + version_op, std::string(), version_string, version_string2)); } GpuControlList::MachineModelInfo::~MachineModelInfo() {} @@ -864,7 +864,7 @@ bool GpuControlList::GpuControlListEntry::SetDriverDateInfo( const std::string& date_string, const std::string& date_string2) { driver_date_info_.reset( - new VersionInfo(date_op, "", date_string, date_string2)); + new VersionInfo(date_op, std::string(), date_string, date_string2)); return driver_date_info_->IsValid(); } @@ -1348,8 +1348,8 @@ GpuControlList::IsEntrySupportedByCurrentBrowserVersion( browser_version_value->GetString("number", &version_string); browser_version_value->GetString("number2", &version_string2); scoped_ptr<VersionInfo> browser_version_info; - browser_version_info.reset( - new VersionInfo(version_op, "", version_string, version_string2)); + browser_version_info.reset(new VersionInfo( + version_op, std::string(), version_string, version_string2)); if (!browser_version_info->IsValid()) return kMalformed; if (browser_version_info->Contains(browser_version_)) diff --git a/content/browser/gpu/gpu_control_list_machine_model_info_unittest.cc b/content/browser/gpu/gpu_control_list_machine_model_info_unittest.cc index b8c3b1f..8d00a33 100644 --- a/content/browser/gpu/gpu_control_list_machine_model_info_unittest.cc +++ b/content/browser/gpu/gpu_control_list_machine_model_info_unittest.cc @@ -47,8 +47,7 @@ TEST_F(MachineModelInfoTest, ValidModelInfo) { } TEST_F(MachineModelInfoTest, ModelComparison) { - MachineModelInfo info("=", "model_a", - ">", "3.4", ""); + MachineModelInfo info("=", "model_a", ">", "3.4", std::string()); EXPECT_TRUE(info.Contains("model_a", "4")); EXPECT_FALSE(info.Contains("model_b", "4")); EXPECT_FALSE(info.Contains("model_a", "3.2")); diff --git a/content/browser/gpu/gpu_control_list_number_info_unittest.cc b/content/browser/gpu/gpu_control_list_number_info_unittest.cc index f4e0ba6..0cb72a7 100644 --- a/content/browser/gpu/gpu_control_list_number_info_unittest.cc +++ b/content/browser/gpu/gpu_control_list_number_info_unittest.cc @@ -46,7 +46,7 @@ TEST_F(NumberInfoTest, ValidFloatInfo) { "-2.14", }; for (size_t i = 0; i < arraysize(value); ++i) { - FloatInfo info("=", value[i], ""); + FloatInfo info("=", value[i], std::string()); EXPECT_TRUE(info.IsValid()); } } @@ -60,11 +60,11 @@ TEST_F(NumberInfoTest, InvalidFloatInfo) { ">=", }; for (size_t i = 0; i < arraysize(op); ++i) { - FloatInfo info(op[i], "", ""); + FloatInfo info(op[i], std::string(), std::string()); EXPECT_FALSE(info.IsValid()); } { - FloatInfo info("between", "3.14", ""); + FloatInfo info("between", "3.14", std::string()); EXPECT_FALSE(info.IsValid()); } const std::string value[] = { @@ -75,33 +75,33 @@ TEST_F(NumberInfoTest, InvalidFloatInfo) { "- 2.14", }; for (size_t i = 0; i < arraysize(value); ++i) { - FloatInfo info("=", value[i], ""); + FloatInfo info("=", value[i], std::string()); EXPECT_FALSE(info.IsValid()); } } TEST_F(NumberInfoTest, FloatComparison) { { - FloatInfo info("=", "3.14", ""); + FloatInfo info("=", "3.14", std::string()); EXPECT_TRUE(info.Contains(3.14f)); EXPECT_TRUE(info.Contains(3.1400f)); EXPECT_FALSE(info.Contains(3.1f)); EXPECT_FALSE(info.Contains(3)); } { - FloatInfo info(">", "3.14", ""); + FloatInfo info(">", "3.14", std::string()); EXPECT_FALSE(info.Contains(3.14f)); EXPECT_TRUE(info.Contains(3.141f)); EXPECT_FALSE(info.Contains(3.1f)); } { - FloatInfo info("<=", "3.14", ""); + FloatInfo info("<=", "3.14", std::string()); EXPECT_TRUE(info.Contains(3.14f)); EXPECT_FALSE(info.Contains(3.141f)); EXPECT_TRUE(info.Contains(3.1f)); } { - FloatInfo info("any", "", ""); + FloatInfo info("any", std::string(), std::string()); EXPECT_TRUE(info.Contains(3.14f)); } { @@ -140,7 +140,7 @@ TEST_F(NumberInfoTest, ValidIntInfo) { "-12", }; for (size_t i = 0; i < arraysize(value); ++i) { - IntInfo info("=", value[i], ""); + IntInfo info("=", value[i], std::string()); EXPECT_TRUE(info.IsValid()); } } @@ -154,11 +154,11 @@ TEST_F(NumberInfoTest, InvalidIntInfo) { ">=", }; for (size_t i = 0; i < arraysize(op); ++i) { - IntInfo info(op[i], "", ""); + IntInfo info(op[i], std::string(), std::string()); EXPECT_FALSE(info.IsValid()); } { - IntInfo info("between", "3", ""); + IntInfo info("between", "3", std::string()); EXPECT_FALSE(info.IsValid()); } const std::string value[] = { @@ -169,31 +169,31 @@ TEST_F(NumberInfoTest, InvalidIntInfo) { "3.14" }; for (size_t i = 0; i < arraysize(value); ++i) { - IntInfo info("=", value[i], ""); + IntInfo info("=", value[i], std::string()); EXPECT_FALSE(info.IsValid()); } } TEST_F(NumberInfoTest, IntComparison) { { - IntInfo info("=", "3", ""); + IntInfo info("=", "3", std::string()); EXPECT_TRUE(info.Contains(3)); EXPECT_FALSE(info.Contains(4)); } { - IntInfo info(">", "3", ""); + IntInfo info(">", "3", std::string()); EXPECT_FALSE(info.Contains(2)); EXPECT_FALSE(info.Contains(3)); EXPECT_TRUE(info.Contains(4)); } { - IntInfo info("<=", "3", ""); + IntInfo info("<=", "3", std::string()); EXPECT_TRUE(info.Contains(2)); EXPECT_TRUE(info.Contains(3)); EXPECT_FALSE(info.Contains(4)); } { - IntInfo info("any", "", ""); + IntInfo info("any", std::string(), std::string()); EXPECT_TRUE(info.Contains(3)); } { diff --git a/content/browser/gpu/gpu_control_list_os_info_unittest.cc b/content/browser/gpu/gpu_control_list_os_info_unittest.cc index 8aefb03..5ea03b2 100644 --- a/content/browser/gpu/gpu_control_list_os_info_unittest.cc +++ b/content/browser/gpu/gpu_control_list_os_info_unittest.cc @@ -33,12 +33,12 @@ TEST_F(OsInfoTest, ValidOsInfo) { GpuControlList::kOsAny }; for (size_t i = 0; i < arraysize(os); ++i) { - OsInfo info(os[i], "=", "10.6", ""); + OsInfo info(os[i], "=", "10.6", std::string()); EXPECT_TRUE(info.IsValid()); EXPECT_EQ(os_type[i], info.type()); } { - OsInfo info("any", "any", "", ""); + OsInfo info("any", "any", std::string(), std::string()); EXPECT_TRUE(info.IsValid()); } } @@ -54,15 +54,15 @@ TEST_F(OsInfoTest, InvalidOsInfo) { }; for (size_t i = 0; i < arraysize(os); ++i) { { - OsInfo info(os[i], "", "", ""); + OsInfo info(os[i], std::string(), std::string(), std::string()); EXPECT_FALSE(info.IsValid()); } { - OsInfo info(os[i], "=", "", ""); + OsInfo info(os[i], "=", std::string(), std::string()); EXPECT_FALSE(info.IsValid()); } { - OsInfo info(os[i], "", "10.6", ""); + OsInfo info(os[i], std::string(), "10.6", std::string()); EXPECT_FALSE(info.IsValid()); } } @@ -74,34 +74,32 @@ TEST_F(OsInfoTest, InvalidOsInfo) { "Android", }; for (size_t i = 0; i < arraysize(os_cap); ++i) { - OsInfo info(os_cap[i], "=", "10.6", ""); + OsInfo info(os_cap[i], "=", "10.6", std::string()); EXPECT_FALSE(info.IsValid()); } } TEST_F(OsInfoTest, OsComparison) { { - OsInfo info("any", "any", "", ""); + OsInfo info("any", "any", std::string(), std::string()); const GpuControlList::OsType os_type[] = { - GpuControlList::kOsWin, - GpuControlList::kOsLinux, - GpuControlList::kOsMacosx, - GpuControlList::kOsChromeOS, + GpuControlList::kOsWin, GpuControlList::kOsLinux, + GpuControlList::kOsMacosx, GpuControlList::kOsChromeOS, GpuControlList::kOsAndroid, }; for (size_t i = 0; i < arraysize(os_type); ++i) { - EXPECT_TRUE(info.Contains(os_type[i], "")); + EXPECT_TRUE(info.Contains(os_type[i], std::string())); EXPECT_TRUE(info.Contains(os_type[i], "7.8")); } } { - OsInfo info("win", ">=", "6", ""); + OsInfo info("win", ">=", "6", std::string()); EXPECT_FALSE(info.Contains(GpuControlList::kOsMacosx, "10.8.3")); EXPECT_FALSE(info.Contains(GpuControlList::kOsLinux, "10")); EXPECT_FALSE(info.Contains(GpuControlList::kOsChromeOS, "13")); EXPECT_FALSE(info.Contains(GpuControlList::kOsAndroid, "7")); EXPECT_FALSE(info.Contains(GpuControlList::kOsAny, "7")); - EXPECT_FALSE(info.Contains(GpuControlList::kOsWin, "")); + EXPECT_FALSE(info.Contains(GpuControlList::kOsWin, std::string())); EXPECT_TRUE(info.Contains(GpuControlList::kOsWin, "6")); EXPECT_TRUE(info.Contains(GpuControlList::kOsWin, "6.1")); EXPECT_TRUE(info.Contains(GpuControlList::kOsWin, "7")); diff --git a/content/browser/gpu/gpu_control_list_string_info_unittest.cc b/content/browser/gpu/gpu_control_list_string_info_unittest.cc index 43bb952..c2c8009 100644 --- a/content/browser/gpu/gpu_control_list_string_info_unittest.cc +++ b/content/browser/gpu/gpu_control_list_string_info_unittest.cc @@ -24,7 +24,7 @@ TEST_F(StringInfoTest, ValidStringInfo) { }; for (size_t i = 0; i < arraysize(op); ++i) { { - StringInfo info(op[i], ""); + StringInfo info(op[i], std::string()); EXPECT_TRUE(info.IsValid()); } { diff --git a/content/browser/gpu/gpu_control_list_version_info_unittest.cc b/content/browser/gpu/gpu_control_list_version_info_unittest.cc index f05d71c..eb18648 100644 --- a/content/browser/gpu/gpu_control_list_version_info_unittest.cc +++ b/content/browser/gpu/gpu_control_list_version_info_unittest.cc @@ -32,7 +32,7 @@ TEST_F(VersionInfoTest, ValidVersionInfo) { string1 = "8.9"; if (op[i] == "between") string2 = "9.0"; - VersionInfo info(op[i], "", string1, string2); + VersionInfo info(op[i], std::string(), string1, string2); EXPECT_TRUE(info.IsValid()); } @@ -42,7 +42,7 @@ TEST_F(VersionInfoTest, ValidVersionInfo) { "" // Default, same as "numerical" }; for (size_t i =0; i < arraysize(style); ++i) { - VersionInfo info("=", style[i], "8.9", ""); + VersionInfo info("=", style[i], "8.9", std::string()); EXPECT_TRUE(info.IsValid()); if (style[i] == "lexical") EXPECT_TRUE(info.IsLexical()); @@ -65,7 +65,7 @@ TEST_F(VersionInfoTest, ValidVersionInfo) { "10. 9", }; for (size_t i =0; i < arraysize(number); ++i) { - VersionInfo info("=", "", number[i], ""); + VersionInfo info("=", std::string(), number[i], std::string()); EXPECT_TRUE(info.IsValid()); } } @@ -82,21 +82,21 @@ TEST_F(VersionInfoTest, InvalidVersionInfo) { }; for (size_t i = 0; i < arraysize(op); ++i) { { - VersionInfo info(op[i], "", "8.9", ""); + VersionInfo info(op[i], std::string(), "8.9", std::string()); if (op[i] == "between") EXPECT_FALSE(info.IsValid()); else EXPECT_TRUE(info.IsValid()); } { - VersionInfo info(op[i], "", "", ""); + VersionInfo info(op[i], std::string(), std::string(), std::string()); if (op[i] == "any") EXPECT_TRUE(info.IsValid()); else EXPECT_FALSE(info.IsValid()); } { - VersionInfo info(op[i], "", "8.9", "9.0"); + VersionInfo info(op[i], std::string(), "8.9", "9.0"); EXPECT_TRUE(info.IsValid()); } } @@ -106,34 +106,34 @@ TEST_F(VersionInfoTest, InvalidVersionInfo) { "8-9", }; for (size_t i = 0; i < arraysize(number); ++i) { - VersionInfo info("=", "", number[i], ""); + VersionInfo info("=", std::string(), number[i], std::string()); EXPECT_FALSE(info.IsValid()); } } TEST_F(VersionInfoTest, VersionComparison) { { - VersionInfo info("any", "", "", ""); + VersionInfo info("any", std::string(), std::string(), std::string()); EXPECT_TRUE(info.Contains("0")); EXPECT_TRUE(info.Contains("8.9")); EXPECT_TRUE(info.Contains("100")); } { - VersionInfo info(">", "", "8.9", ""); + VersionInfo info(">", std::string(), "8.9", std::string()); EXPECT_FALSE(info.Contains("7")); EXPECT_FALSE(info.Contains("8.9")); EXPECT_FALSE(info.Contains("8.9.1")); EXPECT_TRUE(info.Contains("9")); } { - VersionInfo info(">=", "", "8.9", ""); + VersionInfo info(">=", std::string(), "8.9", std::string()); EXPECT_FALSE(info.Contains("7")); EXPECT_TRUE(info.Contains("8.9")); EXPECT_TRUE(info.Contains("8.9.1")); EXPECT_TRUE(info.Contains("9")); } { - VersionInfo info("=", "", "8.9", ""); + VersionInfo info("=", std::string(), "8.9", std::string()); EXPECT_FALSE(info.Contains("7")); EXPECT_TRUE(info.Contains("8")); EXPECT_TRUE(info.Contains("8.9")); @@ -141,7 +141,7 @@ TEST_F(VersionInfoTest, VersionComparison) { EXPECT_FALSE(info.Contains("9")); } { - VersionInfo info("<", "", "8.9", ""); + VersionInfo info("<", std::string(), "8.9", std::string()); EXPECT_TRUE(info.Contains("7")); EXPECT_TRUE(info.Contains("8.8")); EXPECT_FALSE(info.Contains("8")); @@ -150,7 +150,7 @@ TEST_F(VersionInfoTest, VersionComparison) { EXPECT_FALSE(info.Contains("9")); } { - VersionInfo info("<=", "", "8.9", ""); + VersionInfo info("<=", std::string(), "8.9", std::string()); EXPECT_TRUE(info.Contains("7")); EXPECT_TRUE(info.Contains("8.8")); EXPECT_TRUE(info.Contains("8")); @@ -159,7 +159,7 @@ TEST_F(VersionInfoTest, VersionComparison) { EXPECT_FALSE(info.Contains("9")); } { - VersionInfo info("between", "", "8.9", "9.1"); + VersionInfo info("between", std::string(), "8.9", "9.1"); EXPECT_FALSE(info.Contains("7")); EXPECT_FALSE(info.Contains("8.8")); EXPECT_TRUE(info.Contains("8")); @@ -177,14 +177,14 @@ TEST_F(VersionInfoTest, DateComparison) { // When we use '-' as splitter, we assume a format of mm-dd-yyyy // or mm-yyyy, i.e., a date. { - VersionInfo info("=", "", "1976.3.21", ""); + VersionInfo info("=", std::string(), "1976.3.21", std::string()); EXPECT_TRUE(info.Contains("3-21-1976", '-')); EXPECT_TRUE(info.Contains("3-1976", '-')); EXPECT_TRUE(info.Contains("03-1976", '-')); EXPECT_FALSE(info.Contains("21-3-1976", '-')); } { - VersionInfo info(">", "", "1976.3.21", ""); + VersionInfo info(">", std::string(), "1976.3.21", std::string()); EXPECT_TRUE(info.Contains("3-22-1976", '-')); EXPECT_TRUE(info.Contains("4-1976", '-')); EXPECT_TRUE(info.Contains("04-1976", '-')); @@ -192,7 +192,7 @@ TEST_F(VersionInfoTest, DateComparison) { EXPECT_FALSE(info.Contains("2-1976", '-')); } { - VersionInfo info("between", "", "1976.3.21", "2012.12.25"); + VersionInfo info("between", std::string(), "1976.3.21", "2012.12.25"); EXPECT_FALSE(info.Contains("3-20-1976", '-')); EXPECT_TRUE(info.Contains("3-21-1976", '-')); EXPECT_TRUE(info.Contains("3-22-1976", '-')); @@ -215,7 +215,7 @@ TEST_F(VersionInfoTest, LexicalComparison) { // When we use lexical style, we assume a format major.minor.*. // We apply numerical comparison to major, lexical comparison to others. { - VersionInfo info("<", "lexical", "8.201", ""); + VersionInfo info("<", "lexical", "8.201", std::string()); EXPECT_TRUE(info.Contains("8.001.100")); EXPECT_TRUE(info.Contains("8.109")); EXPECT_TRUE(info.Contains("8.10900")); @@ -234,7 +234,7 @@ TEST_F(VersionInfoTest, LexicalComparison) { EXPECT_FALSE(info.Contains("12.201")); } { - VersionInfo info("<", "lexical", "9.002", ""); + VersionInfo info("<", "lexical", "9.002", std::string()); EXPECT_TRUE(info.Contains("8.001.100")); EXPECT_TRUE(info.Contains("8.109")); EXPECT_TRUE(info.Contains("8.10900")); diff --git a/content/browser/gpu/gpu_data_manager_impl.cc b/content/browser/gpu/gpu_data_manager_impl.cc index 675222b..467cc21 100644 --- a/content/browser/gpu/gpu_data_manager_impl.cc +++ b/content/browser/gpu/gpu_data_manager_impl.cc @@ -117,7 +117,7 @@ void GpuDataManagerImpl::InitializeForTesting( // This function is for testing only, so disable histograms. update_histograms_ = false; - InitializeImpl(gpu_blacklist_json, "", "", gpu_info); + InitializeImpl(gpu_blacklist_json, std::string(), std::string(), gpu_info); } bool GpuDataManagerImpl::IsFeatureBlacklisted(int feature) const { @@ -350,7 +350,7 @@ void GpuDataManagerImpl::UpdateGpuInfo(const GPUInfo& gpu_info) { if (gpu_blacklist_.get()) { std::set<int> features = gpu_blacklist_->MakeDecision( - GpuControlList::kOsAny, "", my_gpu_info); + GpuControlList::kOsAny, std::string(), my_gpu_info); if (update_histograms_) UpdateStats(gpu_blacklist_.get(), features); @@ -358,7 +358,7 @@ void GpuDataManagerImpl::UpdateGpuInfo(const GPUInfo& gpu_info) { } if (gpu_switching_list_.get()) { std::set<int> option = gpu_switching_list_->MakeDecision( - GpuControlList::kOsAny, "", my_gpu_info); + GpuControlList::kOsAny, std::string(), my_gpu_info); if (option.size() == 1) { // Blacklist decision should not overwrite commandline switch from users. CommandLine* command_line = CommandLine::ForCurrentProcess(); @@ -368,7 +368,7 @@ void GpuDataManagerImpl::UpdateGpuInfo(const GPUInfo& gpu_info) { } if (gpu_driver_bug_list_.get()) gpu_driver_bugs_ = gpu_driver_bug_list_->MakeDecision( - GpuControlList::kOsAny, "", my_gpu_info); + GpuControlList::kOsAny, std::string(), my_gpu_info); // We have to update GpuFeatureType before notify all the observers. NotifyGpuInfoUpdate(); diff --git a/content/browser/gpu/gpu_memory_test.cc b/content/browser/gpu/gpu_memory_test.cc index 36584c3..832b947 100644 --- a/content/browser/gpu/gpu_memory_test.cc +++ b/content/browser/gpu/gpu_memory_test.cc @@ -116,12 +116,8 @@ class GpuMemoryTest : public ContentBrowserTest { js_call << mb_to_use; js_call << ");"; std::string message; - ASSERT_TRUE( - ExecuteScriptInFrameAndExtractString( - tab_to_load->web_contents(), - "", - js_call.str(), - &message)); + ASSERT_TRUE(ExecuteScriptInFrameAndExtractString( + tab_to_load->web_contents(), std::string(), js_call.str(), &message)); EXPECT_EQ("DONE_USE_GPU_MEMORY", message); } @@ -196,12 +192,8 @@ class GpuMemoryTest : public ContentBrowserTest { " domAutomationController.send(\"DONE_RAF\");" "})"); std::string message; - ASSERT_TRUE( - ExecuteScriptInFrameAndExtractString( - (*it)->web_contents(), - "", - js_call, - &message)); + ASSERT_TRUE(ExecuteScriptInFrameAndExtractString( + (*it)->web_contents(), std::string(), js_call, &message)); EXPECT_EQ("DONE_RAF", message); } // TODO(ccameron): send an IPC from Browser -> Renderer (delay it until diff --git a/content/browser/gpu/gpu_pixel_browsertest.cc b/content/browser/gpu/gpu_pixel_browsertest.cc index e146a08..758d2b4 100644 --- a/content/browser/gpu/gpu_pixel_browsertest.cc +++ b/content/browser/gpu/gpu_pixel_browsertest.cc @@ -147,7 +147,7 @@ class GpuPixelBrowserTest : public ContentBrowserTest { "DISABLED_", "FLAKY_", "FAILS_", "MANUAL_"}; for (size_t i = 0; i < arraysize(test_status_prefixes); ++i) { ReplaceFirstSubstringAfterOffset( - &test_name_, 0, test_status_prefixes[i], ""); + &test_name_, 0, test_status_prefixes[i], std::string()); } ui::DisableTestCompositor(); diff --git a/content/browser/media/media_internals_unittest.cc b/content/browser/media/media_internals_unittest.cc index 0db2580..591a287 100644 --- a/content/browser/media/media_internals_unittest.cc +++ b/content/browser/media/media_internals_unittest.cc @@ -41,7 +41,7 @@ class MediaInternalsTest : public testing::Test { void UpdateItem(const std::string& item, const std::string& property, base::Value* value) { - internals_->UpdateItem("", item, property, value); + internals_->UpdateItem(std::string(), item, property, value); } void SendUpdate(const std::string& function, base::Value* value) { diff --git a/content/browser/plugin_service_impl.cc b/content/browser/plugin_service_impl.cc index 4ae318a..1734cc8 100644 --- a/content/browser/plugin_service_impl.cc +++ b/content/browser/plugin_service_impl.cc @@ -178,7 +178,7 @@ void PluginServiceImpl::Init() { if (command_line->HasSwitch(switches::kSitePerProcess)) { webkit::WebPluginInfo webview_plugin( ASCIIToUTF16("WebView Tag"), - base::FilePath(FILE_PATH_LITERAL("")), + base::FilePath(FILE_PATH_LITERAL(std::string())), ASCIIToUTF16("1.2.3.4"), ASCIIToUTF16("Browser Plugin.")); webview_plugin.type = webkit::WebPluginInfo::PLUGIN_TYPE_NPAPI; diff --git a/content/browser/ppapi_plugin_process_host.cc b/content/browser/ppapi_plugin_process_host.cc index a315130..9956326 100644 --- a/content/browser/ppapi_plugin_process_host.cc +++ b/content/browser/ppapi_plugin_process_host.cc @@ -317,7 +317,7 @@ bool PpapiPluginProcessHost::Init(const PepperPluginInfo& info) { #if defined(OS_POSIX) bool use_zygote = !is_broker_ && plugin_launcher.empty() && info.is_sandboxed; if (!info.is_sandboxed) - cmd_line->AppendSwitchASCII(switches::kNoSandbox, ""); + cmd_line->AppendSwitchASCII(switches::kNoSandbox, std::string()); #endif // OS_POSIX process_->Launch( #if defined(OS_WIN) diff --git a/content/browser/renderer_host/gtk_key_bindings_handler.cc b/content/browser/renderer_host/gtk_key_bindings_handler.cc index 756bcc3..e86ea60 100644 --- a/content/browser/renderer_host/gtk_key_bindings_handler.cc +++ b/content/browser/renderer_host/gtk_key_bindings_handler.cc @@ -132,15 +132,16 @@ GtkKeyBindingsHandler* GtkKeyBindingsHandler::GetHandlerOwner( } void GtkKeyBindingsHandler::BackSpace(GtkTextView* text_view) { - GetHandlerOwner(text_view)->EditCommandMatched("DeleteBackward", ""); + GetHandlerOwner(text_view) + ->EditCommandMatched("DeleteBackward", std::string()); } void GtkKeyBindingsHandler::CopyClipboard(GtkTextView* text_view) { - GetHandlerOwner(text_view)->EditCommandMatched("Copy", ""); + GetHandlerOwner(text_view)->EditCommandMatched("Copy", std::string()); } void GtkKeyBindingsHandler::CutClipboard(GtkTextView* text_view) { - GetHandlerOwner(text_view)->EditCommandMatched("Cut", ""); + GetHandlerOwner(text_view)->EditCommandMatched("Cut", std::string()); } void GtkKeyBindingsHandler::DeleteFromCursor( @@ -191,7 +192,7 @@ void GtkKeyBindingsHandler::DeleteFromCursor( count = -count; for (; count > 0; --count) { for (const char* const* p = commands; *p; ++p) - owner->EditCommandMatched(*p, ""); + owner->EditCommandMatched(*p, std::string()); } } @@ -247,7 +248,7 @@ void GtkKeyBindingsHandler::MoveCursor( if (count < 0) count = -count; for (; count > 0; --count) - owner->EditCommandMatched(command, ""); + owner->EditCommandMatched(command, std::string()); } void GtkKeyBindingsHandler::MoveViewport( @@ -256,18 +257,18 @@ void GtkKeyBindingsHandler::MoveViewport( } void GtkKeyBindingsHandler::PasteClipboard(GtkTextView* text_view) { - GetHandlerOwner(text_view)->EditCommandMatched("Paste", ""); + GetHandlerOwner(text_view)->EditCommandMatched("Paste", std::string()); } void GtkKeyBindingsHandler::SelectAll(GtkTextView* text_view, gboolean select) { if (select) - GetHandlerOwner(text_view)->EditCommandMatched("SelectAll", ""); + GetHandlerOwner(text_view)->EditCommandMatched("SelectAll", std::string()); else - GetHandlerOwner(text_view)->EditCommandMatched("Unselect", ""); + GetHandlerOwner(text_view)->EditCommandMatched("Unselect", std::string()); } void GtkKeyBindingsHandler::SetAnchor(GtkTextView* text_view) { - GetHandlerOwner(text_view)->EditCommandMatched("SetMark", ""); + GetHandlerOwner(text_view)->EditCommandMatched("SetMark", std::string()); } void GtkKeyBindingsHandler::ToggleCursorVisible(GtkTextView* text_view) { diff --git a/content/browser/renderer_host/pepper/pepper_host_resolver_private_message_filter.cc b/content/browser/renderer_host/pepper/pepper_host_resolver_private_message_filter.cc index d42cb56..e4bb14c 100644 --- a/content/browser/renderer_host/pepper/pepper_host_resolver_private_message_filter.cc +++ b/content/browser/renderer_host/pepper/pepper_host_resolver_private_message_filter.cc @@ -122,9 +122,9 @@ int32_t PepperHostResolverPrivateMessageFilter::OnMsgResolve( // Check plugin permissions. SocketPermissionRequest request( - content::SocketPermissionRequest::NONE, "", 0); - RenderViewHost* render_view_host = RenderViewHost::FromID(render_process_id_, - render_view_id_); + content::SocketPermissionRequest::NONE, std::string(), 0); + RenderViewHost* render_view_host = + RenderViewHost::FromID(render_process_id_, render_view_id_); if (!render_view_host || !pepper_socket_utils::CanUseSocketAPIs(external_plugin_, request, diff --git a/content/browser/renderer_host/pepper/pepper_udp_socket_private_message_filter.cc b/content/browser/renderer_host/pepper/pepper_udp_socket_private_message_filter.cc index 08384e78..4799d66 100644 --- a/content/browser/renderer_host/pepper/pepper_udp_socket_private_message_filter.cc +++ b/content/browser/renderer_host/pepper/pepper_udp_socket_private_message_filter.cc @@ -380,7 +380,9 @@ void PepperUDPSocketPrivateMessageFilter::SendBindError( void PepperUDPSocketPrivateMessageFilter::SendRecvFromError( const ppapi::host::ReplyMessageContext& context, int32_t result) { - SendRecvFromReply(context, result, "", + SendRecvFromReply(context, + result, + std::string(), NetAddressPrivateImpl::kInvalidNetAddress); } diff --git a/content/browser/renderer_host/render_sandbox_host_linux.cc b/content/browser/renderer_host/render_sandbox_host_linux.cc index 0cc3638..78eba83 100644 --- a/content/browser/renderer_host/render_sandbox_host_linux.cc +++ b/content/browser/renderer_host/render_sandbox_host_linux.cc @@ -278,7 +278,7 @@ class SandboxIPCProcess { if (family.name.data()) { reply.WriteString(family.name.data()); } else { - reply.WriteString(""); + reply.WriteString(std::string()); } reply.WriteBool(family.isBold); reply.WriteBool(family.isItalic); diff --git a/content/browser/speech/google_one_shot_remote_engine_unittest.cc b/content/browser/speech/google_one_shot_remote_engine_unittest.cc index efcf84f..694e246 100644 --- a/content/browser/speech/google_one_shot_remote_engine_unittest.cc +++ b/content/browser/speech/google_one_shot_remote_engine_unittest.cc @@ -104,7 +104,7 @@ TEST_F(GoogleOneShotRemoteEngineTest, BasicTest) { EXPECT_EQ(0U, result().hypotheses.size()); // Http failure case. - CreateAndTestRequest(false, ""); + CreateAndTestRequest(false, std::string()); EXPECT_EQ(error_, SPEECH_RECOGNITION_ERROR_NETWORK); EXPECT_EQ(0U, result().hypotheses.size()); diff --git a/content/browser/speech/speech_recognition_manager_impl.cc b/content/browser/speech/speech_recognition_manager_impl.cc index 8f9c3e1..2dc6cf8 100644 --- a/content/browser/speech/speech_recognition_manager_impl.cc +++ b/content/browser/speech/speech_recognition_manager_impl.cc @@ -100,7 +100,8 @@ int SpeechRecognitionManagerImpl::CreateSession( remote_engine_config.interim_results = config.interim_results; remote_engine_config.max_hypotheses = config.max_hypotheses; remote_engine_config.hardware_info = hardware_info; - remote_engine_config.origin_url = can_report_metrics ? config.origin_url : ""; + remote_engine_config.origin_url = + can_report_metrics ? config.origin_url : std::string(); SpeechRecognitionEngine* google_remote_engine; if (config.is_legacy_api) { diff --git a/content/browser/speech/speech_recognizer_unittest.cc b/content/browser/speech/speech_recognizer_unittest.cc index 2cc4db3..4c061c2 100644 --- a/content/browser/speech/speech_recognizer_unittest.cc +++ b/content/browser/speech/speech_recognizer_unittest.cc @@ -305,7 +305,7 @@ TEST_F(SpeechRecognizerTest, ConnectionError) { status.set_error(net::ERR_CONNECTION_REFUSED); fetcher->set_status(status); fetcher->set_response_code(0); - fetcher->SetResponseString(""); + fetcher->SetResponseString(std::string()); fetcher->delegate()->OnURLFetchComplete(fetcher); MessageLoop::current()->RunUntilIdle(); EXPECT_TRUE(recognition_ended_); diff --git a/content/browser/storage_partition_impl_map_unittest.cc b/content/browser/storage_partition_impl_map_unittest.cc index 1c44fcc..04127cc 100644 --- a/content/browser/storage_partition_impl_map_unittest.cc +++ b/content/browser/storage_partition_impl_map_unittest.cc @@ -13,13 +13,18 @@ class StoragePartitionConfigTest : public testing::Test { // Test that the Less comparison function is implemented properly to uniquely // identify storage partitions used as keys in a std::map. TEST_F(StoragePartitionConfigTest, OperatorLess) { - StoragePartitionImplMap::StoragePartitionConfig c1("", "", false); - StoragePartitionImplMap::StoragePartitionConfig c2("", "", false); - StoragePartitionImplMap::StoragePartitionConfig c3("", "", true); - StoragePartitionImplMap::StoragePartitionConfig c4("a", "", true); - StoragePartitionImplMap::StoragePartitionConfig c5("b", "", true); - StoragePartitionImplMap::StoragePartitionConfig c6("", "abc", false); - StoragePartitionImplMap::StoragePartitionConfig c7("", "abc", true); + StoragePartitionImplMap::StoragePartitionConfig c1( + std::string(), std::string(), false); + StoragePartitionImplMap::StoragePartitionConfig c2( + std::string(), std::string(), false); + StoragePartitionImplMap::StoragePartitionConfig c3( + std::string(), std::string(), true); + StoragePartitionImplMap::StoragePartitionConfig c4("a", std::string(), true); + StoragePartitionImplMap::StoragePartitionConfig c5("b", std::string(), true); + StoragePartitionImplMap::StoragePartitionConfig c6( + std::string(), "abc", false); + StoragePartitionImplMap::StoragePartitionConfig c7( + std::string(), "abc", true); StoragePartitionImplMap::StoragePartitionConfig c8("a", "abc", false); StoragePartitionImplMap::StoragePartitionConfig c9("a", "abc", true); diff --git a/content/browser/streams/stream_url_request_job_unittest.cc b/content/browser/streams/stream_url_request_job_unittest.cc index 10a02c9..bed96fa 100644 --- a/content/browser/streams/stream_url_request_job_unittest.cc +++ b/content/browser/streams/stream_url_request_job_unittest.cc @@ -169,7 +169,7 @@ TEST_F(StreamURLRequestJobTest, TestInvalidRangeDataRequest) { net::HttpRequestHeaders extra_headers; extra_headers.SetHeader(net::HttpRequestHeaders::kRange, "bytes=1-3"); - TestRequest("GET", kStreamURL, extra_headers, 405, ""); + TestRequest("GET", kStreamURL, extra_headers, 405, std::string()); } } // namespace content diff --git a/content/browser/tracing/tracing_ui.cc b/content/browser/tracing/tracing_ui.cc index aa2e529..6c224c0 100644 --- a/content/browser/tracing/tracing_ui.cc +++ b/content/browser/tracing/tracing_ui.cc @@ -317,8 +317,11 @@ void TracingMessageHandler::OnLoadTraceFile(const base::ListValue* list) { ui::SelectFileDialog::SELECT_OPEN_FILE, string16(), base::FilePath(), - NULL, 0, FILE_PATH_LITERAL(""), - web_ui()->GetWebContents()->GetView()->GetTopLevelNativeWindow(), NULL); + NULL, + 0, + FILE_PATH_LITERAL(std::string()), + web_ui()->GetWebContents()->GetView()->GetTopLevelNativeWindow(), + NULL); } void TracingMessageHandler::LoadTraceFileComplete(string16* contents) { @@ -367,8 +370,11 @@ void TracingMessageHandler::OnSaveTraceFile(const base::ListValue* list) { ui::SelectFileDialog::SELECT_SAVEAS_FILE, string16(), base::FilePath(), - NULL, 0, FILE_PATH_LITERAL(""), - web_ui()->GetWebContents()->GetView()->GetTopLevelNativeWindow(), NULL); + NULL, + 0, + FILE_PATH_LITERAL(std::string()), + web_ui()->GetWebContents()->GetView()->GetTopLevelNativeWindow(), + NULL); } void TracingMessageHandler::SaveTraceFileComplete() { diff --git a/content/browser/web_contents/navigation_entry_impl_unittest.cc b/content/browser/web_contents/navigation_entry_impl_unittest.cc index 00857ed..8bc5de1 100644 --- a/content/browser/web_contents/navigation_entry_impl_unittest.cc +++ b/content/browser/web_contents/navigation_entry_impl_unittest.cc @@ -61,23 +61,23 @@ TEST_F(NavigationEntryTest, NavigationEntryURLs) { EXPECT_EQ(GURL(), entry1_->GetURL()); EXPECT_EQ(GURL(), entry1_->GetVirtualURL()); - EXPECT_TRUE(entry1_->GetTitleForDisplay("").empty()); + EXPECT_TRUE(entry1_->GetTitleForDisplay(std::string()).empty()); // Setting URL affects virtual_url and GetTitleForDisplay entry1_->SetURL(GURL("http://www.google.com")); EXPECT_EQ(GURL("http://www.google.com"), entry1_->GetURL()); EXPECT_EQ(GURL("http://www.google.com"), entry1_->GetVirtualURL()); EXPECT_EQ(ASCIIToUTF16("www.google.com"), - entry1_->GetTitleForDisplay("")); + entry1_->GetTitleForDisplay(std::string())); // file:/// URLs should only show the filename. entry1_->SetURL(GURL("file:///foo/bar baz.txt")); EXPECT_EQ(ASCIIToUTF16("bar baz.txt"), - entry1_->GetTitleForDisplay("")); + entry1_->GetTitleForDisplay(std::string())); // Title affects GetTitleForDisplay entry1_->SetTitle(ASCIIToUTF16("Google")); - EXPECT_EQ(ASCIIToUTF16("Google"), entry1_->GetTitleForDisplay("")); + EXPECT_EQ(ASCIIToUTF16("Google"), entry1_->GetTitleForDisplay(std::string())); // Setting virtual_url doesn't affect URL entry2_->SetVirtualURL(GURL("display:url")); @@ -86,7 +86,7 @@ TEST_F(NavigationEntryTest, NavigationEntryURLs) { EXPECT_EQ(GURL("display:url"), entry2_->GetVirtualURL()); // Having a title set in constructor overrides virtual URL - EXPECT_EQ(ASCIIToUTF16("title"), entry2_->GetTitleForDisplay("")); + EXPECT_EQ(ASCIIToUTF16("title"), entry2_->GetTitleForDisplay(std::string())); // User typed URL is independent of the others EXPECT_EQ(GURL(), entry1_->GetUserTypedURL()); diff --git a/content/browser/webui/web_ui_data_source_unittest.cc b/content/browser/webui/web_ui_data_source_unittest.cc index 24d1d2b..bece8d0 100644 --- a/content/browser/webui/web_ui_data_source_unittest.cc +++ b/content/browser/webui/web_ui_data_source_unittest.cc @@ -141,7 +141,7 @@ TEST_F(WebUIDataSourceTest, NamedResource) { TEST_F(WebUIDataSourceTest, MimeType) { const char* html = "text/html"; const char* js = "application/javascript"; - EXPECT_EQ(GetMimeType(""), html); + EXPECT_EQ(GetMimeType(std::string()), html); EXPECT_EQ(GetMimeType("foo"), html); EXPECT_EQ(GetMimeType("foo.html"), html); EXPECT_EQ(GetMimeType(".js"), js); diff --git a/content/browser/worker_host/test/worker_browsertest.cc b/content/browser/worker_host/test/worker_browsertest.cc index 1be3007..3e67d7f 100644 --- a/content/browser/worker_host/test/worker_browsertest.cc +++ b/content/browser/worker_host/test/worker_browsertest.cc @@ -300,11 +300,11 @@ class WorkerTest : public ContentBrowserTest { }; IN_PROC_BROWSER_TEST_F(WorkerTest, SingleWorker) { - RunTest("single_worker.html", ""); + RunTest("single_worker.html", std::string()); } IN_PROC_BROWSER_TEST_F(WorkerTest, MultipleWorkers) { - RunTest("multi_worker.html", ""); + RunTest("multi_worker.html", std::string()); } IN_PROC_BROWSER_TEST_F(WorkerTest, SingleSharedWorker) { @@ -320,10 +320,10 @@ IN_PROC_BROWSER_TEST_F(WorkerTest, MultipleSharedWorkers) { // http://crbug.com/30021 IN_PROC_BROWSER_TEST_F(WorkerTest, IncognitoSharedWorkers) { // Load a non-incognito tab and have it create a shared worker - RunTest("incognito_worker.html", ""); + RunTest("incognito_worker.html", std::string()); // Incognito worker should not share with non-incognito - RunTest(CreateOffTheRecordBrowser(), "incognito_worker.html", ""); + RunTest(CreateOffTheRecordBrowser(), "incognito_worker.html", std::string()); } // Make sure that auth dialog is displayed from worker context. @@ -399,7 +399,7 @@ IN_PROC_BROWSER_TEST_F(WorkerTest, LimitTotal) { // Flaky, http://crbug.com/59786. IN_PROC_BROWSER_TEST_F(WorkerTest, WorkerClose) { - RunTest("worker_close.html", ""); + RunTest("worker_close.html", std::string()); ASSERT_TRUE(WaitForWorkerProcessCount(0)); } diff --git a/content/gpu/gpu_info_collector.cc b/content/gpu/gpu_info_collector.cc index 86fb0c5..d3f5867 100644 --- a/content/gpu/gpu_info_collector.cc +++ b/content/gpu/gpu_info_collector.cc @@ -53,7 +53,7 @@ std::string GetGLString(unsigned int pname) { reinterpret_cast<const char*>(glGetString(pname)); if (gl_string) return std::string(gl_string); - return ""; + return std::string(); } // Return a version string in the format of "major.minor". @@ -71,7 +71,7 @@ std::string GetVersionFromString(const std::string& version_string) { if (pieces.size() >= 2) return pieces[0] + "." + pieces[1]; } - return ""; + return std::string(); } } // namespace anonymous diff --git a/content/public/test/test_launcher.cc b/content/public/test/test_launcher.cc index 40545d5..f4635ec 100644 --- a/content/public/test/test_launcher.cc +++ b/content/public/test/test_launcher.cc @@ -454,7 +454,7 @@ bool RunTests(TestLauncherDelegate* launcher_delegate, // Split --gtest_filter at '-', if there is one, to separate into // positive filter and negative filter portions. std::string positive_filter = filter; - std::string negative_filter = ""; + std::string negative_filter; size_t dash_pos = filter.find('-'); if (dash_pos != std::string::npos) { positive_filter = filter.substr(0, dash_pos); // Everything up to the dash. diff --git a/content/renderer/browser_plugin/browser_plugin.cc b/content/renderer/browser_plugin/browser_plugin.cc index 9fe3191..62c973318 100644 --- a/content/renderer/browser_plugin/browser_plugin.cc +++ b/content/renderer/browser_plugin/browser_plugin.cc @@ -110,7 +110,7 @@ static std::string PermissionTypeToString(BrowserPluginPermissionType type) { NOTREACHED(); break; } - return ""; + return std::string(); } typedef std::map<WebKit::WebPluginContainer*, @@ -227,7 +227,7 @@ void BrowserPlugin::RemoveDOMAttribute(const std::string& attribute_name) { std::string BrowserPlugin::GetDOMAttributeValue( const std::string& attribute_name) const { if (!container()) - return ""; + return std::string(); return container()->element().getAttribute( WebKit::WebString::fromUTF8(attribute_name)).utf8(); diff --git a/content/renderer/date_time_formatter.cc b/content/renderer/date_time_formatter.cc index d3c16e3..1adb0de 100644 --- a/content/renderer/date_time_formatter.cc +++ b/content/renderer/date_time_formatter.cc @@ -95,7 +95,7 @@ const std::string DateTimeFormatter::FormatString() const { UErrorCode success = U_ZERO_ERROR; if (year_ == 0 && month_ == 0 && day_ == 0 && hour_ == 0 && minute_ == 0 && second_ == 0) { - return ""; + return std::string(); } std::string result; @@ -113,7 +113,7 @@ const std::string DateTimeFormatter::FormatString() const { return result; } LOG(WARNING) << "Calendar not created: error " << success; - return ""; + return std::string(); } void DateTimeFormatter::ExtractType( diff --git a/content/renderer/media/mock_media_stream_dependency_factory.cc b/content/renderer/media/mock_media_stream_dependency_factory.cc index af3177f..f2656c0 100644 --- a/content/renderer/media/mock_media_stream_dependency_factory.cc +++ b/content/renderer/media/mock_media_stream_dependency_factory.cc @@ -203,7 +203,7 @@ cricket::VideoRenderer* MockLocalVideoTrack::FrameInput() { std::string MockLocalVideoTrack::kind() const { NOTIMPLEMENTED(); - return ""; + return std::string(); } std::string MockLocalVideoTrack::id() const { return id_; } @@ -239,7 +239,7 @@ VideoSourceInterface* MockLocalVideoTrack::GetSource() const { std::string MockLocalAudioTrack::kind() const { NOTIMPLEMENTED(); - return ""; + return std::string(); } std::string MockLocalAudioTrack::id() const { return id_; } @@ -292,11 +292,11 @@ class MockSessionDescription : public SessionDescriptionInterface { } virtual std::string session_id() const OVERRIDE { NOTIMPLEMENTED(); - return ""; + return std::string(); } virtual std::string session_version() const OVERRIDE { NOTIMPLEMENTED(); - return ""; + return std::string(); } virtual std::string type() const OVERRIDE { return type_; diff --git a/content/renderer/media/peer_connection_tracker.cc b/content/renderer/media/peer_connection_tracker.cc index 095d85f..82f3c58 100644 --- a/content/renderer/media/peer_connection_tracker.cc +++ b/content/renderer/media/peer_connection_tracker.cc @@ -376,7 +376,7 @@ void PeerConnectionTracker::TrackCreateDataChannel( } void PeerConnectionTracker::TrackStop(RTCPeerConnectionHandler* pc_handler) { - SendPeerConnectionUpdate(pc_handler, "stop", ""); + SendPeerConnectionUpdate(pc_handler, "stop", std::string()); } void PeerConnectionTracker::TrackSignalingStateChange( @@ -430,7 +430,7 @@ void PeerConnectionTracker::TrackSessionDescriptionCallback( void PeerConnectionTracker::TrackOnRenegotiationNeeded( RTCPeerConnectionHandler* pc_handler) { - SendPeerConnectionUpdate(pc_handler, "onRenegotiationNeeded", ""); + SendPeerConnectionUpdate(pc_handler, "onRenegotiationNeeded", std::string()); } void PeerConnectionTracker::TrackCreateDTMFSender( diff --git a/content/renderer/p2p/port_allocator.cc b/content/renderer/p2p/port_allocator.cc index 7d06f6e..7380113 100644 --- a/content/renderer/p2p/port_allocator.cc +++ b/content/renderer/p2p/port_allocator.cc @@ -282,8 +282,8 @@ void P2PPortAllocatorSession::ParseRelayResponse() { } void P2PPortAllocatorSession::AddConfig() { - cricket::PortConfiguration* config = - new cricket::PortConfiguration(stun_server_address_, "", ""); + cricket::PortConfiguration* config = new cricket::PortConfiguration( + stun_server_address_, std::string(), std::string()); if (allocator_->config_.legacy_relay) { // Passing empty credentials for legacy google relay. diff --git a/content/renderer/pepper/pepper_device_enumeration_event_handler.cc b/content/renderer/pepper/pepper_device_enumeration_event_handler.cc index b23df8a..7a8dce6 100644 --- a/content/renderer/pepper/pepper_device_enumeration_event_handler.cc +++ b/content/renderer/pepper/pepper_device_enumeration_event_handler.cc @@ -78,7 +78,7 @@ void PepperDeviceEnumerationEventHandler::OnDeviceOpened( } void PepperDeviceEnumerationEventHandler::OnDeviceOpenFailed(int request_id) { - NotifyDeviceOpened(request_id, false, ""); + NotifyDeviceOpened(request_id, false, std::string()); } // static diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc index 0c4212b..3e06f1f 100644 --- a/content/renderer/render_thread_impl.cc +++ b/content/renderer/render_thread_impl.cc @@ -180,7 +180,7 @@ std::string HostToCustomHistogramSuffix(const std::string& host) { return ".docs"; if (host == "plus.google.com") return ".plus"; - return ""; + return std::string(); } void* CreateHistogram( diff --git a/content/renderer/v8_value_converter_impl_unittest.cc b/content/renderer/v8_value_converter_impl_unittest.cc index df68e80..1f6b9bf 100644 --- a/content/renderer/v8_value_converter_impl_unittest.cc +++ b/content/renderer/v8_value_converter_impl_unittest.cc @@ -70,7 +70,7 @@ class V8ValueConverterImplTest : public testing::Test { std::string temp; if (!value->GetString(key, &temp)) { ADD_FAILURE(); - return ""; + return std::string(); } return temp; } @@ -80,7 +80,7 @@ class V8ValueConverterImplTest : public testing::Test { value->Get(v8::String::New(key.c_str())).As<v8::String>(); if (temp.IsEmpty()) { ADD_FAILURE(); - return ""; + return std::string(); } v8::String::Utf8Value utf8(temp); return std::string(*utf8, utf8.length()); @@ -90,7 +90,7 @@ class V8ValueConverterImplTest : public testing::Test { std::string temp; if (!value->GetString(static_cast<size_t>(index), &temp)) { ADD_FAILURE(); - return ""; + return std::string(); } return temp; } @@ -99,7 +99,7 @@ class V8ValueConverterImplTest : public testing::Test { v8::Handle<v8::String> temp = value->Get(index).As<v8::String>(); if (temp.IsEmpty()) { ADD_FAILURE(); - return ""; + return std::string(); } v8::String::Utf8Value utf8(temp); return std::string(*utf8, utf8.length()); diff --git a/content/shell/shell_devtools_delegate.cc b/content/shell/shell_devtools_delegate.cc index 58182f1..07ebbde 100644 --- a/content/shell/shell_devtools_delegate.cc +++ b/content/shell/shell_devtools_delegate.cc @@ -30,12 +30,11 @@ ShellDevToolsDelegate::ShellDevToolsDelegate(BrowserContext* browser_context, devtools_http_handler_ = DevToolsHttpHandler::Start( #if defined(OS_ANDROID) new net::UnixDomainSocketWithAbstractNamespaceFactory( - kSocketName, - base::Bind(&CanUserConnectToDevTools)), + kSocketName, base::Bind(&CanUserConnectToDevTools)), #else new net::TCPListenSocketFactory("127.0.0.1", port), #endif - "", + std::string(), this); } @@ -61,7 +60,7 @@ base::FilePath ShellDevToolsDelegate::GetDebugFrontendDir() { } std::string ShellDevToolsDelegate::GetPageThumbnailData(const GURL& url) { - return ""; + return std::string(); } RenderViewHost* ShellDevToolsDelegate::CreateNewTarget() { @@ -80,7 +79,7 @@ ShellDevToolsDelegate::GetTargetType(RenderViewHost*) { std::string ShellDevToolsDelegate::GetViewDescription( content::RenderViewHost*) { - return ""; + return std::string(); } } // namespace content diff --git a/content/test/gpu/gpu_test_config_unittest.cc b/content/test/gpu/gpu_test_config_unittest.cc index f58139f..a87d215 100644 --- a/content/test/gpu/gpu_test_config_unittest.cc +++ b/content/test/gpu/gpu_test_config_unittest.cc @@ -148,7 +148,7 @@ TEST_F(GPUTestConfigTest, StringMatches) { config.set_gpu_device_id(0x0640); EXPECT_TRUE(config.IsValid()); - EXPECT_TRUE(config.Matches("")); + EXPECT_TRUE(config.Matches(std::string())); // os matching EXPECT_TRUE(config.Matches("WIN")); diff --git a/content/test/layout_browsertest.cc b/content/test/layout_browsertest.cc index 4c34a38..155dbbe 100644 --- a/content/test/layout_browsertest.cc +++ b/content/test/layout_browsertest.cc @@ -155,8 +155,8 @@ void InProcessBrowserLayoutTest::RunLayoutTestInternal( test_controller_->set_printer(printer.release()); LOG(INFO) << "Navigating to URL " << url << " and blocking."; - ASSERT_TRUE( - test_controller_->PrepareForLayoutTest(url, layout_test_dir_, false, "")); + ASSERT_TRUE(test_controller_->PrepareForLayoutTest( + url, layout_test_dir_, false, std::string())); base::RunLoop run_loop; run_loop.Run(); LOG(INFO) << "Navigation completed."; @@ -195,9 +195,10 @@ void InProcessBrowserLayoutTest::RunLayoutTestInternal( std::string InProcessBrowserLayoutTest::SaveResults(const std::string& expected, const std::string& actual) { base::FilePath cwd; - EXPECT_TRUE(file_util::CreateNewTempDirectory(FILE_PATH_LITERAL(""), &cwd)); - base::FilePath expected_filename = cwd.Append( - FILE_PATH_LITERAL("expected.txt")); + EXPECT_TRUE(file_util::CreateNewTempDirectory( + FILE_PATH_LITERAL(std::string()), &cwd)); + base::FilePath expected_filename = + cwd.Append(FILE_PATH_LITERAL("expected.txt")); base::FilePath actual_filename = cwd.Append(FILE_PATH_LITERAL("actual.txt")); EXPECT_NE(-1, file_util::WriteFile(expected_filename, expected.c_str(), diff --git a/courgette/bsdiff_memory_unittest.cc b/courgette/bsdiff_memory_unittest.cc index f1718e2..fe9fae6 100644 --- a/courgette/bsdiff_memory_unittest.cc +++ b/courgette/bsdiff_memory_unittest.cc @@ -51,15 +51,15 @@ std::string BSDiffMemoryTest::GenerateSyntheticInput(size_t length, int seed) } TEST_F(BSDiffMemoryTest, TestEmpty) { - GenerateAndTestPatch("", ""); + GenerateAndTestPatch(std::string(), std::string()); } TEST_F(BSDiffMemoryTest, TestEmptyVsNonempty) { - GenerateAndTestPatch("", "xxx"); + GenerateAndTestPatch(std::string(), "xxx"); } TEST_F(BSDiffMemoryTest, TestNonemptyVsEmpty) { - GenerateAndTestPatch("xxx", ""); + GenerateAndTestPatch("xxx", std::string()); } TEST_F(BSDiffMemoryTest, TestSmallInputsWithSmallChanges) { diff --git a/crypto/ec_private_key_unittest.cc b/crypto/ec_private_key_unittest.cc index a052a9a..d2ec256 100644 --- a/crypto/ec_private_key_unittest.cc +++ b/crypto/ec_private_key_unittest.cc @@ -23,7 +23,7 @@ TEST(ECPrivateKeyUnitTest, OpenSSLStub) { // back the same exact public key, and the private key should have the same // value and elliptic curve params. TEST(ECPrivateKeyUnitTest, InitRandomTest) { - const std::string password1 = ""; + const std::string password1; const std::string password2 = "test"; scoped_ptr<crypto::ECPrivateKey> keypair1( @@ -86,7 +86,7 @@ TEST(ECPrivateKeyUnitTest, InitRandomTest) { } TEST(ECPrivateKeyUnitTest, BadPasswordTest) { - const std::string password1 = ""; + const std::string password1; const std::string password2 = "test"; scoped_ptr<crypto::ECPrivateKey> keypair1( diff --git a/crypto/ec_signature_creator_unittest.cc b/crypto/ec_signature_creator_unittest.cc index df73bec..b34022b 100644 --- a/crypto/ec_signature_creator_unittest.cc +++ b/crypto/ec_signature_creator_unittest.cc @@ -30,13 +30,14 @@ TEST(ECSignatureCreatorTest, BasicTest) { ASSERT_TRUE(key_original.get()); std::vector<uint8> key_info; - ASSERT_TRUE(key_original->ExportEncryptedPrivateKey("", 1000, &key_info)); + ASSERT_TRUE( + key_original->ExportEncryptedPrivateKey(std::string(), 1000, &key_info)); std::vector<uint8> pubkey_info; ASSERT_TRUE(key_original->ExportPublicKey(&pubkey_info)); scoped_ptr<crypto::ECPrivateKey> key( - crypto::ECPrivateKey::CreateFromEncryptedPrivateKeyInfo("", key_info, - pubkey_info)); + crypto::ECPrivateKey::CreateFromEncryptedPrivateKeyInfo( + std::string(), key_info, pubkey_info)); ASSERT_TRUE(key.get()); ASSERT_TRUE(key->key() != NULL); diff --git a/dbus/end_to_end_async_unittest.cc b/dbus/end_to_end_async_unittest.cc index 0a3446e..6943494 100644 --- a/dbus/end_to_end_async_unittest.cc +++ b/dbus/end_to_end_async_unittest.cc @@ -185,7 +185,7 @@ class EndToEndAsyncTest : public testing::Test { ASSERT_TRUE(reader.PopString(&response_string)); response_strings_.push_back(response_string); } else { - response_strings_.push_back(""); + response_strings_.push_back(std::string()); } message_loop_.Quit(); }; @@ -205,7 +205,7 @@ class EndToEndAsyncTest : public testing::Test { ASSERT_NE("", error->GetErrorName()); error_names_.push_back(error->GetErrorName()); } else { - error_names_.push_back(""); + error_names_.push_back(std::string()); } message_loop_.Quit(); } diff --git a/dbus/message.cc b/dbus/message.cc index ce53a48..737b0c4 100644 --- a/dbus/message.cc +++ b/dbus/message.cc @@ -87,7 +87,7 @@ std::string Message::GetMessageTypeAsString() { return "MESSAGE_ERROR"; } NOTREACHED(); - return ""; + return std::string(); } std::string Message::ToStringInternal(const std::string& indent, @@ -251,7 +251,7 @@ std::string Message::ToStringInternal(const std::string& indent, // ... std::string Message::ToString() { if (!raw_message_) - return ""; + return std::string(); // Generate headers first. std::string headers; @@ -268,7 +268,7 @@ std::string Message::ToString() { // Generate the payload. MessageReader reader(this); - return headers + "\n" + ToStringInternal("", &reader); + return headers + "\n" + ToStringInternal(std::string(), &reader); } bool Message::SetDestination(const std::string& destination) { diff --git a/dbus/message_unittest.cc b/dbus/message_unittest.cc index 7e4455a8..383e1c1 100644 --- a/dbus/message_unittest.cc +++ b/dbus/message_unittest.cc @@ -557,7 +557,7 @@ TEST(MessageTest, GetAndSetHeaders) { scoped_ptr<dbus::Response> message(dbus::Response::CreateEmpty()); EXPECT_EQ("", message->GetDestination()); - EXPECT_EQ(dbus::ObjectPath(""), message->GetPath()); + EXPECT_EQ(dbus::ObjectPath(std::string()), message->GetPath()); EXPECT_EQ("", message->GetInterface()); EXPECT_EQ("", message->GetMember()); EXPECT_EQ("", message->GetErrorName()); @@ -587,7 +587,7 @@ TEST(MessageTest, GetAndSetHeaders) { TEST(MessageTest, SetInvalidHeaders) { scoped_ptr<dbus::Response> message(dbus::Response::CreateEmpty()); EXPECT_EQ("", message->GetDestination()); - EXPECT_EQ(dbus::ObjectPath(""), message->GetPath()); + EXPECT_EQ(dbus::ObjectPath(std::string()), message->GetPath()); EXPECT_EQ("", message->GetInterface()); EXPECT_EQ("", message->GetMember()); EXPECT_EQ("", message->GetErrorName()); @@ -607,7 +607,7 @@ TEST(MessageTest, SetInvalidHeaders) { EXPECT_FALSE(message->SetSender("?!#*")); EXPECT_EQ("", message->GetDestination()); - EXPECT_EQ(dbus::ObjectPath(""), message->GetPath()); + EXPECT_EQ(dbus::ObjectPath(std::string()), message->GetPath()); EXPECT_EQ("", message->GetInterface()); EXPECT_EQ("", message->GetMember()); EXPECT_EQ("", message->GetErrorName()); diff --git a/dbus/string_util_unittest.cc b/dbus/string_util_unittest.cc index 76bdfcb..99eb691 100644 --- a/dbus/string_util_unittest.cc +++ b/dbus/string_util_unittest.cc @@ -10,7 +10,7 @@ TEST(StringUtilTest, IsValidObjectPath) { EXPECT_TRUE(dbus::IsValidObjectPath("/foo/bar")); EXPECT_TRUE(dbus::IsValidObjectPath("/hoge_fuga/piyo123")); // Empty string. - EXPECT_FALSE(dbus::IsValidObjectPath("")); + EXPECT_FALSE(dbus::IsValidObjectPath(std::string())); // Emptyr elemnt. EXPECT_FALSE(dbus::IsValidObjectPath("//")); EXPECT_FALSE(dbus::IsValidObjectPath("/foo//bar")); diff --git a/dbus/values_util.cc b/dbus/values_util.cc index 2e2d8e3..7574f39 100644 --- a/dbus/values_util.cc +++ b/dbus/values_util.cc @@ -79,7 +79,7 @@ std::string GetTypeSignature(const base::Value& value) { return "a{sv}"; default: DLOG(ERROR) << "Unexpected type " << value.GetType(); - return ""; + return std::string(); } } diff --git a/device/bluetooth/bluetooth_utils.cc b/device/bluetooth/bluetooth_utils.cc index 1e7b827..4f30202 100644 --- a/device/bluetooth/bluetooth_utils.cc +++ b/device/bluetooth/bluetooth_utils.cc @@ -21,18 +21,18 @@ namespace bluetooth_utils { std::string CanonicalUuid(std::string uuid) { if (uuid.empty()) - return ""; + return std::string(); if (uuid.size() < 11 && uuid.find("0x") == 0) uuid = uuid.substr(2); if (!(uuid.size() == 4 || uuid.size() == 8 || uuid.size() == 36)) - return ""; + return std::string(); if (uuid.size() == 4 || uuid.size() == 8) { for (size_t i = 0; i < uuid.size(); ++i) { if (!IsHexDigit(uuid[i])) - return ""; + return std::string(); } if (uuid.size() == 4) @@ -45,10 +45,10 @@ std::string CanonicalUuid(std::string uuid) { for (int i = 0; i < kUuidSize; ++i) { if (i == 8 || i == 13 || i == 18 || i == 23) { if (uuid[i] != '-') - return ""; + return std::string(); } else { if (!IsHexDigit(uuid[i])) - return ""; + return std::string(); uuid_result[i] = tolower(uuid[i]); } } diff --git a/device/media_transfer_protocol/media_transfer_protocol_manager.cc b/device/media_transfer_protocol/media_transfer_protocol_manager.cc index bbd13b3..d3fce03 100644 --- a/device/media_transfer_protocol/media_transfer_protocol_manager.cc +++ b/device/media_transfer_protocol/media_transfer_protocol_manager.cc @@ -111,7 +111,7 @@ class MediaTransferProtocolManagerImpl : public MediaTransferProtocolManager { const OpenStorageCallback& callback) OVERRIDE { DCHECK(thread_checker_.CalledOnValidThread()); if (!ContainsKey(storage_info_map_, storage_name)) { - callback.Run("", true); + callback.Run(std::string(), true); return; } open_storage_callbacks_.push(callback); @@ -333,13 +333,13 @@ class MediaTransferProtocolManagerImpl : public MediaTransferProtocolManager { open_storage_callbacks_.front().Run(handle, false); } else { NOTREACHED(); - open_storage_callbacks_.front().Run("", true); + open_storage_callbacks_.front().Run(std::string(), true); } open_storage_callbacks_.pop(); } void OnOpenStorageError() { - open_storage_callbacks_.front().Run("", true); + open_storage_callbacks_.front().Run(std::string(), true); open_storage_callbacks_.pop(); } diff --git a/extensions/common/extension_resource_unittest.cc b/extensions/common/extension_resource_unittest.cc index 132e718..3791b14 100644 --- a/extensions/common/extension_resource_unittest.cc +++ b/extensions/common/extension_resource_unittest.cc @@ -131,7 +131,8 @@ TEST(ExtensionResourceTest, CreateWithAllResourcesOnDisk) { ASSERT_TRUE(file_util::CreateDirectory(l10n_path)); std::vector<std::string> locales; - l10n_util::GetParentLocales(l10n_util::GetApplicationLocale(""), &locales); + l10n_util::GetParentLocales(l10n_util::GetApplicationLocale(std::string()), + &locales); ASSERT_FALSE(locales.empty()); for (size_t i = 0; i < locales.size(); i++) { base::FilePath make_path; diff --git a/extensions/common/matcher/substring_set_matcher_unittest.cc b/extensions/common/matcher/substring_set_matcher_unittest.cc index 4152ff9..fde65bf 100644 --- a/extensions/common/matcher/substring_set_matcher_unittest.cc +++ b/extensions/common/matcher/substring_set_matcher_unittest.cc @@ -117,7 +117,7 @@ TEST(SubstringSetMatcherTest, TestMatcher) { // String abcde // Pattern 1 // Pattern 2 abcdef - TestTwoPatterns("abcde", "", "abcdef", true, false); + TestTwoPatterns("abcde", std::string(), "abcdef", true, false); } TEST(SubstringSetMatcherTest, RegisterAndRemove) { diff --git a/extensions/common/matcher/url_matcher.cc b/extensions/common/matcher/url_matcher.cc index d7779a2..b599293 100644 --- a/extensions/common/matcher/url_matcher.cc +++ b/extensions/common/matcher/url_matcher.cc @@ -256,8 +256,8 @@ URLMatcherConditionFactory::~URLMatcherConditionFactory() { std::string URLMatcherConditionFactory::CanonicalizeURLForComponentSearches( const GURL& url) const { return kBeginningOfURL + CanonicalizeHostname(url.host()) + kEndOfDomain + - url.path() + kEndOfPath + (url.has_query() ? "?" + url.query() : "") + - kEndOfURL; + url.path() + kEndOfPath + + (url.has_query() ? "?" + url.query() : std::string()) + kEndOfURL; } URLMatcherCondition URLMatcherConditionFactory::CreateHostPrefixCondition( diff --git a/extensions/common/matcher/url_matcher_factory.cc b/extensions/common/matcher/url_matcher_factory.cc index cdd08ba..3ca4aa2 100644 --- a/extensions/common/matcher/url_matcher_factory.cc +++ b/extensions/common/matcher/url_matcher_factory.cc @@ -151,7 +151,8 @@ URLMatcherFactory::CreateFromURLFilterDictionary( // matched. if (url_matcher_conditions.empty()) { url_matcher_conditions.insert( - url_matcher_condition_factory->CreateHostPrefixCondition("")); + url_matcher_condition_factory->CreateHostPrefixCondition( + std::string())); } scoped_refptr<URLMatcherConditionSet> url_matcher_condition_set( diff --git a/extensions/common/matcher/url_matcher_unittest.cc b/extensions/common/matcher/url_matcher_unittest.cc index 09fc562..b17c13c 100644 --- a/extensions/common/matcher/url_matcher_unittest.cc +++ b/extensions/common/matcher/url_matcher_unittest.cc @@ -247,7 +247,7 @@ TEST(URLMatcherConditionFactoryTest, TestComponentSearches) { std::string url = factory.CanonicalizeURLForComponentSearches(gurl); // Test host component. - EXPECT_TRUE(Matches(factory.CreateHostPrefixCondition(""), url)); + EXPECT_TRUE(Matches(factory.CreateHostPrefixCondition(std::string()), url)); EXPECT_TRUE(Matches(factory.CreateHostPrefixCondition("www.goog"), url)); EXPECT_TRUE( Matches(factory.CreateHostPrefixCondition("www.google.com"), url)); @@ -258,7 +258,7 @@ TEST(URLMatcherConditionFactoryTest, TestComponentSearches) { Matches(factory.CreateHostPrefixCondition("www.google.com/"), url)); EXPECT_FALSE(Matches(factory.CreateHostPrefixCondition("webhp"), url)); - EXPECT_TRUE(Matches(factory.CreateHostSuffixCondition(""), url)); + EXPECT_TRUE(Matches(factory.CreateHostSuffixCondition(std::string()), url)); EXPECT_TRUE(Matches(factory.CreateHostSuffixCondition("com"), url)); EXPECT_TRUE(Matches(factory.CreateHostSuffixCondition(".com"), url)); EXPECT_TRUE( @@ -270,7 +270,7 @@ TEST(URLMatcherConditionFactoryTest, TestComponentSearches) { Matches(factory.CreateHostSuffixCondition("www.google.com/"), url)); EXPECT_FALSE(Matches(factory.CreateHostSuffixCondition("webhp"), url)); - EXPECT_FALSE(Matches(factory.CreateHostEqualsCondition(""), url)); + EXPECT_FALSE(Matches(factory.CreateHostEqualsCondition(std::string()), url)); EXPECT_FALSE(Matches(factory.CreateHostEqualsCondition("www"), url)); EXPECT_TRUE( Matches(factory.CreateHostEqualsCondition("www.google.com"), url)); @@ -279,14 +279,14 @@ TEST(URLMatcherConditionFactoryTest, TestComponentSearches) { // Test path component. - EXPECT_TRUE(Matches(factory.CreatePathPrefixCondition(""), url)); + EXPECT_TRUE(Matches(factory.CreatePathPrefixCondition(std::string()), url)); EXPECT_TRUE(Matches(factory.CreatePathPrefixCondition("/web"), url)); EXPECT_TRUE(Matches(factory.CreatePathPrefixCondition("/webhp"), url)); EXPECT_FALSE(Matches(factory.CreatePathPrefixCondition("webhp"), url)); EXPECT_FALSE(Matches(factory.CreatePathPrefixCondition("/webhp?"), url)); EXPECT_FALSE(Matches(factory.CreatePathPrefixCondition("?sourceid"), url)); - EXPECT_TRUE(Matches(factory.CreatePathSuffixCondition(""), url)); + EXPECT_TRUE(Matches(factory.CreatePathSuffixCondition(std::string()), url)); EXPECT_TRUE(Matches(factory.CreatePathSuffixCondition("webhp"), url)); EXPECT_TRUE(Matches(factory.CreatePathSuffixCondition("/webhp"), url)); EXPECT_FALSE(Matches(factory.CreatePathSuffixCondition("/web"), url)); @@ -300,12 +300,12 @@ TEST(URLMatcherConditionFactoryTest, TestComponentSearches) { // Test query component. - EXPECT_TRUE(Matches(factory.CreateQueryPrefixCondition(""), url)); + EXPECT_TRUE(Matches(factory.CreateQueryPrefixCondition(std::string()), url)); EXPECT_TRUE(Matches(factory.CreateQueryPrefixCondition("sourceid"), url)); // The '?' at the beginning is just ignored. EXPECT_TRUE(Matches(factory.CreateQueryPrefixCondition("?sourceid"), url)); - EXPECT_TRUE(Matches(factory.CreateQuerySuffixCondition(""), url)); + EXPECT_TRUE(Matches(factory.CreateQuerySuffixCondition(std::string()), url)); EXPECT_TRUE(Matches(factory.CreateQuerySuffixCondition("ion=1"), url)); EXPECT_FALSE(Matches(factory.CreateQuerySuffixCondition("www"), url)); // "Suffix" condition + pattern starting with '?' = "equals" condition. @@ -330,21 +330,26 @@ TEST(URLMatcherConditionFactoryTest, TestComponentSearches) { // Test adjacent components EXPECT_TRUE(Matches(factory.CreateHostSuffixPathPrefixCondition( "google.com", "/webhp"), url)); - EXPECT_TRUE(Matches(factory.CreateHostSuffixPathPrefixCondition( - "", "/webhp"), url)); - EXPECT_TRUE(Matches(factory.CreateHostSuffixPathPrefixCondition( - "google.com", ""), url)); - EXPECT_FALSE(Matches(factory.CreateHostSuffixPathPrefixCondition( - "www", ""), url)); + EXPECT_TRUE(Matches( + factory.CreateHostSuffixPathPrefixCondition(std::string(), "/webhp"), + url)); + EXPECT_TRUE(Matches( + factory.CreateHostSuffixPathPrefixCondition("google.com", std::string()), + url)); + EXPECT_FALSE(Matches( + factory.CreateHostSuffixPathPrefixCondition("www", std::string()), url)); EXPECT_TRUE(Matches(factory.CreateHostEqualsPathPrefixCondition( "www.google.com", "/webhp"), url)); - EXPECT_FALSE(Matches(factory.CreateHostEqualsPathPrefixCondition( - "", "/webhp"), url)); + EXPECT_FALSE(Matches( + factory.CreateHostEqualsPathPrefixCondition(std::string(), "/webhp"), + url)); EXPECT_TRUE(Matches(factory.CreateHostEqualsPathPrefixCondition( - "www.google.com", ""), url)); - EXPECT_FALSE(Matches(factory.CreateHostEqualsPathPrefixCondition( - "google.com", ""), url)); + "www.google.com", std::string()), + url)); + EXPECT_FALSE(Matches( + factory.CreateHostEqualsPathPrefixCondition("google.com", std::string()), + url)); } TEST(URLMatcherConditionFactoryTest, TestFullSearches) { @@ -354,9 +359,9 @@ TEST(URLMatcherConditionFactoryTest, TestFullSearches) { URLMatcherConditionFactory factory; std::string url = factory.CanonicalizeURLForFullSearches(gurl); - EXPECT_TRUE(Matches(factory.CreateURLPrefixCondition(""), url)); - EXPECT_TRUE(Matches(factory.CreateURLPrefixCondition( - "https://www.goog"), url)); + EXPECT_TRUE(Matches(factory.CreateURLPrefixCondition(std::string()), url)); + EXPECT_TRUE( + Matches(factory.CreateURLPrefixCondition("https://www.goog"), url)); EXPECT_TRUE(Matches(factory.CreateURLPrefixCondition( "https://www.google.com"), url)); EXPECT_TRUE(Matches(factory.CreateURLPrefixCondition( @@ -365,11 +370,11 @@ TEST(URLMatcherConditionFactoryTest, TestFullSearches) { "http://www.google.com"), url)); EXPECT_FALSE(Matches(factory.CreateURLPrefixCondition("webhp"), url)); - EXPECT_TRUE(Matches(factory.CreateURLSuffixCondition(""), url)); + EXPECT_TRUE(Matches(factory.CreateURLSuffixCondition(std::string()), url)); EXPECT_TRUE(Matches(factory.CreateURLSuffixCondition("ion=1"), url)); EXPECT_FALSE(Matches(factory.CreateURLSuffixCondition("www"), url)); - EXPECT_TRUE(Matches(factory.CreateURLContainsCondition(""), url)); + EXPECT_TRUE(Matches(factory.CreateURLContainsCondition(std::string()), url)); EXPECT_TRUE(Matches(factory.CreateURLContainsCondition("www.goog"), url)); EXPECT_TRUE(Matches(factory.CreateURLContainsCondition("webhp"), url)); EXPECT_TRUE(Matches(factory.CreateURLContainsCondition("?"), url)); diff --git a/google_apis/gaia/gaia_auth_fetcher.cc b/google_apis/gaia/gaia_auth_fetcher.cc index 9354447..15aa78a 100644 --- a/google_apis/gaia/gaia_auth_fetcher.cc +++ b/google_apis/gaia/gaia_auth_fetcher.cc @@ -617,7 +617,7 @@ void GaiaAuthFetcher::StartClientLogin( allow_hosted_accounts); fetcher_.reset(CreateGaiaFetcher(getter_, request_body_, - "", + std::string(), client_login_gurl_, kLoadFlagsIgnoreCookies, this)); @@ -635,7 +635,7 @@ void GaiaAuthFetcher::StartIssueAuthToken(const std::string& sid, request_body_ = MakeIssueAuthTokenBody(sid, lsid, service); fetcher_.reset(CreateGaiaFetcher(getter_, request_body_, - "", + std::string(), issue_auth_token_gurl_, kLoadFlagsIgnoreCookies, this)); @@ -669,7 +669,7 @@ void GaiaAuthFetcher::StartRevokeOAuth2Token(const std::string& auth_token) { request_body_ = MakeRevokeTokenBody(auth_token); fetcher_.reset(CreateGaiaFetcher(getter_, request_body_, - "", + std::string(), oauth2_revoke_gurl_, kLoadFlagsIgnoreCookies, this)); @@ -692,7 +692,7 @@ void GaiaAuthFetcher::StartCookieForOAuthLoginTokenExchange( fetcher_.reset(CreateGaiaFetcher(getter_, request_body_, - "", + std::string(), client_login_to_oauth2_gurl_, net::LOAD_NORMAL, this)); @@ -708,7 +708,7 @@ void GaiaAuthFetcher::StartAuthCodeForOAuth2TokenExchange( request_body_ = MakeGetTokenPairBody(auth_code); fetcher_.reset(CreateGaiaFetcher(getter_, request_body_, - "", + std::string(), oauth2_token_gurl_, kLoadFlagsIgnoreCookies, this)); @@ -723,7 +723,7 @@ void GaiaAuthFetcher::StartGetUserInfo(const std::string& lsid) { request_body_ = MakeGetUserInfoBody(lsid); fetcher_.reset(CreateGaiaFetcher(getter_, request_body_, - "", + std::string(), get_user_info_gurl_, kLoadFlagsIgnoreCookies, this)); @@ -748,7 +748,7 @@ void GaiaAuthFetcher::StartMergeSession(const std::string& uber_token) { request_body_ = MakeMergeSessionBody(uber_token, continue_url, source_); fetcher_.reset(CreateGaiaFetcher(getter_, request_body_, - "", + std::string(), merge_session_gurl_, net::LOAD_NORMAL, this)); @@ -765,7 +765,7 @@ void GaiaAuthFetcher::StartTokenFetchForUberAuthExchange( std::string authentication_header = base::StringPrintf(kOAuthHeaderFormat, access_token.c_str()); fetcher_.reset(CreateGaiaFetcher(getter_, - "", + std::string(), authentication_header, uberauth_token_gurl_, kLoadFlagsIgnoreCookies, @@ -785,7 +785,7 @@ void GaiaAuthFetcher::StartClientOAuth(const std::string& username, source_, locale); fetcher_.reset(CreateGaiaFetcher(getter_, request_body_, - "", + std::string(), client_oauth_gurl_, kLoadFlagsIgnoreCookies, this)); @@ -814,7 +814,7 @@ void GaiaAuthFetcher::StartClientOAuthChallengeResponse( request_body_ = MakeClientOAuthChallengeResponseBody(name, token, solution); fetcher_.reset(CreateGaiaFetcher(getter_, request_body_, - "", + std::string(), client_oauth_gurl_, kLoadFlagsIgnoreCookies, this)); diff --git a/google_apis/gaia/gaia_auth_fetcher_unittest.cc b/google_apis/gaia/gaia_auth_fetcher_unittest.cc index 226ee1a..47b6d15 100644 --- a/google_apis/gaia/gaia_auth_fetcher_unittest.cc +++ b/google_apis/gaia/gaia_auth_fetcher_unittest.cc @@ -311,10 +311,10 @@ TEST_F(GaiaAuthFetcherTest, ParseRequest) { RunParsingTest("SID=sid\nLSID=lsid\nAuth=auth\n", "sid", "lsid", "auth"); RunParsingTest("LSID=lsid\nSID=sid\nAuth=auth\n", "sid", "lsid", "auth"); RunParsingTest("SID=sid\nLSID=lsid\nAuth=auth", "sid", "lsid", "auth"); - RunParsingTest("SID=sid\nAuth=auth\n", "sid", "", "auth"); - RunParsingTest("LSID=lsid\nAuth=auth\n", "", "lsid", "auth"); - RunParsingTest("\nAuth=auth\n", "", "", "auth"); - RunParsingTest("SID=sid", "sid", "", ""); + RunParsingTest("SID=sid\nAuth=auth\n", "sid", std::string(), "auth"); + RunParsingTest("LSID=lsid\nAuth=auth\n", std::string(), "lsid", "auth"); + RunParsingTest("\nAuth=auth\n", std::string(), std::string(), "auth"); + RunParsingTest("SID=sid", "sid", std::string(), std::string()); } TEST_F(GaiaAuthFetcherTest, ParseErrorRequest) { @@ -588,7 +588,11 @@ TEST_F(GaiaAuthFetcherTest, FullTokenFailure) { MockFetcher mock_fetcher( issue_auth_token_source_, net::URLRequestStatus(net::URLRequestStatus::SUCCESS, 0), - net::HTTP_FORBIDDEN, cookies_, "", net::URLFetcher::GET, &auth); + net::HTTP_FORBIDDEN, + cookies_, + std::string(), + net::URLFetcher::GET, + &auth); auth.OnURLFetchComplete(&mock_fetcher); EXPECT_FALSE(auth.HasPendingFetch()); } @@ -613,8 +617,11 @@ TEST_F(GaiaAuthFetcherTest, OAuthLoginTokenSuccess) { MockFetcher mock_fetcher1( client_login_to_oauth2_source_, net::URLRequestStatus(net::URLRequestStatus::SUCCESS, 0), - net::HTTP_OK, cookies, "", - net::URLFetcher::POST, &auth); + net::HTTP_OK, + cookies, + std::string(), + net::URLFetcher::POST, + &auth); auth.OnURLFetchComplete(&mock_fetcher1); EXPECT_TRUE(auth.HasPendingFetch()); MockFetcher mock_fetcher2( @@ -652,8 +659,11 @@ TEST_F(GaiaAuthFetcherTest, OAuthLoginTokenClientLoginToOAuth2Failure) { MockFetcher mock_fetcher( client_login_to_oauth2_source_, net::URLRequestStatus(net::URLRequestStatus::SUCCESS, 0), - net::HTTP_FORBIDDEN, cookies, "", - net::URLFetcher::POST, &auth); + net::HTTP_FORBIDDEN, + cookies, + std::string(), + net::URLFetcher::POST, + &auth); auth.OnURLFetchComplete(&mock_fetcher); EXPECT_FALSE(auth.HasPendingFetch()); } @@ -674,15 +684,21 @@ TEST_F(GaiaAuthFetcherTest, OAuthLoginTokenOAuth2TokenPairFailure) { MockFetcher mock_fetcher1( client_login_to_oauth2_source_, net::URLRequestStatus(net::URLRequestStatus::SUCCESS, 0), - net::HTTP_OK, cookies, "", - net::URLFetcher::POST, &auth); + net::HTTP_OK, + cookies, + std::string(), + net::URLFetcher::POST, + &auth); auth.OnURLFetchComplete(&mock_fetcher1); EXPECT_TRUE(auth.HasPendingFetch()); MockFetcher mock_fetcher2( oauth2_token_source_, net::URLRequestStatus(net::URLRequestStatus::SUCCESS, 0), - net::HTTP_FORBIDDEN, cookies_, "", - net::URLFetcher::POST, &auth); + net::HTTP_FORBIDDEN, + cookies_, + std::string(), + net::URLFetcher::POST, + &auth); auth.OnURLFetchComplete(&mock_fetcher2); EXPECT_FALSE(auth.HasPendingFetch()); } @@ -810,7 +826,7 @@ TEST_F(GaiaAuthFetcherTest, ClientOAuthSuccess) { std::vector<std::string> scopes; scopes.push_back(GaiaUrls::GetInstance()->oauth1_login_scope()); scopes.push_back("https://some.other.scope.com"); - auth.StartClientOAuth("username", "password", scopes, "", "en"); + auth.StartClientOAuth("username", "password", scopes, std::string(), "en"); std::string expected_text = base::StringPrintf( "{" @@ -842,7 +858,8 @@ TEST_F(GaiaAuthFetcherTest, ClientOAuthWithQuote) { GaiaAuthFetcher auth(&consumer, "te\"sts", profile_.GetRequestContext()); std::vector<std::string> scopes; scopes.push_back("https://some.\"other.scope.com"); - auth.StartClientOAuth("user\"name", "pass\"word", scopes, "", "e\"n"); + auth.StartClientOAuth( + "user\"name", "pass\"word", scopes, std::string(), "e\"n"); std::string expected_text = base::StringPrintf( "{" @@ -879,7 +896,7 @@ TEST_F(GaiaAuthFetcherTest, ClientOAuthBadAuth) { GaiaAuthFetcher auth(&consumer, "tests", profile_.GetRequestContext()); std::vector<std::string> scopes; scopes.push_back(GaiaUrls::GetInstance()->oauth1_login_scope()); - auth.StartClientOAuth("username", "password", scopes, "", "en"); + auth.StartClientOAuth("username", "password", scopes, std::string(), "en"); } TEST_F(GaiaAuthFetcherTest, ClientOAuthCaptchaChallenge) { @@ -908,7 +925,7 @@ TEST_F(GaiaAuthFetcherTest, ClientOAuthCaptchaChallenge) { GaiaAuthFetcher auth(&consumer, "tests", profile_.GetRequestContext()); std::vector<std::string> scopes; scopes.push_back(GaiaUrls::GetInstance()->oauth1_login_scope()); - auth.StartClientOAuth("username", "password", scopes, "", "en"); + auth.StartClientOAuth("username", "password", scopes, std::string(), "en"); } TEST_F(GaiaAuthFetcherTest, ClientOAuthTwoFactorChallenge) { @@ -936,7 +953,7 @@ TEST_F(GaiaAuthFetcherTest, ClientOAuthTwoFactorChallenge) { GaiaAuthFetcher auth(&consumer, "tests", profile_.GetRequestContext()); std::vector<std::string> scopes; scopes.push_back(GaiaUrls::GetInstance()->oauth1_login_scope()); - auth.StartClientOAuth("username", "password", scopes, "", "en"); + auth.StartClientOAuth("username", "password", scopes, std::string(), "en"); } TEST_F(GaiaAuthFetcherTest, ClientOAuthChallengeSuccess) { diff --git a/google_apis/gaia/google_service_auth_error.cc b/google_apis/gaia/google_service_auth_error.cc index 8beeb4d..96fc063 100644 --- a/google_apis/gaia/google_service_auth_error.cc +++ b/google_apis/gaia/google_service_auth_error.cc @@ -225,7 +225,7 @@ DictionaryValue* GoogleServiceAuthError::ToValue() const { std::string GoogleServiceAuthError::ToString() const { switch (state_) { case NONE: - return ""; + return std::string(); case INVALID_GAIA_CREDENTIALS: return "Invalid credentials."; case USER_NOT_SIGNED_UP: diff --git a/google_apis/gaia/google_service_auth_error_unittest.cc b/google_apis/gaia/google_service_auth_error_unittest.cc index 59aa510..15155b6 100644 --- a/google_apis/gaia/google_service_auth_error_unittest.cc +++ b/google_apis/gaia/google_service_auth_error_unittest.cc @@ -64,7 +64,7 @@ TEST_F(GoogleServiceAuthErrorTest, CaptchaChallenge) { EXPECT_TRUE(value->GetDictionary("captcha", &captcha_value)); ASSERT_TRUE(captcha_value); ExpectDictStringValue("captcha_token", *captcha_value, "token"); - ExpectDictStringValue("", *captcha_value, "audioUrl"); + ExpectDictStringValue(std::string(), *captcha_value, "audioUrl"); ExpectDictStringValue("http://www.google.com/", *captcha_value, "imageUrl"); ExpectDictStringValue("http://www.bing.com/", *captcha_value, "unlockUrl"); ExpectDictIntegerValue(0, *captcha_value, "imageWidth"); diff --git a/google_apis/gaia/oauth2_access_token_fetcher_unittest.cc b/google_apis/gaia/oauth2_access_token_fetcher_unittest.cc index feb8020..7c761c7 100644 --- a/google_apis/gaia/oauth2_access_token_fetcher_unittest.cc +++ b/google_apis/gaia/oauth2_access_token_fetcher_unittest.cc @@ -120,7 +120,7 @@ class OAuth2AccessTokenFetcherTest : public testing::Test { // These four tests time out, see http://crbug.com/113446. TEST_F(OAuth2AccessTokenFetcherTest, DISABLED_GetAccessTokenRequestFailure) { - TestURLFetcher* url_fetcher = SetupGetAccessToken(false, 0, ""); + TestURLFetcher* url_fetcher = SetupGetAccessToken(false, 0, std::string()); EXPECT_CALL(consumer_, OnGetTokenFailure(_)).Times(1); fetcher_.Start("client_id", "client_secret", "refresh_token", ScopeList()); fetcher_.OnURLFetchComplete(url_fetcher); @@ -129,7 +129,7 @@ TEST_F(OAuth2AccessTokenFetcherTest, DISABLED_GetAccessTokenRequestFailure) { TEST_F(OAuth2AccessTokenFetcherTest, DISABLED_GetAccessTokenResponseCodeFailure) { TestURLFetcher* url_fetcher = - SetupGetAccessToken(true, net::HTTP_FORBIDDEN, ""); + SetupGetAccessToken(true, net::HTTP_FORBIDDEN, std::string()); EXPECT_CALL(consumer_, OnGetTokenFailure(_)).Times(1); fetcher_.Start("client_id", "client_secret", "refresh_token", ScopeList()); fetcher_.OnURLFetchComplete(url_fetcher); diff --git a/google_apis/gaia/oauth2_api_call_flow_unittest.cc b/google_apis/gaia/oauth2_api_call_flow_unittest.cc index 137eaeb..4e8692e 100644 --- a/google_apis/gaia/oauth2_api_call_flow_unittest.cc +++ b/google_apis/gaia/oauth2_api_call_flow_unittest.cc @@ -158,8 +158,8 @@ class OAuth2ApiCallFlowTest : public testing::Test { GURL url(CreateApiUrl()); EXPECT_CALL(*flow_, CreateApiCallBody()).WillOnce(Return(body)); EXPECT_CALL(*flow_, CreateApiCallUrl()).WillOnce(Return(url)); - TestURLFetcher* url_fetcher = CreateURLFetcher( - url, succeeds, status, ""); + TestURLFetcher* url_fetcher = + CreateURLFetcher(url, succeeds, status, std::string()); EXPECT_CALL(factory_, CreateURLFetcher(_, url, _, _)) .WillOnce(Return(url_fetcher)); return url_fetcher; @@ -240,7 +240,7 @@ TEST_F(OAuth2ApiCallFlowTest, EmptyAccessTokenFirstApiCallSucceeds) { std::string at = "access_token"; std::vector<std::string> scopes(CreateTestScopes()); - CreateFlow(rt, "", scopes); + CreateFlow(rt, std::string(), scopes); SetupAccessTokenFetcher(rt, scopes); TestURLFetcher* url_fetcher = SetupApiCall(true, net::HTTP_OK); EXPECT_CALL(*flow_, ProcessApiCallSuccess(url_fetcher)); @@ -256,7 +256,7 @@ TEST_F(OAuth2ApiCallFlowTest, EmptyAccessTokenApiCallFails) { std::string at = "access_token"; std::vector<std::string> scopes(CreateTestScopes()); - CreateFlow(rt, "", scopes); + CreateFlow(rt, std::string(), scopes); SetupAccessTokenFetcher(rt, scopes); TestURLFetcher* url_fetcher = SetupApiCall(false, net::HTTP_BAD_GATEWAY); EXPECT_CALL(*flow_, ProcessApiCallFailure(url_fetcher)); @@ -272,7 +272,7 @@ TEST_F(OAuth2ApiCallFlowTest, EmptyAccessTokenNewTokenGenerationFails) { std::string at = "access_token"; std::vector<std::string> scopes(CreateTestScopes()); - CreateFlow(rt, "", scopes); + CreateFlow(rt, std::string(), scopes); SetupAccessTokenFetcher(rt, scopes); GoogleServiceAuthError error( GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS); diff --git a/google_apis/gaia/oauth2_mint_token_flow.cc b/google_apis/gaia/oauth2_mint_token_flow.cc index 42fc4ef..169d187 100644 --- a/google_apis/gaia/oauth2_mint_token_flow.cc +++ b/google_apis/gaia/oauth2_mint_token_flow.cc @@ -89,17 +89,16 @@ OAuth2MintTokenFlow::Parameters::Parameters( OAuth2MintTokenFlow::Parameters::~Parameters() {} -OAuth2MintTokenFlow::OAuth2MintTokenFlow( - URLRequestContextGetter* context, - Delegate* delegate, - const Parameters& parameters) - : OAuth2ApiCallFlow( - context, parameters.login_refresh_token, - "", std::vector<std::string>()), +OAuth2MintTokenFlow::OAuth2MintTokenFlow(URLRequestContextGetter* context, + Delegate* delegate, + const Parameters& parameters) + : OAuth2ApiCallFlow(context, + parameters.login_refresh_token, + std::string(), + std::vector<std::string>()), delegate_(delegate), parameters_(parameters), - ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) { -} + ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) {} OAuth2MintTokenFlow::~OAuth2MintTokenFlow() { } diff --git a/google_apis/gaia/oauth2_mint_token_flow_unittest.cc b/google_apis/gaia/oauth2_mint_token_flow_unittest.cc index e213984..3206601 100644 --- a/google_apis/gaia/oauth2_mint_token_flow_unittest.cc +++ b/google_apis/gaia/oauth2_mint_token_flow_unittest.cc @@ -272,7 +272,7 @@ TEST_F(OAuth2MintTokenFlowTest, ParseIssueAdviceResponse) { TEST_F(OAuth2MintTokenFlowTest, ProcessApiCallSuccess) { { // No body. TestURLFetcher url_fetcher(1, GURL("http://www.google.com"), NULL); - url_fetcher.SetResponseString(""); + url_fetcher.SetResponseString(std::string()); CreateFlow(OAuth2MintTokenFlow::MODE_MINT_TOKEN_NO_FORCE); EXPECT_CALL(delegate_, OnMintTokenFailure(_)); flow_->ProcessApiCallSuccess(&url_fetcher); diff --git a/google_apis/gaia/oauth_request_signer.cc b/google_apis/gaia/oauth_request_signer.cc index b5d138f..9952a6f 100644 --- a/google_apis/gaia/oauth_request_signer.cc +++ b/google_apis/gaia/oauth_request_signer.cc @@ -89,7 +89,7 @@ std::string BuildBaseString(const GURL& request_base_url, std::string BuildBaseStringParameters( const OAuthRequestSigner::Parameters& parameters) { - std::string result = ""; + std::string result; OAuthRequestSigner::Parameters::const_iterator cursor; OAuthRequestSigner::Parameters::const_iterator limit; bool first = true; @@ -297,7 +297,7 @@ bool SignParameters(const GURL& request_base_url, // static bool OAuthRequestSigner::Decode(const std::string& text, std::string* decoded_text) { - std::string accumulator = ""; + std::string accumulator; std::string::const_iterator cursor; std::string::const_iterator limit; for (limit = text.end(), cursor = text.begin(); cursor != limit; ++cursor) { @@ -335,7 +335,7 @@ bool OAuthRequestSigner::Decode(const std::string& text, // static std::string OAuthRequestSigner::Encode(const std::string& text) { - std::string result = ""; + std::string result; std::string::const_iterator cursor; std::string::const_iterator limit; for (limit = text.end(), cursor = text.begin(); cursor != limit; ++cursor) { diff --git a/google_apis/gaia/oauth_request_signer_unittest.cc b/google_apis/gaia/oauth_request_signer_unittest.cc index 5cf2dc2..40206f6 100644 --- a/google_apis/gaia/oauth_request_signer_unittest.cc +++ b/google_apis/gaia/oauth_request_signer_unittest.cc @@ -109,15 +109,15 @@ TEST(OAuthRequestSignerTest, SignGet2) { parameters["oauth_nonce"] = "4d4hZW9DygWQujP2tz06UN"; std::string signed_text; ASSERT_TRUE(OAuthRequestSigner::SignURL( - request_url, - parameters, - OAuthRequestSigner::HMAC_SHA1_SIGNATURE, - OAuthRequestSigner::GET_METHOD, - "anonymous", // oauth_consumer_key - "anonymous", // consumer secret - "4/CcC-hgdj1TNnWaX8NTQ76YDXCBEK", // oauth_token - "", // token secret - &signed_text)); + request_url, + parameters, + OAuthRequestSigner::HMAC_SHA1_SIGNATURE, + OAuthRequestSigner::GET_METHOD, + "anonymous", // oauth_consumer_key + "anonymous", // consumer secret + "4/CcC-hgdj1TNnWaX8NTQ76YDXCBEK", // oauth_token + std::string(), // token secret + &signed_text)); ASSERT_EQ(signed_text, "https://accounts.google.com/OAuthGetAccessToken" "?oauth_consumer_key=anonymous" @@ -137,14 +137,14 @@ TEST(OAuthRequestSignerTest, ParseAndSignGet1) { "&oauth_timestamp=1308152953"); std::string signed_text; ASSERT_TRUE(OAuthRequestSigner::ParseAndSign( - request_url, - OAuthRequestSigner::HMAC_SHA1_SIGNATURE, - OAuthRequestSigner::GET_METHOD, - "anonymous", // oauth_consumer_key - "anonymous", // consumer secret - "4/CcC-hgdj1TNnWaX8NTQ76YDXCBEK", // oauth_token - "", // token secret - &signed_text)); + request_url, + OAuthRequestSigner::HMAC_SHA1_SIGNATURE, + OAuthRequestSigner::GET_METHOD, + "anonymous", // oauth_consumer_key + "anonymous", // consumer secret + "4/CcC-hgdj1TNnWaX8NTQ76YDXCBEK", // oauth_token + std::string(), // token secret + &signed_text)); ASSERT_EQ("https://www.google.com/accounts/o8/GetOAuthToken" "?oauth_consumer_key=anonymous" "&oauth_nonce=2oiE_aHdk5qRTz0L9C8Lq0g" @@ -164,14 +164,14 @@ TEST(OAuthRequestSignerTest, ParseAndSignGet2) { "&oauth_nonce=4d4hZW9DygWQujP2tz06UN"); std::string signed_text; ASSERT_TRUE(OAuthRequestSigner::ParseAndSign( - request_url, - OAuthRequestSigner::HMAC_SHA1_SIGNATURE, - OAuthRequestSigner::GET_METHOD, - "anonymous", // oauth_consumer_key - "anonymous", // consumer secret - "4/CcC-hgdj1TNnWaX8NTQ76YDXCBEK", // oauth_token - "", // token secret - &signed_text)); + request_url, + OAuthRequestSigner::HMAC_SHA1_SIGNATURE, + OAuthRequestSigner::GET_METHOD, + "anonymous", // oauth_consumer_key + "anonymous", // consumer secret + "4/CcC-hgdj1TNnWaX8NTQ76YDXCBEK", // oauth_token + std::string(), // token secret + &signed_text)); ASSERT_EQ(signed_text, "https://accounts.google.com/OAuthGetAccessToken" "?oauth_consumer_key=anonymous" @@ -220,15 +220,15 @@ TEST(OAuthRequestSignerTest, SignPost2) { parameters["oauth_nonce"] = "17171717171717171"; std::string signed_text; ASSERT_TRUE(OAuthRequestSigner::SignURL( - request_url, - parameters, - OAuthRequestSigner::HMAC_SHA1_SIGNATURE, - OAuthRequestSigner::POST_METHOD, - "anonymous", // oauth_consumer_key - "anonymous", // consumer secret - "4/CcC-hgdj1TNnWaX8NTQ76YDXCBEK", // oauth_token - "", // token secret - &signed_text)); + request_url, + parameters, + OAuthRequestSigner::HMAC_SHA1_SIGNATURE, + OAuthRequestSigner::POST_METHOD, + "anonymous", // oauth_consumer_key + "anonymous", // consumer secret + "4/CcC-hgdj1TNnWaX8NTQ76YDXCBEK", // oauth_token + std::string(), // token secret + &signed_text)); ASSERT_EQ(signed_text, "oauth_consumer_key=anonymous" "&oauth_nonce=17171717171717171" @@ -273,14 +273,14 @@ TEST(OAuthRequestSignerTest, ParseAndSignPost2) { "&oauth_nonce=17171717171717171"); std::string signed_text; ASSERT_TRUE(OAuthRequestSigner::ParseAndSign( - request_url, - OAuthRequestSigner::HMAC_SHA1_SIGNATURE, - OAuthRequestSigner::POST_METHOD, - "anonymous", // oauth_consumer_key - "anonymous", // consumer secret - "4/CcC-hgdj1TNnWaX8NTQ76YDXCBEK", // oauth_token - "", // token secret - &signed_text)); + request_url, + OAuthRequestSigner::HMAC_SHA1_SIGNATURE, + OAuthRequestSigner::POST_METHOD, + "anonymous", // oauth_consumer_key + "anonymous", // consumer secret + "4/CcC-hgdj1TNnWaX8NTQ76YDXCBEK", // oauth_token + std::string(), // token secret + &signed_text)); ASSERT_EQ(signed_text, "oauth_consumer_key=anonymous" "&oauth_nonce=17171717171717171" diff --git a/google_apis/google_api_keys.cc b/google_apis/google_api_keys.cc index cd13b9e..c05435e 100644 --- a/google_apis/google_api_keys.cc +++ b/google_apis/google_api_keys.cc @@ -98,22 +98,25 @@ class APIKeyCache { api_key_ = CalculateKeyValue(GOOGLE_API_KEY, STRINGIZE_NO_EXPANSION(GOOGLE_API_KEY), - NULL, "", + NULL, + std::string(), environment.get(), command_line); - std::string default_client_id = CalculateKeyValue( - GOOGLE_DEFAULT_CLIENT_ID, - STRINGIZE_NO_EXPANSION(GOOGLE_DEFAULT_CLIENT_ID), - NULL, "", - environment.get(), - command_line); - std::string default_client_secret = CalculateKeyValue( - GOOGLE_DEFAULT_CLIENT_SECRET, - STRINGIZE_NO_EXPANSION(GOOGLE_DEFAULT_CLIENT_SECRET), - NULL, "", - environment.get(), - command_line); + std::string default_client_id = + CalculateKeyValue(GOOGLE_DEFAULT_CLIENT_ID, + STRINGIZE_NO_EXPANSION(GOOGLE_DEFAULT_CLIENT_ID), + NULL, + std::string(), + environment.get(), + command_line); + std::string default_client_secret = + CalculateKeyValue(GOOGLE_DEFAULT_CLIENT_SECRET, + STRINGIZE_NO_EXPANSION(GOOGLE_DEFAULT_CLIENT_SECRET), + NULL, + std::string(), + environment.get(), + command_line); // We currently only allow overriding the baked-in values for the // default OAuth2 client ID and secret using a command-line diff --git a/gpu/command_buffer/service/program_manager.cc b/gpu/command_buffer/service/program_manager.cc index 747d157..5c31f14 100644 --- a/gpu/command_buffer/service/program_manager.cc +++ b/gpu/command_buffer/service/program_manager.cc @@ -445,8 +445,8 @@ void ProgramManager::DoCompileShader(Shader* shader, FeatureInfo* feature_info) { TimeTicks before = TimeTicks::HighResNow(); if (program_cache_ && - program_cache_->GetShaderCompilationStatus(shader->source() ? - *shader->source() : "") == + program_cache_->GetShaderCompilationStatus( + shader->source() ? *shader->source() : std::string()) == ProgramCache::COMPILATION_SUCCEEDED) { shader->SetStatus(true, "", translator); shader->FlagSourceAsCompiled(false); @@ -525,9 +525,9 @@ void ProgramManager::ForceCompileShader(const std::string* source, LOG_IF(ERROR, translator) << "Shader translator allowed/produced an invalid shader " << "unless the driver is buggy:" - << "\n--original-shader--\n" << (source ? *source : "") - << "\n--translated-shader--\n" << shader_src - << "\n--info-log--\n" << *shader->log_info(); + << "\n--original-shader--\n" << (source ? *source : std::string()) + << "\n--translated-shader--\n" << shader_src << "\n--info-log--\n" + << *shader->log_info(); } } diff --git a/ipc/ipc_channel_factory.cc b/ipc/ipc_channel_factory.cc index d355328..3d5c866 100644 --- a/ipc/ipc_channel_factory.cc +++ b/ipc/ipc_channel_factory.cc @@ -64,7 +64,8 @@ void ChannelFactory::OnFileCanReadWithoutBlocking(int fd) { if (!IsPeerAuthorized(new_fd)) return; - ChannelHandle handle("", base::FileDescriptor(*scoped_fd.release(), true)); + ChannelHandle handle(std::string(), + base::FileDescriptor(*scoped_fd.release(), true)); delegate_->OnClientConnected(handle); } diff --git a/jingle/glue/channel_socket_adapter_unittest.cc b/jingle/glue/channel_socket_adapter_unittest.cc index c9b0bb7..d90cbca 100644 --- a/jingle/glue/channel_socket_adapter_unittest.cc +++ b/jingle/glue/channel_socket_adapter_unittest.cc @@ -29,8 +29,7 @@ const int kTestError = -32123; class MockTransportChannel : public cricket::TransportChannel { public: - MockTransportChannel() - : cricket::TransportChannel("", 0) { + MockTransportChannel() : cricket::TransportChannel(std::string(), 0) { set_writable(true); set_readable(true); } diff --git a/jingle/notifier/base/gaia_token_pre_xmpp_auth.cc b/jingle/notifier/base/gaia_token_pre_xmpp_auth.cc index 24aa6a9..f7ddf8d 100644 --- a/jingle/notifier/base/gaia_token_pre_xmpp_auth.cc +++ b/jingle/notifier/base/gaia_token_pre_xmpp_auth.cc @@ -101,9 +101,10 @@ std::string GaiaTokenPreXmppAuth::GetAuthMechanism() const { std::string GaiaTokenPreXmppAuth::ChooseBestSaslMechanism( const std::vector<std::string> & mechanisms, bool encrypted) { - return (std::find(mechanisms.begin(), - mechanisms.end(), auth_mechanism_) != - mechanisms.end()) ? auth_mechanism_ : ""; + return (std::find(mechanisms.begin(), mechanisms.end(), auth_mechanism_) != + mechanisms.end()) + ? auth_mechanism_ + : std::string(); } buzz::SaslMechanism* GaiaTokenPreXmppAuth::CreateSaslMechanism( diff --git a/jingle/notifier/communicator/single_login_attempt.cc b/jingle/notifier/communicator/single_login_attempt.cc index dda0cfe..49fcdee 100644 --- a/jingle/notifier/communicator/single_login_attempt.cc +++ b/jingle/notifier/communicator/single_login_attempt.cc @@ -85,9 +85,9 @@ net::HostPortPair ParseRedirectText(const std::string& redirect_text) { void SingleLoginAttempt::OnError(buzz::XmppEngine::Error error, int subcode, const buzz::XmlElement* stream_error) { DVLOG(1) << "Error: " << error << ", subcode: " << subcode - << (stream_error ? - (", stream error: " + XmlElementToString(*stream_error)) : - ""); + << (stream_error + ? (", stream error: " + XmlElementToString(*stream_error)) + : std::string()); DCHECK_EQ(error == buzz::XmppEngine::ERROR_STREAM, stream_error != NULL); diff --git a/jingle/notifier/communicator/single_login_attempt_unittest.cc b/jingle/notifier/communicator/single_login_attempt_unittest.cc index 582b808..4d009c2 100644 --- a/jingle/notifier/communicator/single_login_attempt_unittest.cc +++ b/jingle/notifier/communicator/single_login_attempt_unittest.cc @@ -219,7 +219,7 @@ TEST_F(SingleLoginAttemptTest, RedirectInvalidPort) { // Fire an empty redirect and make sure the delegate does not get a // redirect. TEST_F(SingleLoginAttemptTest, RedirectEmpty) { - scoped_ptr<buzz::XmlElement> redirect_error(MakeRedirectError("")); + scoped_ptr<buzz::XmlElement> redirect_error(MakeRedirectError(std::string())); FireRedirect(redirect_error.get()); EXPECT_EQ(IDLE, fake_delegate_.state()); } @@ -227,7 +227,7 @@ TEST_F(SingleLoginAttemptTest, RedirectEmpty) { // Fire a redirect with a missing text element and make sure the // delegate does not get a redirect. TEST_F(SingleLoginAttemptTest, RedirectMissingText) { - scoped_ptr<buzz::XmlElement> redirect_error(MakeRedirectError("")); + scoped_ptr<buzz::XmlElement> redirect_error(MakeRedirectError(std::string())); redirect_error->RemoveChildAfter(redirect_error->FirstChild()); FireRedirect(redirect_error.get()); EXPECT_EQ(IDLE, fake_delegate_.state()); @@ -236,7 +236,7 @@ TEST_F(SingleLoginAttemptTest, RedirectMissingText) { // Fire a redirect with a missing see-other-host element and make sure // the delegate does not get a redirect. TEST_F(SingleLoginAttemptTest, RedirectMissingSeeOtherHost) { - scoped_ptr<buzz::XmlElement> redirect_error(MakeRedirectError("")); + scoped_ptr<buzz::XmlElement> redirect_error(MakeRedirectError(std::string())); redirect_error->RemoveChildAfter(NULL); FireRedirect(redirect_error.get()); EXPECT_EQ(IDLE, fake_delegate_.state()); diff --git a/media/audio/linux/alsa_output.cc b/media/audio/linux/alsa_output.cc index 4615d01..f3c3f91 100644 --- a/media/audio/linux/alsa_output.cc +++ b/media/audio/linux/alsa_output.cc @@ -523,7 +523,7 @@ std::string AlsaPcmOutputStream::FindDeviceForChannels(uint32 channels) { const char* wanted_device = GuessSpecificDeviceName(channels); if (!wanted_device) - return ""; + return std::string(); std::string guessed_device; void** hints = NULL; diff --git a/media/audio/null_audio_sink.cc b/media/audio/null_audio_sink.cc index 5c4f67a..40db453 100644 --- a/media/audio/null_audio_sink.cc +++ b/media/audio/null_audio_sink.cc @@ -85,7 +85,7 @@ void NullAudioSink::StartAudioHashForTesting() { } std::string NullAudioSink::GetAudioHashForTesting() { - return audio_hash_ ? audio_hash_->ToString() : ""; + return audio_hash_ ? audio_hash_->ToString() : std::string(); } } // namespace media diff --git a/media/crypto/aes_decryptor.cc b/media/crypto/aes_decryptor.cc index e214b06..430568c 100644 --- a/media/crypto/aes_decryptor.cc +++ b/media/crypto/aes_decryptor.cc @@ -152,7 +152,7 @@ bool AesDecryptor::GenerateKeyRequest(const std::string& key_system, init_data_length); } - key_message_cb_.Run(key_system, session_id_string, message, ""); + key_message_cb_.Run(key_system, session_id_string, message, std::string()); return true; } diff --git a/media/crypto/aes_decryptor_unittest.cc b/media/crypto/aes_decryptor_unittest.cc index f882150..abc7e6e 100644 --- a/media/crypto/aes_decryptor_unittest.cc +++ b/media/crypto/aes_decryptor_unittest.cc @@ -242,11 +242,13 @@ class AesDecryptorTest : public testing::Test { void GenerateKeyRequest(const uint8* key_id, int key_id_size) { std::string key_id_string(reinterpret_cast<const char*>(key_id), key_id_size); - EXPECT_CALL(*this, KeyMessage(kClearKeySystem, - StrNe(""), StrEq(key_id_string), "")) + EXPECT_CALL( + *this, + KeyMessage( + kClearKeySystem, StrNe(std::string()), StrEq(key_id_string), "")) .WillOnce(SaveArg<1>(&session_id_string_)); - EXPECT_TRUE(decryptor_.GenerateKeyRequest(kClearKeySystem, "", - key_id, key_id_size)); + EXPECT_TRUE(decryptor_.GenerateKeyRequest( + kClearKeySystem, std::string(), key_id, key_id_size)); } void AddKeyAndExpectToSucceed(const uint8* key_id, int key_id_size, @@ -325,8 +327,9 @@ class AesDecryptorTest : public testing::Test { }; TEST_F(AesDecryptorTest, GenerateKeyRequestWithNullInitData) { - EXPECT_CALL(*this, KeyMessage(kClearKeySystem, StrNe(""), "", "")); - EXPECT_TRUE(decryptor_.GenerateKeyRequest(kClearKeySystem, "", NULL, 0)); + EXPECT_CALL(*this, KeyMessage(kClearKeySystem, StrNe(std::string()), "", "")); + EXPECT_TRUE( + decryptor_.GenerateKeyRequest(kClearKeySystem, std::string(), NULL, 0)); } TEST_F(AesDecryptorTest, NormalWebMDecryption) { diff --git a/media/filters/pipeline_integration_test.cc b/media/filters/pipeline_integration_test.cc index 5244376..2945db2 100644 --- a/media/filters/pipeline_integration_test.cc +++ b/media/filters/pipeline_integration_test.cc @@ -316,7 +316,8 @@ class MockMediaSource { DCHECK(init_data.get()); DCHECK_GT(init_data_size, 0); CHECK(!need_key_cb_.is_null()); - need_key_cb_.Run("", "", type, init_data.Pass(), init_data_size); + need_key_cb_.Run( + std::string(), std::string(), type, init_data.Pass(), init_data_size); } private: diff --git a/media/filters/pipeline_integration_test_base.cc b/media/filters/pipeline_integration_test_base.cc index 68b648e..1b650d5 100644 --- a/media/filters/pipeline_integration_test_base.cc +++ b/media/filters/pipeline_integration_test_base.cc @@ -67,7 +67,8 @@ void PipelineIntegrationTestBase::DemuxerNeedKeyCB( DCHECK(init_data.get()); DCHECK_GT(init_data_size, 0); CHECK(!need_key_cb_.is_null()); - need_key_cb_.Run("", "", type, init_data.Pass(), init_data_size); + need_key_cb_.Run( + std::string(), std::string(), type, init_data.Pass(), init_data_size); } void PipelineIntegrationTestBase::OnEnded() { diff --git a/media/webm/webm_cluster_parser_unittest.cc b/media/webm/webm_cluster_parser_unittest.cc index dc73329..baa35f2 100644 --- a/media/webm/webm_cluster_parser_unittest.cc +++ b/media/webm/webm_cluster_parser_unittest.cc @@ -203,13 +203,14 @@ static void AppendToEnd(const WebMClusterParser::BufferQueue& src, class WebMClusterParserTest : public testing::Test { public: WebMClusterParserTest() - : parser_(new WebMClusterParser( - kTimecodeScale, kAudioTrackNum, kVideoTrackNum, - std::set<int>(), - std::set<int64>(), - "", "", - LogCB())) { - } + : parser_(new WebMClusterParser(kTimecodeScale, + kAudioTrackNum, + kVideoTrackNum, + std::set<int>(), + std::set<int64>(), + std::string(), + std::string(), + LogCB())) {} protected: scoped_ptr<WebMClusterParser> parser_; @@ -334,11 +335,14 @@ TEST_F(WebMClusterParserTest, IgnoredTracks) { std::set<int64> ignored_tracks; ignored_tracks.insert(kTextTrackNum); - parser_.reset(new WebMClusterParser( - kTimecodeScale, kAudioTrackNum, kVideoTrackNum, - std::set<int>(), - ignored_tracks, "", "", - LogCB())); + parser_.reset(new WebMClusterParser(kTimecodeScale, + kAudioTrackNum, + kVideoTrackNum, + std::set<int>(), + ignored_tracks, + std::string(), + std::string(), + LogCB())); const BlockInfo kInputBlockInfo[] = { { kAudioTrackNum, 0, 23, true }, @@ -371,11 +375,14 @@ TEST_F(WebMClusterParserTest, ParseTextTracks) { std::set<int> text_tracks; text_tracks.insert(kTextTrackNum); - parser_.reset(new WebMClusterParser( - kTimecodeScale, kAudioTrackNum, kVideoTrackNum, - text_tracks, - std::set<int64>(), "", "", - LogCB())); + parser_.reset(new WebMClusterParser(kTimecodeScale, + kAudioTrackNum, + kVideoTrackNum, + text_tracks, + std::set<int64>(), + std::string(), + std::string(), + LogCB())); const BlockInfo kInputBlockInfo[] = { { kAudioTrackNum, 0, 23, true }, @@ -400,11 +407,14 @@ TEST_F(WebMClusterParserTest, TextTracksSimpleBlock) { std::set<int> text_tracks; text_tracks.insert(kTextTrackNum); - parser_.reset(new WebMClusterParser( - kTimecodeScale, kAudioTrackNum, kVideoTrackNum, - text_tracks, - std::set<int64>(), "", "", - LogCB())); + parser_.reset(new WebMClusterParser(kTimecodeScale, + kAudioTrackNum, + kVideoTrackNum, + text_tracks, + std::set<int64>(), + std::string(), + std::string(), + LogCB())); const BlockInfo kInputBlockInfo[] = { { kTextTrackNum, 33, 42, true }, @@ -428,11 +438,14 @@ TEST_F(WebMClusterParserTest, ParseMultipleTextTracks) { text_tracks.insert(kSubtitleTextTrackNum); text_tracks.insert(kCaptionTextTrackNum); - parser_.reset(new WebMClusterParser( - kTimecodeScale, kAudioTrackNum, kVideoTrackNum, - text_tracks, - std::set<int64>(), "", "", - LogCB())); + parser_.reset(new WebMClusterParser(kTimecodeScale, + kAudioTrackNum, + kVideoTrackNum, + text_tracks, + std::set<int64>(), + std::string(), + std::string(), + LogCB())); const BlockInfo kInputBlockInfo[] = { { kAudioTrackNum, 0, 23, true }, @@ -470,11 +483,14 @@ TEST_F(WebMClusterParserTest, ParseMultipleTextTracks) { TEST_F(WebMClusterParserTest, ParseEncryptedBlock) { scoped_ptr<Cluster> cluster(CreateEncryptedCluster(sizeof(kEncryptedFrame))); - parser_.reset(new WebMClusterParser( - kTimecodeScale, kAudioTrackNum, kVideoTrackNum, - std::set<int>(), - std::set<int64>(), "", "video_key_id", - LogCB())); + parser_.reset(new WebMClusterParser(kTimecodeScale, + kAudioTrackNum, + kVideoTrackNum, + std::set<int>(), + std::set<int64>(), + std::string(), + "video_key_id", + LogCB())); int result = parser_->Parse(cluster->data(), cluster->size()); EXPECT_EQ(cluster->size(), result); ASSERT_EQ(1UL, parser_->video_buffers().size()); @@ -486,11 +502,14 @@ TEST_F(WebMClusterParserTest, ParseBadEncryptedBlock) { scoped_ptr<Cluster> cluster( CreateEncryptedCluster(sizeof(kEncryptedFrame) - 1)); - parser_.reset(new WebMClusterParser( - kTimecodeScale, kAudioTrackNum, kVideoTrackNum, - std::set<int>(), - std::set<int64>(), "", "video_key_id", - LogCB())); + parser_.reset(new WebMClusterParser(kTimecodeScale, + kAudioTrackNum, + kVideoTrackNum, + std::set<int>(), + std::set<int64>(), + std::string(), + "video_key_id", + LogCB())); int result = parser_->Parse(cluster->data(), cluster->size()); EXPECT_EQ(-1, result); } diff --git a/net/base/dns_util.cc b/net/base/dns_util.cc index 816095b..b94eff8 100644 --- a/net/base/dns_util.cc +++ b/net/base/dns_util.cc @@ -62,16 +62,16 @@ std::string DNSDomainToString(const base::StringPiece& domain) { for (unsigned i = 0; i < domain.size() && domain[i]; i += domain[i] + 1) { #if CHAR_MIN < 0 if (domain[i] < 0) - return ""; + return std::string(); #endif if (domain[i] > 63) - return ""; + return std::string(); if (i) ret += "."; if (static_cast<unsigned>(domain[i]) + i + 1 > domain.size()) - return ""; + return std::string(); domain.substr(i + 1, domain[i]).AppendToString(&ret); } diff --git a/net/base/host_mapping_rules_unittest.cc b/net/base/host_mapping_rules_unittest.cc index 9ecd4b7..8d8f7b1 100644 --- a/net/base/host_mapping_rules_unittest.cc +++ b/net/base/host_mapping_rules_unittest.cc @@ -72,7 +72,7 @@ TEST(HostMappingRulesTest, ParseInvalidRules) { HostMappingRules rules; EXPECT_FALSE(rules.AddRuleFromString("xyz")); - EXPECT_FALSE(rules.AddRuleFromString("")); + EXPECT_FALSE(rules.AddRuleFromString(std::string())); EXPECT_FALSE(rules.AddRuleFromString(" ")); EXPECT_FALSE(rules.AddRuleFromString("EXCLUDE")); EXPECT_FALSE(rules.AddRuleFromString("EXCLUDE foo bar")); diff --git a/net/base/mime_sniffer_unittest.cc b/net/base/mime_sniffer_unittest.cc index a4bde0f..7865350 100644 --- a/net/base/mime_sniffer_unittest.cc +++ b/net/base/mime_sniffer_unittest.cc @@ -304,13 +304,14 @@ TEST(MimeSnifferTest, FlashTest) { TEST(MimeSnifferTest, XMLTest) { // An easy feed to identify. EXPECT_EQ("application/atom+xml", - SniffMimeType("<?xml?><feed", "", "text/xml")); + SniffMimeType("<?xml?><feed", std::string(), "text/xml")); // Don't sniff out of plain text. EXPECT_EQ("text/plain", - SniffMimeType("<?xml?><feed", "", "text/plain")); + SniffMimeType("<?xml?><feed", std::string(), "text/plain")); // Simple RSS. EXPECT_EQ("application/rss+xml", - SniffMimeType("<?xml version='1.0'?>\r\n<rss", "", "text/xml")); + SniffMimeType( + "<?xml version='1.0'?>\r\n<rss", std::string(), "text/xml")); // The top of CNN's RSS feed, which we'd like to recognize as RSS. static const char kCNNRSS[] = @@ -323,39 +324,43 @@ TEST(MimeSnifferTest, XMLTest) { "version=\"2.0\">"; // CNN's RSS EXPECT_EQ("application/rss+xml", - SniffMimeType(kCNNRSS, "", "text/xml")); - EXPECT_EQ("text/plain", - SniffMimeType(kCNNRSS, "", "text/plain")); + SniffMimeType(kCNNRSS, std::string(), "text/xml")); + EXPECT_EQ("text/plain", SniffMimeType(kCNNRSS, std::string(), "text/plain")); // Don't sniff random XML as something different. EXPECT_EQ("text/xml", - SniffMimeType("<?xml?><notafeed", "", "text/xml")); + SniffMimeType("<?xml?><notafeed", std::string(), "text/xml")); // Don't sniff random plain-text as something different. EXPECT_EQ("text/plain", - SniffMimeType("<?xml?><notafeed", "", "text/plain")); + SniffMimeType("<?xml?><notafeed", std::string(), "text/plain")); // Positive test for the two instances we upgrade to XHTML. EXPECT_EQ("application/xhtml+xml", SniffMimeType("<html xmlns=\"http://www.w3.org/1999/xhtml\">", - "", "text/xml")); + std::string(), + "text/xml")); EXPECT_EQ("application/xhtml+xml", SniffMimeType("<html xmlns=\"http://www.w3.org/1999/xhtml\">", - "", "application/xml")); + std::string(), + "application/xml")); // Following our behavior with HTML, don't call other mime types XHTML. EXPECT_EQ("text/plain", SniffMimeType("<html xmlns=\"http://www.w3.org/1999/xhtml\">", - "", "text/plain")); + std::string(), + "text/plain")); EXPECT_EQ("application/rss+xml", SniffMimeType("<html xmlns=\"http://www.w3.org/1999/xhtml\">", - "", "application/rss+xml")); + std::string(), + "application/rss+xml")); // Don't sniff other HTML-looking bits as HTML. EXPECT_EQ("text/xml", - SniffMimeType("<html><head>", "", "text/xml")); + SniffMimeType("<html><head>", std::string(), "text/xml")); EXPECT_EQ("text/xml", SniffMimeType("<foo><html xmlns=\"http://www.w3.org/1999/xhtml\">", - "", "text/xml")); + std::string(), + "text/xml")); } diff --git a/net/base/mime_util.cc b/net/base/mime_util.cc index 21a05bf..b3053a6 100644 --- a/net/base/mime_util.cc +++ b/net/base/mime_util.cc @@ -967,7 +967,7 @@ const std::string GetIANAMediaType(const std::string& mime_type) { return kIanaMediaTypes[i].name; } } - return ""; + return std::string(); } CertificateMimeType GetCertificateMimeTypeForMimeType( diff --git a/net/base/mime_util_unittest.cc b/net/base/mime_util_unittest.cc index ee6663b..565f9de 100644 --- a/net/base/mime_util_unittest.cc +++ b/net/base/mime_util_unittest.cc @@ -93,11 +93,11 @@ TEST(MimeUtilTest, MatchesMimeType) { "application/html+xml")); EXPECT_TRUE(MatchesMimeType("application/*+xml", "application/+xml")); EXPECT_TRUE(MatchesMimeType("aaa*aaa", "aaaaaa")); - EXPECT_TRUE(MatchesMimeType("*", "")); + EXPECT_TRUE(MatchesMimeType("*", std::string())); EXPECT_FALSE(MatchesMimeType("video/", "video/x-mpeg")); - EXPECT_FALSE(MatchesMimeType("", "video/x-mpeg")); - EXPECT_FALSE(MatchesMimeType("", "")); - EXPECT_FALSE(MatchesMimeType("video/x-mpeg", "")); + EXPECT_FALSE(MatchesMimeType(std::string(), "video/x-mpeg")); + EXPECT_FALSE(MatchesMimeType(std::string(), std::string())); + EXPECT_FALSE(MatchesMimeType("video/x-mpeg", std::string())); EXPECT_FALSE(MatchesMimeType("application/*+xml", "application/xml")); EXPECT_FALSE(MatchesMimeType("application/*+xml", "application/html+xmlz")); @@ -219,7 +219,7 @@ TEST(MimeUtilTest, TestIsMimeType) { TEST(MimeUtilTest, TestToIANAMediaType) { EXPECT_EQ("", GetIANAMediaType("texting/driving")); EXPECT_EQ("", GetIANAMediaType("ham/sandwich")); - EXPECT_EQ("", GetIANAMediaType("")); + EXPECT_EQ("", GetIANAMediaType(std::string())); EXPECT_EQ("", GetIANAMediaType("/application/hamsandwich")); EXPECT_EQ("application", GetIANAMediaType("application/poodle-wrestler")); diff --git a/net/base/net_util.cc b/net/base/net_util.cc index 066812c..18d00fe 100644 --- a/net/base/net_util.cc +++ b/net/base/net_util.cc @@ -1433,7 +1433,7 @@ std::string NetAddressToString(const struct sockaddr* sa, if (!GetIPAddressFromSockAddr(sa, sock_addr_len, &address, &address_len, NULL)) { NOTREACHED(); - return ""; + return std::string(); } return IPAddressToString(address, address_len); } @@ -1446,7 +1446,7 @@ std::string NetAddressToStringWithPort(const struct sockaddr* sa, if (!GetIPAddressFromSockAddr(sa, sock_addr_len, &address, &address_len, &port)) { NOTREACHED(); - return ""; + return std::string(); } return IPAddressToStringWithPort(address, address_len, port); } diff --git a/net/base/net_util_unittest.cc b/net/base/net_util_unittest.cc index 8512d09..ab8a236 100644 --- a/net/base/net_util_unittest.cc +++ b/net/base/net_util_unittest.cc @@ -2596,10 +2596,14 @@ TEST(NetUtilTest, FormatUrlParsed) { formatted.substr(parsed.ref.begin, parsed.ref.len)); // View-source case. - formatted = FormatUrl( - GURL("view-source:http://user:passwd@host:81/path?query#ref"), - "", kFormatUrlOmitUsernamePassword, UnescapeRule::NORMAL, &parsed, - NULL, NULL); + formatted = + FormatUrl(GURL("view-source:http://user:passwd@host:81/path?query#ref"), + std::string(), + kFormatUrlOmitUsernamePassword, + UnescapeRule::NORMAL, + &parsed, + NULL, + NULL); EXPECT_EQ(WideToUTF16(L"view-source:http://host:81/path?query#ref"), formatted); EXPECT_EQ(WideToUTF16(L"view-source:http"), @@ -2618,9 +2622,13 @@ TEST(NetUtilTest, FormatUrlParsed) { formatted.substr(parsed.ref.begin, parsed.ref.len)); // omit http case. - formatted = FormatUrl( - GURL("http://host:8000/a?b=c#d"), - "", kFormatUrlOmitHTTP, UnescapeRule::NORMAL, &parsed, NULL, NULL); + formatted = FormatUrl(GURL("http://host:8000/a?b=c#d"), + std::string(), + kFormatUrlOmitHTTP, + UnescapeRule::NORMAL, + &parsed, + NULL, + NULL); EXPECT_EQ(WideToUTF16(L"host:8000/a?b=c#d"), formatted); EXPECT_FALSE(parsed.scheme.is_valid()); EXPECT_FALSE(parsed.username.is_valid()); @@ -2637,9 +2645,13 @@ TEST(NetUtilTest, FormatUrlParsed) { formatted.substr(parsed.ref.begin, parsed.ref.len)); // omit http starts with ftp case. - formatted = FormatUrl( - GURL("http://ftp.host:8000/a?b=c#d"), - "", kFormatUrlOmitHTTP, UnescapeRule::NORMAL, &parsed, NULL, NULL); + formatted = FormatUrl(GURL("http://ftp.host:8000/a?b=c#d"), + std::string(), + kFormatUrlOmitHTTP, + UnescapeRule::NORMAL, + &parsed, + NULL, + NULL); EXPECT_EQ(WideToUTF16(L"http://ftp.host:8000/a?b=c#d"), formatted); EXPECT_TRUE(parsed.scheme.is_valid()); EXPECT_FALSE(parsed.username.is_valid()); @@ -2658,9 +2670,13 @@ TEST(NetUtilTest, FormatUrlParsed) { formatted.substr(parsed.ref.begin, parsed.ref.len)); // omit http starts with 'f' case. - formatted = FormatUrl( - GURL("http://f/"), - "", kFormatUrlOmitHTTP, UnescapeRule::NORMAL, &parsed, NULL, NULL); + formatted = FormatUrl(GURL("http://f/"), + std::string(), + kFormatUrlOmitHTTP, + UnescapeRule::NORMAL, + &parsed, + NULL, + NULL); EXPECT_EQ(WideToUTF16(L"f/"), formatted); EXPECT_FALSE(parsed.scheme.is_valid()); EXPECT_FALSE(parsed.username.is_valid()); @@ -2682,9 +2698,13 @@ TEST(NetUtilTest, FormatUrlRoundTripPathASCII) { GURL url(std::string("http://www.google.com/") + static_cast<char>(test_char)); size_t prefix_len; - base::string16 formatted = FormatUrl( - url, "", kFormatUrlOmitUsernamePassword, UnescapeRule::NORMAL, NULL, - &prefix_len, NULL); + base::string16 formatted = FormatUrl(url, + std::string(), + kFormatUrlOmitUsernamePassword, + UnescapeRule::NORMAL, + NULL, + &prefix_len, + NULL); EXPECT_EQ(url.spec(), GURL(formatted).spec()); } } @@ -2699,9 +2719,13 @@ TEST(NetUtilTest, FormatUrlRoundTripPathEscaped) { GURL url(original_url); size_t prefix_len; - base::string16 formatted = FormatUrl( - url, "", kFormatUrlOmitUsernamePassword, UnescapeRule::NORMAL, NULL, - &prefix_len, NULL); + base::string16 formatted = FormatUrl(url, + std::string(), + kFormatUrlOmitUsernamePassword, + UnescapeRule::NORMAL, + NULL, + &prefix_len, + NULL); EXPECT_EQ(url.spec(), GURL(formatted).spec()); } } @@ -2713,9 +2737,13 @@ TEST(NetUtilTest, FormatUrlRoundTripQueryASCII) { GURL url(std::string("http://www.google.com/?") + static_cast<char>(test_char)); size_t prefix_len; - base::string16 formatted = FormatUrl( - url, "", kFormatUrlOmitUsernamePassword, UnescapeRule::NORMAL, NULL, - &prefix_len, NULL); + base::string16 formatted = FormatUrl(url, + std::string(), + kFormatUrlOmitUsernamePassword, + UnescapeRule::NORMAL, + NULL, + &prefix_len, + NULL); EXPECT_EQ(url.spec(), GURL(formatted).spec()); } } @@ -2734,9 +2762,13 @@ TEST(NetUtilTest, FormatUrlRoundTripQueryEscaped) { GURL url(original_url); size_t prefix_len; - base::string16 formatted = FormatUrl( - url, "", kFormatUrlOmitUsernamePassword, UnescapeRule::NORMAL, NULL, - &prefix_len, NULL); + base::string16 formatted = FormatUrl(url, + std::string(), + kFormatUrlOmitUsernamePassword, + UnescapeRule::NORMAL, + NULL, + &prefix_len, + NULL); if (test_char && strchr(kUnescapedCharacters, static_cast<char>(test_char))) { @@ -3036,7 +3068,7 @@ TEST(NetUtilTest, ParseIPLiteralToNumber_FailParse) { EXPECT_FALSE(ParseIPLiteralToNumber("bad value", &number)); EXPECT_FALSE(ParseIPLiteralToNumber("bad:value", &number)); - EXPECT_FALSE(ParseIPLiteralToNumber("", &number)); + EXPECT_FALSE(ParseIPLiteralToNumber(std::string(), &number)); EXPECT_FALSE(ParseIPLiteralToNumber("192.168.0.1:30", &number)); EXPECT_FALSE(ParseIPLiteralToNumber(" 192.168.0.1 ", &number)); EXPECT_FALSE(ParseIPLiteralToNumber("[::1]", &number)); diff --git a/net/base/registry_controlled_domains/registry_controlled_domain_unittest.cc b/net/base/registry_controlled_domains/registry_controlled_domain_unittest.cc index 7ae5da4..8ad8a55 100644 --- a/net/base/registry_controlled_domains/registry_controlled_domain_unittest.cc +++ b/net/base/registry_controlled_domains/registry_controlled_domain_unittest.cc @@ -79,7 +79,7 @@ TEST_F(RegistryControlledDomainTest, TestGetDomainAndRegistry) { EXPECT_EQ("baz.com", GetDomainFromURL("http://baz.com")); // none EXPECT_EQ("baz.com.", GetDomainFromURL("http://baz.com.")); // none - EXPECT_EQ("", GetDomainFromURL("")); + EXPECT_EQ("", GetDomainFromURL(std::string())); EXPECT_EQ("", GetDomainFromURL("http://")); EXPECT_EQ("", GetDomainFromURL("file:///C:/file.html")); EXPECT_EQ("", GetDomainFromURL("http://foo.com..")); @@ -108,7 +108,7 @@ TEST_F(RegistryControlledDomainTest, TestGetDomainAndRegistry) { EXPECT_EQ("baz.com", GetDomainFromHost("baz.com")); // none EXPECT_EQ("baz.com.", GetDomainFromHost("baz.com.")); // none - EXPECT_EQ("", GetDomainFromHost("")); + EXPECT_EQ("", GetDomainFromHost(std::string())); EXPECT_EQ("", GetDomainFromHost("foo.com..")); EXPECT_EQ("", GetDomainFromHost("...")); EXPECT_EQ("", GetDomainFromHost("192.168.0.1")); @@ -143,7 +143,7 @@ TEST_F(RegistryControlledDomainTest, TestGetRegistryLength) { EXPECT_EQ(3U, GetRegistryLengthFromURL("http://baz.com", true)); // none EXPECT_EQ(4U, GetRegistryLengthFromURL("http://baz.com.", true)); // none - EXPECT_EQ(std::string::npos, GetRegistryLengthFromURL("", false)); + EXPECT_EQ(std::string::npos, GetRegistryLengthFromURL(std::string(), false)); EXPECT_EQ(std::string::npos, GetRegistryLengthFromURL("http://", false)); EXPECT_EQ(std::string::npos, GetRegistryLengthFromURL("file:///C:/file.html", false)); @@ -177,7 +177,7 @@ TEST_F(RegistryControlledDomainTest, TestGetRegistryLength) { EXPECT_EQ(3U, GetRegistryLengthFromHost("baz.com", true)); // none EXPECT_EQ(4U, GetRegistryLengthFromHost("baz.com.", true)); // none - EXPECT_EQ(std::string::npos, GetRegistryLengthFromHost("", false)); + EXPECT_EQ(std::string::npos, GetRegistryLengthFromHost(std::string(), false)); EXPECT_EQ(0U, GetRegistryLengthFromHost("foo.com..", false)); EXPECT_EQ(0U, GetRegistryLengthFromHost("..", false)); EXPECT_EQ(0U, GetRegistryLengthFromHost("192.168.0.1", false)); diff --git a/net/base/sdch_filter_unittest.cc b/net/base/sdch_filter_unittest.cc index 2e0f5ec..1cc70cb 100644 --- a/net/base/sdch_filter_unittest.cc +++ b/net/base/sdch_filter_unittest.cc @@ -1346,7 +1346,7 @@ TEST_F(SdchFilterTest, PathMatch) { // Make sure less that sufficient prefix match is false. EXPECT_FALSE(PathMatch("/sear", "/search")); EXPECT_FALSE(PathMatch("/", "/search")); - EXPECT_FALSE(PathMatch("", "/search")); + EXPECT_FALSE(PathMatch(std::string(), "/search")); // Add examples with several levels of direcories in the restriction. EXPECT_FALSE(PathMatch("/search/something", "search/s")); diff --git a/net/cookies/canonical_cookie_unittest.cc b/net/cookies/canonical_cookie_unittest.cc index d7c25d188..161b27f 100644 --- a/net/cookies/canonical_cookie_unittest.cc +++ b/net/cookies/canonical_cookie_unittest.cc @@ -55,8 +55,16 @@ TEST(CanonicalCookieTest, Constructor) { EXPECT_EQ("/test", cookie.Path()); EXPECT_FALSE(cookie.IsSecure()); - CanonicalCookie cookie2(url, "A", "2", "", "", current_time, base::Time(), - current_time, false, false); + CanonicalCookie cookie2(url, + "A", + "2", + std::string(), + std::string(), + current_time, + base::Time(), + current_time, + false, + false); EXPECT_EQ(url.GetOrigin().spec(), cookie.Source()); EXPECT_EQ("A", cookie2.Name()); EXPECT_EQ("2", cookie2.Value()); @@ -287,7 +295,7 @@ TEST(CanonicalCookieTest, IsOnPath) { EXPECT_TRUE(cookie->IsOnPath("/test/bar.html")); // Test the empty string edge case. - EXPECT_FALSE(cookie->IsOnPath("")); + EXPECT_FALSE(cookie->IsOnPath(std::string())); cookie.reset( CanonicalCookie::Create(GURL("http://www.example.com/test/foo.html"), diff --git a/net/cookies/cookie_monster_unittest.cc b/net/cookies/cookie_monster_unittest.cc index 116d486..b3688c3 100644 --- a/net/cookies/cookie_monster_unittest.cc +++ b/net/cookies/cookie_monster_unittest.cc @@ -233,20 +233,44 @@ class CookieMonsterTest : public CookieStoreTest<CookieMonsterTestTraits> { base::Time(), false, false)); // Host cookies - EXPECT_TRUE(this->SetCookieWithDetails(cm, url_top_level_domain_plus_1, - "host_1", "X", "", "/", - base::Time(), false, false)); - EXPECT_TRUE(this->SetCookieWithDetails(cm, url_top_level_domain_plus_2, - "host_2", "X", "", "/", - base::Time(), false, false)); - EXPECT_TRUE(this->SetCookieWithDetails(cm, url_top_level_domain_plus_3, - "host_3", "X", "", "/", - base::Time(), false, false)); + EXPECT_TRUE(this->SetCookieWithDetails(cm, + url_top_level_domain_plus_1, + "host_1", + "X", + std::string(), + "/", + base::Time(), + false, + false)); + EXPECT_TRUE(this->SetCookieWithDetails(cm, + url_top_level_domain_plus_2, + "host_2", + "X", + std::string(), + "/", + base::Time(), + false, + false)); + EXPECT_TRUE(this->SetCookieWithDetails(cm, + url_top_level_domain_plus_3, + "host_3", + "X", + std::string(), + "/", + base::Time(), + false, + false)); // Http_only cookie - EXPECT_TRUE(this->SetCookieWithDetails(cm, url_top_level_domain_plus_2, - "httpo_check", "X", "", "/", - base::Time(), false, true)); + EXPECT_TRUE(this->SetCookieWithDetails(cm, + url_top_level_domain_plus_2, + "httpo_check", + "X", + std::string(), + "/", + base::Time(), + false, + true)); // Secure cookies EXPECT_TRUE(this->SetCookieWithDetails(cm, @@ -254,9 +278,14 @@ class CookieMonsterTest : public CookieStoreTest<CookieMonsterTestTraits> { "sec_dom", "X", ".math.harvard.edu", "/", base::Time(), true, false)); EXPECT_TRUE(this->SetCookieWithDetails(cm, - url_top_level_domain_plus_2_secure, - "sec_host", "X", "", "/", - base::Time(), true, false)); + url_top_level_domain_plus_2_secure, + "sec_host", + "X", + std::string(), + "/", + base::Time(), + true, + false)); // Domain path cookies EXPECT_TRUE(this->SetCookieWithDetails(cm, url_top_level_domain_plus_2, @@ -269,14 +298,24 @@ class CookieMonsterTest : public CookieStoreTest<CookieMonsterTestTraits> { base::Time(), false, false)); // Host path cookies - EXPECT_TRUE(this->SetCookieWithDetails(cm, url_top_level_domain_plus_2, - "host_path_1", "X", - "", "/dir1", - base::Time(), false, false)); - EXPECT_TRUE(this->SetCookieWithDetails(cm, url_top_level_domain_plus_2, - "host_path_2", "X", - "", "/dir1/dir2", - base::Time(), false, false)); + EXPECT_TRUE(this->SetCookieWithDetails(cm, + url_top_level_domain_plus_2, + "host_path_1", + "X", + std::string(), + "/dir1", + base::Time(), + false, + false)); + EXPECT_TRUE(this->SetCookieWithDetails(cm, + url_top_level_domain_plus_2, + "host_path_2", + "X", + std::string(), + "/dir1/dir2", + base::Time(), + false, + false)); EXPECT_EQ(13U, this->GetAllCookies(cm).size()); } @@ -2205,7 +2244,7 @@ TEST_F(CookieMonsterTest, PersisentCookieStorageTest) { EXPECT_EQ(CookieStoreCommand::ADD, store->commands()[0].type); // Remove it. EXPECT_TRUE(SetCookie(cm, url_google_,"A=B; max-age=0")); - this->MatchCookieLines("", GetCookies(cm, url_google_)); + this->MatchCookieLines(std::string(), GetCookies(cm, url_google_)); ASSERT_EQ(2u, store->commands().size()); EXPECT_EQ(CookieStoreCommand::REMOVE, store->commands()[1].type); diff --git a/net/cookies/cookie_store_test_helpers.cc b/net/cookies/cookie_store_test_helpers.cc index e499538..6ae4357d 100644 --- a/net/cookies/cookie_store_test_helpers.cc +++ b/net/cookies/cookie_store_test_helpers.cc @@ -90,7 +90,7 @@ std::string DelayedCookieMonster::GetCookiesWithOptions( const GURL& url, const CookieOptions& options) { ADD_FAILURE(); - return ""; + return std::string(); } void DelayedCookieMonster::DeleteCookie(const GURL& url, diff --git a/net/cookies/cookie_store_unittest.h b/net/cookies/cookie_store_unittest.h index 134a193..0d2d7ed 100644 --- a/net/cookies/cookie_store_unittest.h +++ b/net/cookies/cookie_store_unittest.h @@ -275,9 +275,10 @@ TYPED_TEST_P(CookieStoreTest, DomainTest) { // Test domain enforcement, should fail on a sub-domain or something too deep. EXPECT_FALSE(this->SetCookie(cs, this->url_google_, "I=J; domain=.izzle")); - this->MatchCookieLines("", this->GetCookies(cs, GURL("http://a.izzle"))); - EXPECT_FALSE(this->SetCookie(cs, this->url_google_, - "K=L; domain=.bla.www.google.izzle")); + this->MatchCookieLines(std::string(), + this->GetCookies(cs, GURL("http://a.izzle"))); + EXPECT_FALSE(this->SetCookie( + cs, this->url_google_, "K=L; domain=.bla.www.google.izzle")); this->MatchCookieLines("C=D; E=F; G=H", this->GetCookies(cs, GURL("http://bla.www.google.izzle"))); this->MatchCookieLines("A=B; C=D; E=F; G=H", @@ -292,7 +293,8 @@ TYPED_TEST_P(CookieStoreTest, DomainWithTrailingDotTest) { "a=1; domain=.www.google.com.")); EXPECT_FALSE(this->SetCookie(cs, this->url_google_, "b=2; domain=.www.google.com..")); - this->MatchCookieLines("", this->GetCookies(cs, this->url_google_)); + this->MatchCookieLines(std::string(), + this->GetCookies(cs, this->url_google_)); } // Test that cookies can bet set on higher level domains. @@ -366,7 +368,7 @@ TYPED_TEST_P(CookieStoreTest, InvalidDomainTest) { EXPECT_FALSE(this->SetCookie(cs, url_foobar, "o=15; domain=.foo.bar.com#sup")); - this->MatchCookieLines("", this->GetCookies(cs, url_foobar)); + this->MatchCookieLines(std::string(), this->GetCookies(cs, url_foobar)); } { @@ -377,7 +379,7 @@ TYPED_TEST_P(CookieStoreTest, InvalidDomainTest) { GURL url_foocom("http://foo.com.com"); EXPECT_FALSE(this->SetCookie(cs, url_foocom, "a=1; domain=.foo.com.com.com")); - this->MatchCookieLines("", this->GetCookies(cs, url_foocom)); + this->MatchCookieLines(std::string(), this->GetCookies(cs, url_foocom)); } } @@ -402,8 +404,8 @@ TYPED_TEST_P(CookieStoreTest, DomainWithoutLeadingDotTest) { this->MatchCookieLines("a=1", this->GetCookies(cs, url)); this->MatchCookieLines("a=1", this->GetCookies(cs, GURL("http://sub.www.google.com"))); - this->MatchCookieLines("", - this->GetCookies(cs, GURL("http://something-else.com"))); + this->MatchCookieLines( + std::string(), this->GetCookies(cs, GURL("http://something-else.com"))); } } @@ -429,11 +431,11 @@ TYPED_TEST_P(CookieStoreTest, TestIpAddress) { scoped_refptr<CookieStore> cs(this->GetCookieStore()); EXPECT_FALSE(this->SetCookie(cs, url_ip, "b=2; domain=.1.2.3.4")); EXPECT_FALSE(this->SetCookie(cs, url_ip, "c=3; domain=.3.4")); - this->MatchCookieLines("", this->GetCookies(cs, url_ip)); + this->MatchCookieLines(std::string(), this->GetCookies(cs, url_ip)); // It should be allowed to set a cookie if domain= matches the IP address // exactly. This matches IE/Firefox, even though it seems a bit wrong. EXPECT_FALSE(this->SetCookie(cs, url_ip, "b=2; domain=1.2.3.3")); - this->MatchCookieLines("", this->GetCookies(cs, url_ip)); + this->MatchCookieLines(std::string(), this->GetCookies(cs, url_ip)); EXPECT_TRUE(this->SetCookie(cs, url_ip, "b=2; domain=1.2.3.4")); this->MatchCookieLines("b=2", this->GetCookies(cs, url_ip)); } @@ -451,10 +453,12 @@ TYPED_TEST_P(CookieStoreTest, TestNonDottedAndTLD) { this->MatchCookieLines("a=1", this->GetCookies(cs, url)); // Make sure it doesn't show up for a normal .com, it should be a host // not a domain cookie. - this->MatchCookieLines("", + this->MatchCookieLines( + std::string(), this->GetCookies(cs, GURL("http://hopefully-no-cookies.com/"))); if (TypeParam::supports_non_dotted_domains) { - this->MatchCookieLines("", this->GetCookies(cs, GURL("http://.com/"))); + this->MatchCookieLines(std::string(), + this->GetCookies(cs, GURL("http://.com/"))); } } @@ -465,7 +469,8 @@ TYPED_TEST_P(CookieStoreTest, TestNonDottedAndTLD) { if (TypeParam::supports_trailing_dots) { EXPECT_TRUE(this->SetCookie(cs, url, "a=1")); this->MatchCookieLines("a=1", this->GetCookies(cs, url)); - this->MatchCookieLines("", + this->MatchCookieLines( + std::string(), this->GetCookies(cs, GURL("http://hopefully-no-cookies.com./"))); } else { EXPECT_FALSE(this->SetCookie(cs, url, "a=1")); @@ -477,7 +482,7 @@ TYPED_TEST_P(CookieStoreTest, TestNonDottedAndTLD) { GURL url("http://a.b"); EXPECT_FALSE(this->SetCookie(cs, url, "a=1; domain=.b")); EXPECT_FALSE(this->SetCookie(cs, url, "b=2; domain=b")); - this->MatchCookieLines("", this->GetCookies(cs, url)); + this->MatchCookieLines(std::string(), this->GetCookies(cs, url)); } { // Same test as above, but explicitly on a known TLD (com). @@ -485,7 +490,7 @@ TYPED_TEST_P(CookieStoreTest, TestNonDottedAndTLD) { GURL url("http://google.com"); EXPECT_FALSE(this->SetCookie(cs, url, "a=1; domain=.com")); EXPECT_FALSE(this->SetCookie(cs, url, "b=2; domain=com")); - this->MatchCookieLines("", this->GetCookies(cs, url)); + this->MatchCookieLines(std::string(), this->GetCookies(cs, url)); } { // Make sure can't set cookie on TLD which is dotted. @@ -493,11 +498,12 @@ TYPED_TEST_P(CookieStoreTest, TestNonDottedAndTLD) { GURL url("http://google.co.uk"); EXPECT_FALSE(this->SetCookie(cs, url, "a=1; domain=.co.uk")); EXPECT_FALSE(this->SetCookie(cs, url, "b=2; domain=.uk")); - this->MatchCookieLines("", this->GetCookies(cs, url)); - this->MatchCookieLines("", + this->MatchCookieLines(std::string(), this->GetCookies(cs, url)); + this->MatchCookieLines( + std::string(), this->GetCookies(cs, GURL("http://something-else.co.uk"))); - this->MatchCookieLines("", - this->GetCookies(cs, GURL("http://something-else.uk"))); + this->MatchCookieLines( + std::string(), this->GetCookies(cs, GURL("http://something-else.uk"))); } { // Intranet URLs should only be able to set host cookies. @@ -533,9 +539,11 @@ TYPED_TEST_P(CookieStoreTest, TestHostEndsWithDot) { } // Make sure there weren't any side effects. - this->MatchCookieLines("", + this->MatchCookieLines( + std::string(), this->GetCookies(cs, GURL("http://hopefully-no-cookies.com/"))); - this->MatchCookieLines("", this->GetCookies(cs, GURL("http://.com/"))); + this->MatchCookieLines(std::string(), + this->GetCookies(cs, GURL("http://.com/"))); } TYPED_TEST_P(CookieStoreTest, InvalidScheme) { @@ -552,7 +560,7 @@ TYPED_TEST_P(CookieStoreTest, InvalidScheme_Read) { scoped_refptr<CookieStore> cs(this->GetCookieStore()); EXPECT_TRUE(this->SetCookie(cs, GURL(kUrlGoogle), kValidDomainCookieLine)); - this->MatchCookieLines("", this->GetCookies(cs, GURL(kUrlFtp))); + this->MatchCookieLines(std::string(), this->GetCookies(cs, GURL(kUrlFtp))); } TYPED_TEST_P(CookieStoreTest, PathTest) { @@ -565,8 +573,9 @@ TYPED_TEST_P(CookieStoreTest, PathTest) { this->MatchCookieLines("A=B", this->GetCookies(cs, GURL(url + "/wee/war/more/more"))); if (!TypeParam::has_path_prefix_bug) - this->MatchCookieLines("", this->GetCookies(cs, GURL(url + "/weehee"))); - this->MatchCookieLines("", this->GetCookies(cs, GURL(url + "/"))); + this->MatchCookieLines(std::string(), + this->GetCookies(cs, GURL(url + "/weehee"))); + this->MatchCookieLines(std::string(), this->GetCookies(cs, GURL(url + "/"))); // If we add a 0 length path, it should default to / EXPECT_TRUE(this->SetCookie(cs, GURL(url), "A=C; path=")); @@ -612,15 +621,17 @@ TYPED_TEST_P(CookieStoreTest, HttpOnlyTest) { options)); // Check httponly read protection. - this->MatchCookieLines("", this->GetCookies(cs, this->url_google_)); - this->MatchCookieLines("A=B", - this->GetCookiesWithOptions(cs, this->url_google_, options)); + this->MatchCookieLines(std::string(), + this->GetCookies(cs, this->url_google_)); + this->MatchCookieLines( + "A=B", this->GetCookiesWithOptions(cs, this->url_google_, options)); // Check httponly overwrite protection. EXPECT_FALSE(this->SetCookie(cs, this->url_google_, "A=C")); - this->MatchCookieLines("", this->GetCookies(cs, this->url_google_)); - this->MatchCookieLines("A=B", - this->GetCookiesWithOptions(cs, this->url_google_, options)); + this->MatchCookieLines(std::string(), + this->GetCookies(cs, this->url_google_)); + this->MatchCookieLines( + "A=B", this->GetCookiesWithOptions(cs, this->url_google_, options)); EXPECT_TRUE(this->SetCookieWithOptions(cs, this->url_google_, "A=C", options)); this->MatchCookieLines("A=C", this->GetCookies(cs, this->url_google_)); @@ -645,7 +656,7 @@ TYPED_TEST_P(CookieStoreTest, TestCookieDeletion) { // Delete it via Max-Age. EXPECT_TRUE(this->SetCookie(cs, this->url_google_, std::string(kValidCookieLine) + "; max-age=0")); - this->MatchCookieLineWithTimeout(cs, this->url_google_, ""); + this->MatchCookieLineWithTimeout(cs, this->url_google_, std::string()); // Create a session cookie. EXPECT_TRUE(this->SetCookie(cs, this->url_google_, kValidCookieLine)); @@ -654,7 +665,8 @@ TYPED_TEST_P(CookieStoreTest, TestCookieDeletion) { EXPECT_TRUE(this->SetCookie(cs, this->url_google_, std::string(kValidCookieLine) + "; expires=Mon, 18-Apr-1977 22:50:13 GMT")); - this->MatchCookieLines("", this->GetCookies(cs, this->url_google_)); + this->MatchCookieLines(std::string(), + this->GetCookies(cs, this->url_google_)); // Create a persistent cookie. EXPECT_TRUE(this->SetCookie(cs, this->url_google_, @@ -665,7 +677,7 @@ TYPED_TEST_P(CookieStoreTest, TestCookieDeletion) { // Delete it via Max-Age. EXPECT_TRUE(this->SetCookie(cs, this->url_google_, std::string(kValidCookieLine) + "; max-age=0")); - this->MatchCookieLineWithTimeout(cs, this->url_google_, ""); + this->MatchCookieLineWithTimeout(cs, this->url_google_, std::string()); // Create a persistent cookie. EXPECT_TRUE(this->SetCookie(cs, this->url_google_, @@ -676,7 +688,8 @@ TYPED_TEST_P(CookieStoreTest, TestCookieDeletion) { EXPECT_TRUE(this->SetCookie(cs, this->url_google_, std::string(kValidCookieLine) + "; expires=Mon, 18-Apr-1977 22:50:13 GMT")); - this->MatchCookieLines("", this->GetCookies(cs, this->url_google_)); + this->MatchCookieLines(std::string(), + this->GetCookies(cs, this->url_google_)); // Create a persistent cookie. EXPECT_TRUE(this->SetCookie(cs, this->url_google_, @@ -703,7 +716,8 @@ TYPED_TEST_P(CookieStoreTest, TestCookieDeletion) { EXPECT_TRUE(this->SetCookie(cs, this->url_google_, std::string(kValidCookieLine) + "; expires=Thu, 1-Jan-1970 00:00:00 GMT")); - this->MatchCookieLines("", this->GetCookies(cs, this->url_google_)); + this->MatchCookieLines(std::string(), + this->GetCookies(cs, this->url_google_)); } TYPED_TEST_P(CookieStoreTest, TestDeleteAllCreatedBetween) { @@ -731,7 +745,8 @@ TYPED_TEST_P(CookieStoreTest, TestDeleteAllCreatedBetween) { // Remove the cookie with an interval defined by two dates. EXPECT_EQ(1, this->DeleteCreatedBetween(cs, last_minute, next_minute)); // Check that the cookie disappeared. - this->MatchCookieLines("", this->GetCookies(cs, this->url_google_)); + this->MatchCookieLines(std::string(), + this->GetCookies(cs, this->url_google_)); // Add another cookie. EXPECT_TRUE(this->SetCookie(cs, this->url_google_, "C=D")); @@ -741,7 +756,8 @@ TYPED_TEST_P(CookieStoreTest, TestDeleteAllCreatedBetween) { // Remove the cookie with a null ending time. EXPECT_EQ(1, this->DeleteCreatedBetween(cs, last_minute, base::Time())); // Check that the cookie disappeared. - this->MatchCookieLines("", this->GetCookies(cs, this->url_google_)); + this->MatchCookieLines(std::string(), + this->GetCookies(cs, this->url_google_)); } TYPED_TEST_P(CookieStoreTest, TestSecure) { @@ -753,11 +769,13 @@ TYPED_TEST_P(CookieStoreTest, TestSecure) { EXPECT_TRUE(this->SetCookie(cs, this->url_google_secure_, "A=B; secure")); // The secure should overwrite the non-secure. - this->MatchCookieLines("", this->GetCookies(cs, this->url_google_)); + this->MatchCookieLines(std::string(), + this->GetCookies(cs, this->url_google_)); this->MatchCookieLines("A=B", this->GetCookies(cs, this->url_google_secure_)); EXPECT_TRUE(this->SetCookie(cs, this->url_google_secure_, "D=E; secure")); - this->MatchCookieLines("", this->GetCookies(cs, this->url_google_)); + this->MatchCookieLines(std::string(), + this->GetCookies(cs, this->url_google_)); this->MatchCookieLines("A=B; D=E", this->GetCookies(cs, this->url_google_secure_)); diff --git a/net/cookies/parsed_cookie.cc b/net/cookies/parsed_cookie.cc index 5cd542d..ecb8712 100644 --- a/net/cookies/parsed_cookie.cc +++ b/net/cookies/parsed_cookie.cc @@ -424,7 +424,7 @@ bool ParsedCookie::SetBool(size_t* index, ClearAttributePair(*index); return true; } else { - return SetAttributePair(index, key, ""); + return SetAttributePair(index, key, std::string()); } } diff --git a/net/cookies/parsed_cookie_unittest.cc b/net/cookies/parsed_cookie_unittest.cc index 3729650..57de115 100644 --- a/net/cookies/parsed_cookie_unittest.cc +++ b/net/cookies/parsed_cookie_unittest.cc @@ -208,7 +208,7 @@ TEST(ParsedCookieTest, InvalidTooLong) { } TEST(ParsedCookieTest, InvalidEmpty) { - ParsedCookie pc(""); + ParsedCookie pc((std::string())); EXPECT_FALSE(pc.IsValid()); } @@ -259,7 +259,7 @@ TEST(ParsedCookieTest, SerializeCookieLine) { TEST(ParsedCookieTest, SetNameAndValue) { - ParsedCookie empty(""); + ParsedCookie empty((std::string())); EXPECT_FALSE(empty.IsValid()); EXPECT_FALSE(empty.SetDomain("foobar.com")); EXPECT_TRUE(empty.SetName("name")); @@ -282,7 +282,7 @@ TEST(ParsedCookieTest, SetNameAndValue) { EXPECT_EQ("name=value", pc.ToCookieLine()); EXPECT_TRUE(pc.IsValid()); - EXPECT_FALSE(pc.SetName("")); + EXPECT_FALSE(pc.SetName(std::string())); EXPECT_EQ("name=value", pc.ToCookieLine()); EXPECT_TRUE(pc.IsValid()); @@ -303,7 +303,7 @@ TEST(ParsedCookieTest, SetNameAndValue) { EXPECT_EQ("test=\"foobar\"", pc.ToCookieLine()); EXPECT_TRUE(pc.IsValid()); - EXPECT_TRUE(pc.SetValue("")); + EXPECT_TRUE(pc.SetValue(std::string())); EXPECT_EQ("test=", pc.ToCookieLine()); EXPECT_TRUE(pc.IsValid()); } @@ -313,7 +313,7 @@ TEST(ParsedCookieTest, SetAttributes) { EXPECT_TRUE(pc.IsValid()); // Clear an unset attribute. - EXPECT_TRUE(pc.SetDomain("")); + EXPECT_TRUE(pc.SetDomain(std::string())); EXPECT_FALSE(pc.HasDomain()); EXPECT_EQ("name=value", pc.ToCookieLine()); EXPECT_TRUE(pc.IsValid()); @@ -355,10 +355,10 @@ TEST(ParsedCookieTest, SetAttributes) { pc.ToCookieLine()); // Clear the rest and change the name and value. - EXPECT_TRUE(pc.SetDomain("")); - EXPECT_TRUE(pc.SetPath("")); - EXPECT_TRUE(pc.SetExpires("")); - EXPECT_TRUE(pc.SetMaxAge("")); + EXPECT_TRUE(pc.SetDomain(std::string())); + EXPECT_TRUE(pc.SetPath(std::string())); + EXPECT_TRUE(pc.SetExpires(std::string())); + EXPECT_TRUE(pc.SetMaxAge(std::string())); EXPECT_TRUE(pc.SetIsSecure(false)); EXPECT_TRUE(pc.SetIsHttpOnly(false)); EXPECT_TRUE(pc.SetName("name2")); diff --git a/net/dns/host_resolver_impl_unittest.cc b/net/dns/host_resolver_impl_unittest.cc index c9ebec0..26bebeb 100644 --- a/net/dns/host_resolver_impl_unittest.cc +++ b/net/dns/host_resolver_impl_unittest.cc @@ -107,7 +107,7 @@ class MockHostResolverProc : public HostResolverProc { void AddRule(const std::string& hostname, AddressFamily family, const std::string& ip_list) { AddressList result; - int rv = ParseAddressList(ip_list, "", &result); + int rv = ParseAddressList(ip_list, std::string(), &result); DCHECK_EQ(OK, rv); AddRule(hostname, family, result); } @@ -115,7 +115,7 @@ class MockHostResolverProc : public HostResolverProc { void AddRuleForAllFamilies(const std::string& hostname, const std::string& ip_list) { AddressList result; - int rv = ParseAddressList(ip_list, "", &result); + int rv = ParseAddressList(ip_list, std::string(), &result); DCHECK_EQ(OK, rv); AddRule(hostname, ADDRESS_FAMILY_UNSPECIFIED, result); AddRule(hostname, ADDRESS_FAMILY_IPV4, result); @@ -137,7 +137,7 @@ class MockHostResolverProc : public HostResolverProc { --num_slots_available_; --num_requests_waiting_; if (rules_.empty()) { - int rv = ParseAddressList("127.0.0.1", "", addrlist); + int rv = ParseAddressList("127.0.0.1", std::string(), addrlist); DCHECK_EQ(OK, rv); return OK; } @@ -527,7 +527,8 @@ TEST_F(HostResolverImplTest, AsynchronousLookup) { } TEST_F(HostResolverImplTest, FailedAsynchronousLookup) { - proc_->AddRuleForAllFamilies("", "0.0.0.0"); // Default to failures. + proc_->AddRuleForAllFamilies(std::string(), + "0.0.0.0"); // Default to failures. proc_->SignalMultiple(1u); Request* req = CreateRequest("just.testing", 80); @@ -582,7 +583,7 @@ TEST_F(HostResolverImplTest, NumericIPv6Address) { } TEST_F(HostResolverImplTest, EmptyHost) { - Request* req = CreateRequest("", 5555); + Request* req = CreateRequest(std::string(), 5555); EXPECT_EQ(ERR_NAME_NOT_RESOLVED, req->Resolve()); } @@ -1344,7 +1345,8 @@ TEST_F(HostResolverImplDnsTest, ServeFromHosts) { DnsConfig config = CreateValidDnsConfig(); ChangeDnsConfig(config); - proc_->AddRuleForAllFamilies("", ""); // Default to failures. + proc_->AddRuleForAllFamilies(std::string(), + std::string()); // Default to failures. proc_->SignalMultiple(1u); // For the first request which misses. Request* req0 = CreateRequest("er_ipv4", 80); @@ -1396,7 +1398,8 @@ TEST_F(HostResolverImplDnsTest, ServeFromHosts) { TEST_F(HostResolverImplDnsTest, BypassDnsTask) { ChangeDnsConfig(CreateValidDnsConfig()); - proc_->AddRuleForAllFamilies("", ""); // Default to failures. + proc_->AddRuleForAllFamilies(std::string(), + std::string()); // Default to failures. EXPECT_EQ(ERR_IO_PENDING, CreateRequest("ok.local", 80)->Resolve()); EXPECT_EQ(ERR_IO_PENDING, CreateRequest("ok.local.", 80)->Resolve()); @@ -1416,7 +1419,8 @@ TEST_F(HostResolverImplDnsTest, BypassDnsTask) { TEST_F(HostResolverImplDnsTest, DisableDnsClientOnPersistentFailure) { ChangeDnsConfig(CreateValidDnsConfig()); - proc_->AddRuleForAllFamilies("", ""); // Default to failures. + proc_->AddRuleForAllFamilies(std::string(), + std::string()); // Default to failures. // Check that DnsTask works. Request* req = CreateRequest("ok_1", 80); @@ -1470,7 +1474,7 @@ TEST_F(HostResolverImplDnsTest, DontDisableDnsClientOnSporadicFailure) { EXPECT_EQ(OK, requests_[i]->WaitForResult()) << i; // Make |proc_| default to failures. - proc_->AddRuleForAllFamilies("", ""); + proc_->AddRuleForAllFamilies(std::string(), std::string()); // DnsTask should still be enabled. Request* req = CreateRequest("ok_last", 80); diff --git a/net/dns/mapped_host_resolver_unittest.cc b/net/dns/mapped_host_resolver_unittest.cc index 8da95e1..d859466 100644 --- a/net/dns/mapped_host_resolver_unittest.cc +++ b/net/dns/mapped_host_resolver_unittest.cc @@ -18,7 +18,7 @@ namespace { std::string FirstAddress(const AddressList& address_list) { if (address_list.empty()) - return ""; + return std::string(); return address_list.front().ToString(); } @@ -171,7 +171,7 @@ TEST(MappedHostResolverTest, ParseInvalidRules) { new MappedHostResolver(scoped_ptr<HostResolver>())); EXPECT_FALSE(resolver->AddRuleFromString("xyz")); - EXPECT_FALSE(resolver->AddRuleFromString("")); + EXPECT_FALSE(resolver->AddRuleFromString(std::string())); EXPECT_FALSE(resolver->AddRuleFromString(" ")); EXPECT_FALSE(resolver->AddRuleFromString("EXCLUDE")); EXPECT_FALSE(resolver->AddRuleFromString("EXCLUDE foo bar")); diff --git a/net/dns/mock_host_resolver.cc b/net/dns/mock_host_resolver.cc index fb03836..e6ecf59 100644 --- a/net/dns/mock_host_resolver.cc +++ b/net/dns/mock_host_resolver.cc @@ -256,8 +256,13 @@ void RuleBasedHostResolverProc::AddRuleForAddressFamily( DCHECK(!replacement.empty()); HostResolverFlags flags = HOST_RESOLVER_LOOPBACK_ONLY | HOST_RESOLVER_DEFAULT_FAMILY_SET_DUE_TO_NO_IPV6; - Rule rule(Rule::kResolverTypeSystem, host_pattern, address_family, flags, - replacement, "", 0); + Rule rule(Rule::kResolverTypeSystem, + host_pattern, + address_family, + flags, + replacement, + std::string(), + 0); rules_.push_back(rule); } @@ -286,8 +291,13 @@ void RuleBasedHostResolverProc::AddRuleWithLatency( DCHECK(!replacement.empty()); HostResolverFlags flags = HOST_RESOLVER_LOOPBACK_ONLY | HOST_RESOLVER_DEFAULT_FAMILY_SET_DUE_TO_NO_IPV6; - Rule rule(Rule::kResolverTypeSystem, host_pattern, ADDRESS_FAMILY_UNSPECIFIED, - flags, replacement, "", latency_ms); + Rule rule(Rule::kResolverTypeSystem, + host_pattern, + ADDRESS_FAMILY_UNSPECIFIED, + flags, + replacement, + std::string(), + latency_ms); rules_.push_back(rule); } @@ -295,8 +305,13 @@ void RuleBasedHostResolverProc::AllowDirectLookup( const std::string& host_pattern) { HostResolverFlags flags = HOST_RESOLVER_LOOPBACK_ONLY | HOST_RESOLVER_DEFAULT_FAMILY_SET_DUE_TO_NO_IPV6; - Rule rule(Rule::kResolverTypeSystem, host_pattern, ADDRESS_FAMILY_UNSPECIFIED, - flags, "", "", 0); + Rule rule(Rule::kResolverTypeSystem, + host_pattern, + ADDRESS_FAMILY_UNSPECIFIED, + flags, + std::string(), + std::string(), + 0); rules_.push_back(rule); } @@ -304,8 +319,13 @@ void RuleBasedHostResolverProc::AddSimulatedFailure( const std::string& host_pattern) { HostResolverFlags flags = HOST_RESOLVER_LOOPBACK_ONLY | HOST_RESOLVER_DEFAULT_FAMILY_SET_DUE_TO_NO_IPV6; - Rule rule(Rule::kResolverTypeFail, host_pattern, ADDRESS_FAMILY_UNSPECIFIED, - flags, "", "", 0); + Rule rule(Rule::kResolverTypeFail, + host_pattern, + ADDRESS_FAMILY_UNSPECIFIED, + flags, + std::string(), + std::string(), + 0); rules_.push_back(rule); } diff --git a/net/dns/single_request_host_resolver_unittest.cc b/net/dns/single_request_host_resolver_unittest.cc index 3e2ea1e..1b0198f 100644 --- a/net/dns/single_request_host_resolver_unittest.cc +++ b/net/dns/single_request_host_resolver_unittest.cc @@ -68,7 +68,7 @@ TEST(SingleRequestHostResolverTest, NormalResolve) { // Create a host resolver dependency that returns address "199.188.1.166" // for resolutions of "watsup". MockHostResolver resolver; - resolver.rules()->AddIPLiteralRule("watsup", "199.188.1.166", ""); + resolver.rules()->AddIPLiteralRule("watsup", "199.188.1.166", std::string()); SingleRequestHostResolver single_request_resolver(&resolver); diff --git a/net/ftp/ftp_util.cc b/net/ftp/ftp_util.cc index 0eab465..68307a2 100644 --- a/net/ftp/ftp_util.cc +++ b/net/ftp/ftp_util.cc @@ -107,7 +107,7 @@ std::string FtpUtil::VMSPathToUnix(const std::string& vms_path) { std::string result(vms_path); if (vms_path[0] == '[') { // It's a relative path. - ReplaceFirstSubstringAfterOffset(&result, 0, "[.", ""); + ReplaceFirstSubstringAfterOffset(&result, 0, "[.", std::string()); } else { // It's an absolute path. result.insert(0, "/"); diff --git a/net/http/http_auth.cc b/net/http/http_auth.cc index fb7fc5d..9e9410b 100644 --- a/net/http/http_auth.cc +++ b/net/http/http_auth.cc @@ -146,7 +146,7 @@ std::string HttpAuth::GetChallengeHeaderName(Target target) { return "WWW-Authenticate"; default: NOTREACHED(); - return ""; + return std::string(); } } @@ -159,7 +159,7 @@ std::string HttpAuth::GetAuthorizationHeaderName(Target target) { return HttpRequestHeaders::kAuthorization; default: NOTREACHED(); - return ""; + return std::string(); } } @@ -172,7 +172,7 @@ std::string HttpAuth::GetAuthTargetString(Target target) { return "server"; default: NOTREACHED(); - return ""; + return std::string(); } } diff --git a/net/http/http_auth_cache_unittest.cc b/net/http/http_auth_cache_unittest.cc index af3b25c..0bdb280 100644 --- a/net/http/http_auth_cache_unittest.cc +++ b/net/http/http_auth_cache_unittest.cc @@ -106,11 +106,13 @@ TEST(HttpAuthCacheTest, Basic) { new MockAuthHandler(HttpAuth::AUTH_SCHEME_BASIC, kRealm3, HttpAuth::AUTH_PROXY)); - cache.Add(origin, realm3_basic_handler->realm(), - realm3_basic_handler->auth_scheme(), "Basic realm=Realm3", - CreateASCIICredentials("realm3-basic-user", - "realm3-basic-password"), - ""); + cache.Add( + origin, + realm3_basic_handler->realm(), + realm3_basic_handler->auth_scheme(), + "Basic realm=Realm3", + CreateASCIICredentials("realm3-basic-user", "realm3-basic-password"), + std::string()); scoped_ptr<HttpAuthHandler> realm3_digest_handler( new MockAuthHandler(HttpAuth::AUTH_SCHEME_DIGEST, @@ -205,7 +207,7 @@ TEST(HttpAuthCacheTest, Basic) { // Negative tests: entry = cache.LookupByPath(origin, "/foo3/index.html"); EXPECT_FALSE(realm2_entry == entry); - entry = cache.LookupByPath(origin, ""); + entry = cache.LookupByPath(origin, std::string()); EXPECT_FALSE(realm2_entry == entry); // Confirm we find the same realm, different auth scheme by path lookup @@ -231,7 +233,7 @@ TEST(HttpAuthCacheTest, Basic) { EXPECT_FALSE(realm3DigestEntry == entry); // Lookup using empty path (may be used for proxy). - entry = cache.LookupByPath(origin, ""); + entry = cache.LookupByPath(origin, std::string()); EXPECT_FALSE(NULL == entry); EXPECT_EQ(HttpAuth::AUTH_SCHEME_BASIC, entry->scheme()); EXPECT_EQ(kRealm3, entry->realm()); @@ -540,7 +542,10 @@ class HttpAuthCacheEvictionTest : public testing::Test { } void AddPathToRealm(int realm_i, int path_i) { - cache_.Add(origin_, GenerateRealm(realm_i), HttpAuth::AUTH_SCHEME_BASIC, "", + cache_.Add(origin_, + GenerateRealm(realm_i), + HttpAuth::AUTH_SCHEME_BASIC, + std::string(), AuthCredentials(kUsername, kPassword), GeneratePath(realm_i, path_i)); } diff --git a/net/http/http_auth_filter_unittest.cc b/net/http/http_auth_filter_unittest.cc index 0aab9d4..e6891dd 100644 --- a/net/http/http_auth_filter_unittest.cc +++ b/net/http/http_auth_filter_unittest.cc @@ -35,22 +35,17 @@ struct UrlData { }; static const UrlData urls[] = { - { GURL(""), - HttpAuth::AUTH_NONE, false, 0 }, - { GURL("http://foo.cn"), - HttpAuth::AUTH_PROXY, true, ALL_SERVERS_MATCH }, - { GURL("http://foo.cn"), - HttpAuth::AUTH_SERVER, false, 0 }, - { GURL("http://slashdot.org"), - HttpAuth::AUTH_NONE, false, 0 }, - { GURL("http://www.google.com"), - HttpAuth::AUTH_SERVER, true, 1 << 0 }, - { GURL("http://www.google.com"), - HttpAuth::AUTH_PROXY, true, ALL_SERVERS_MATCH }, + { GURL(std::string()), HttpAuth::AUTH_NONE, false, 0 }, + { GURL("http://foo.cn"), HttpAuth::AUTH_PROXY, true, ALL_SERVERS_MATCH }, + { GURL("http://foo.cn"), HttpAuth::AUTH_SERVER, false, 0 }, + { GURL("http://slashdot.org"), HttpAuth::AUTH_NONE, false, 0 }, + { GURL("http://www.google.com"), HttpAuth::AUTH_SERVER, true, 1 << 0 }, + { GURL("http://www.google.com"), HttpAuth::AUTH_PROXY, true, + ALL_SERVERS_MATCH }, { GURL("https://login.facebook.com/login.php?login_attempt=1"), HttpAuth::AUTH_NONE, false, 0 }, - { GURL("http://codereview.chromium.org/634002/show"), - HttpAuth::AUTH_SERVER, true, 1 << 3 }, + { GURL("http://codereview.chromium.org/634002/show"), HttpAuth::AUTH_SERVER, + true, 1 << 3 }, { GURL("http://code.google.com/p/chromium/issues/detail?id=34505"), HttpAuth::AUTH_SERVER, true, 1 << 0 }, { GURL("http://code.google.com/p/chromium/issues/list?can=2&q=label:" @@ -77,7 +72,7 @@ static const UrlData urls[] = { TEST(HttpAuthFilterTest, EmptyFilter) { // Create an empty filter - HttpAuthFilterWhitelist filter(""); + HttpAuthFilterWhitelist filter((std::string())); for (size_t i = 0; i < arraysize(urls); i++) { EXPECT_EQ(urls[i].target == HttpAuth::AUTH_PROXY, filter.IsValid(urls[i].url, urls[i].target)) diff --git a/net/http/http_auth_gssapi_posix_unittest.cc b/net/http/http_auth_gssapi_posix_unittest.cc index cbf4d3d..1c3d12b 100644 --- a/net/http/http_auth_gssapi_posix_unittest.cc +++ b/net/http/http_auth_gssapi_posix_unittest.cc @@ -76,7 +76,7 @@ TEST(HttpAuthGSSAPIPOSIXTest, GSSAPIStartup) { // TODO(ahendrickson): Manipulate the libraries and paths to test each of the // libraries we expect, and also whether or not they have the interface // functions we want. - scoped_ptr<GSSAPILibrary> gssapi(new GSSAPISharedLibrary("")); + scoped_ptr<GSSAPILibrary> gssapi(new GSSAPISharedLibrary(std::string())); DCHECK(gssapi.get()); EXPECT_TRUE(gssapi.get()->Init()); } diff --git a/net/http/http_auth_handler_digest.cc b/net/http/http_auth_handler_digest.cc index bfc8312..cc90b52 100644 --- a/net/http/http_auth_handler_digest.cc +++ b/net/http/http_auth_handler_digest.cc @@ -270,12 +270,12 @@ bool HttpAuthHandlerDigest::ParseChallengeProperty(const std::string& name, std::string HttpAuthHandlerDigest::QopToString(QualityOfProtection qop) { switch (qop) { case QOP_UNSPECIFIED: - return ""; + return std::string(); case QOP_AUTH: return "auth"; default: NOTREACHED(); - return ""; + return std::string(); } } @@ -284,14 +284,14 @@ std::string HttpAuthHandlerDigest::AlgorithmToString( DigestAlgorithm algorithm) { switch (algorithm) { case ALGORITHM_UNSPECIFIED: - return ""; + return std::string(); case ALGORITHM_MD5: return "MD5"; case ALGORITHM_MD5_SESS: return "MD5-sess"; default: NOTREACHED(); - return ""; + return std::string(); } } diff --git a/net/http/http_auth_unittest.cc b/net/http/http_auth_unittest.cc index 88c7f95..ff63c9b 100644 --- a/net/http/http_auth_unittest.cc +++ b/net/http/http_auth_unittest.cc @@ -304,7 +304,7 @@ TEST(HttpAuthTest, ChallengeTokenizerMismatchedQuotesNoValue) { EXPECT_TRUE(parameters.GetNext()); EXPECT_TRUE(parameters.valid()); EXPECT_EQ(std::string("realm"), parameters.name()); - EXPECT_EQ(std::string(""), parameters.value()); + EXPECT_EQ(std::string(), parameters.value()); EXPECT_FALSE(parameters.GetNext()); } diff --git a/net/http/http_cache.cc b/net/http/http_cache.cc index a2a9dfc..27c591d 100644 --- a/net/http/http_cache.cc +++ b/net/http/http_cache.cc @@ -445,7 +445,7 @@ int HttpCache::CreateBackend(disk_cache::Backend** backend, // This is the only operation that we can do that is not related to any given // entry, so we use an empty key for it. - PendingOp* pending_op = GetPendingOp(""); + PendingOp* pending_op = GetPendingOp(std::string()); if (pending_op->writer) { if (!callback.is_null()) pending_op->pending_queue.push_back(item.release()); @@ -477,7 +477,7 @@ int HttpCache::GetBackendForTransaction(Transaction* trans) { WorkItem* item = new WorkItem( WI_CREATE_BACKEND, trans, net::CompletionCallback(), NULL); - PendingOp* pending_op = GetPendingOp(""); + PendingOp* pending_op = GetPendingOp(std::string()); DCHECK(pending_op->writer); pending_op->pending_queue.push_back(item); return ERR_IO_PENDING; @@ -896,7 +896,7 @@ void HttpCache::RemovePendingTransaction(Transaction* trans) { return; if (building_backend_) { - PendingOpsMap::const_iterator j = pending_ops_.find(""); + PendingOpsMap::const_iterator j = pending_ops_.find(std::string()); if (j != pending_ops_.end()) found = RemovePendingTransactionFromPendingOp(j->second, trans); diff --git a/net/http/http_network_transaction.cc b/net/http/http_network_transaction.cc index 54d79f3..467eb94 100644 --- a/net/http/http_network_transaction.cc +++ b/net/http/http_network_transaction.cc @@ -929,7 +929,7 @@ int HttpNetworkTransaction::DoReadHeadersComplete(int result) { // We treat any other 1xx in this same way (although in practice getting // a 1xx that isn't a 100 is rare). if (response_.headers->response_code() / 100 == 1) { - response_.headers = new HttpResponseHeaders(""); + response_.headers = new HttpResponseHeaders(std::string()); next_state_ = STATE_READ_HEADERS; return OK; } diff --git a/net/http/http_network_transaction_spdy2_unittest.cc b/net/http/http_network_transaction_spdy2_unittest.cc index 3f81030..0da9f2e 100644 --- a/net/http/http_network_transaction_spdy2_unittest.cc +++ b/net/http/http_network_transaction_spdy2_unittest.cc @@ -461,12 +461,24 @@ CaptureGroupNameHttpProxySocketPool::CaptureGroupNameSocketPool( CertVerifier* /* cert_verifier */) : HttpProxyClientSocketPool(0, 0, NULL, host_resolver, NULL, NULL, NULL) {} -template<> +template <> CaptureGroupNameSSLSocketPool::CaptureGroupNameSocketPool( HostResolver* host_resolver, CertVerifier* cert_verifier) - : SSLClientSocketPool(0, 0, NULL, host_resolver, cert_verifier, NULL, - NULL, "", NULL, NULL, NULL, NULL, NULL, NULL) {} + : SSLClientSocketPool(0, + 0, + NULL, + host_resolver, + cert_verifier, + NULL, + NULL, + std::string(), + NULL, + NULL, + NULL, + NULL, + NULL, + NULL) {} //----------------------------------------------------------------------------- @@ -8851,7 +8863,10 @@ TEST_F(HttpNetworkTransactionSpdy2Test, SSLClientSocketContext context; context.cert_verifier = session_deps.cert_verifier.get(); ssl_connection->set_socket(session_deps.socket_factory->CreateSSLClientSocket( - connection.release(), HostPortPair("" , 443), ssl_config, context)); + connection.release(), + HostPortPair(std::string(), 443), + ssl_config, + context)); EXPECT_EQ(ERR_IO_PENDING, ssl_connection->socket()->Connect(callback.callback())); EXPECT_EQ(OK, callback.WaitForResult()); diff --git a/net/http/http_network_transaction_spdy3_unittest.cc b/net/http/http_network_transaction_spdy3_unittest.cc index 3076326..8a90c7b 100644 --- a/net/http/http_network_transaction_spdy3_unittest.cc +++ b/net/http/http_network_transaction_spdy3_unittest.cc @@ -461,12 +461,24 @@ CaptureGroupNameHttpProxySocketPool::CaptureGroupNameSocketPool( CertVerifier* /* cert_verifier */) : HttpProxyClientSocketPool(0, 0, NULL, host_resolver, NULL, NULL, NULL) {} -template<> +template <> CaptureGroupNameSSLSocketPool::CaptureGroupNameSocketPool( HostResolver* host_resolver, CertVerifier* cert_verifier) - : SSLClientSocketPool(0, 0, NULL, host_resolver, cert_verifier, NULL, - NULL, "", NULL, NULL, NULL, NULL, NULL, NULL) {} + : SSLClientSocketPool(0, + 0, + NULL, + host_resolver, + cert_verifier, + NULL, + NULL, + std::string(), + NULL, + NULL, + NULL, + NULL, + NULL, + NULL) {} //----------------------------------------------------------------------------- @@ -8827,7 +8839,10 @@ TEST_F(HttpNetworkTransactionSpdy3Test, SSLClientSocketContext context; context.cert_verifier = session_deps.cert_verifier.get(); ssl_connection->set_socket(session_deps.socket_factory->CreateSSLClientSocket( - connection.release(), HostPortPair("" , 443), ssl_config, context)); + connection.release(), + HostPortPair(std::string(), 443), + ssl_config, + context)); EXPECT_EQ(ERR_IO_PENDING, ssl_connection->socket()->Connect(callback.callback())); EXPECT_EQ(OK, callback.WaitForResult()); diff --git a/net/http/http_proxy_client_socket_pool_spdy2_unittest.cc b/net/http/http_proxy_client_socket_pool_spdy2_unittest.cc index 77ccbed..48ac42c 100644 --- a/net/http/http_proxy_client_socket_pool_spdy2_unittest.cc +++ b/net/http/http_proxy_client_socket_pool_spdy2_unittest.cc @@ -47,26 +47,37 @@ class HttpProxyClientSocketPoolSpdy2Test : public TestWithHttpParam { protected: HttpProxyClientSocketPoolSpdy2Test() : ssl_config_(), - ignored_transport_socket_params_(new TransportSocketParams( - HostPortPair("proxy", 80), LOWEST, false, false, - OnHostResolutionCallback())), - ignored_ssl_socket_params_(new SSLSocketParams( - ignored_transport_socket_params_, NULL, NULL, - ProxyServer::SCHEME_DIRECT, HostPortPair("www.google.com", 443), - ssl_config_, 0, false, false)), + ignored_transport_socket_params_( + new TransportSocketParams(HostPortPair("proxy", 80), + LOWEST, + false, + false, + OnHostResolutionCallback())), + ignored_ssl_socket_params_( + new SSLSocketParams(ignored_transport_socket_params_, + NULL, + NULL, + ProxyServer::SCHEME_DIRECT, + HostPortPair("www.google.com", 443), + ssl_config_, + 0, + false, + false)), tcp_histograms_("MockTCP"), transport_socket_pool_( - kMaxSockets, kMaxSocketsPerGroup, + kMaxSockets, + kMaxSocketsPerGroup, &tcp_histograms_, session_deps_.deterministic_socket_factory.get()), ssl_histograms_("MockSSL"), - ssl_socket_pool_(kMaxSockets, kMaxSocketsPerGroup, + ssl_socket_pool_(kMaxSockets, + kMaxSocketsPerGroup, &ssl_histograms_, session_deps_.host_resolver.get(), session_deps_.cert_verifier.get(), NULL /* server_bound_cert_store */, NULL /* transport_security_state */, - "" /* ssl_session_cache_shard */, + std::string() /* ssl_session_cache_shard */, session_deps_.deterministic_socket_factory.get(), &transport_socket_pool_, NULL, @@ -77,13 +88,13 @@ class HttpProxyClientSocketPoolSpdy2Test : public TestWithHttpParam { http_proxy_histograms_("HttpProxyUnitTest"), ssl_data_(NULL), data_(NULL), - pool_(kMaxSockets, kMaxSocketsPerGroup, + pool_(kMaxSockets, + kMaxSocketsPerGroup, &http_proxy_histograms_, NULL, &transport_socket_pool_, &ssl_socket_pool_, - NULL) { - } + NULL) {} virtual ~HttpProxyClientSocketPoolSpdy2Test() { } @@ -115,17 +126,16 @@ class HttpProxyClientSocketPoolSpdy2Test : public TestWithHttpParam { // Returns the a correctly constructed HttpProxyParms // for the HTTP or HTTPS proxy. scoped_refptr<HttpProxySocketParams> GetParams(bool tunnel) { - return scoped_refptr<HttpProxySocketParams>( - new HttpProxySocketParams( - GetTcpParams(), - GetSslParams(), - GURL(tunnel ? "https://www.google.com/" : "http://www.google.com"), - "", - HostPortPair("www.google.com", tunnel ? 443 : 80), - session_->http_auth_cache(), - session_->http_auth_handler_factory(), - session_->spdy_session_pool(), - tunnel)); + return scoped_refptr<HttpProxySocketParams>(new HttpProxySocketParams( + GetTcpParams(), + GetSslParams(), + GURL(tunnel ? "https://www.google.com/" : "http://www.google.com"), + std::string(), + HostPortPair("www.google.com", tunnel ? 443 : 80), + session_->http_auth_cache(), + session_->http_auth_handler_factory(), + session_->spdy_session_pool(), + tunnel)); } scoped_refptr<HttpProxySocketParams> GetTunnelParams() { diff --git a/net/http/http_proxy_client_socket_pool_spdy3_unittest.cc b/net/http/http_proxy_client_socket_pool_spdy3_unittest.cc index 86924fc..36e5869 100644 --- a/net/http/http_proxy_client_socket_pool_spdy3_unittest.cc +++ b/net/http/http_proxy_client_socket_pool_spdy3_unittest.cc @@ -47,26 +47,37 @@ class HttpProxyClientSocketPoolSpdy3Test : public TestWithHttpParam { protected: HttpProxyClientSocketPoolSpdy3Test() : ssl_config_(), - ignored_transport_socket_params_(new TransportSocketParams( - HostPortPair("proxy", 80), LOWEST, false, false, - OnHostResolutionCallback())), - ignored_ssl_socket_params_(new SSLSocketParams( - ignored_transport_socket_params_, NULL, NULL, - ProxyServer::SCHEME_DIRECT, HostPortPair("www.google.com", 443), - ssl_config_, 0, false, false)), + ignored_transport_socket_params_( + new TransportSocketParams(HostPortPair("proxy", 80), + LOWEST, + false, + false, + OnHostResolutionCallback())), + ignored_ssl_socket_params_( + new SSLSocketParams(ignored_transport_socket_params_, + NULL, + NULL, + ProxyServer::SCHEME_DIRECT, + HostPortPair("www.google.com", 443), + ssl_config_, + 0, + false, + false)), tcp_histograms_("MockTCP"), transport_socket_pool_( - kMaxSockets, kMaxSocketsPerGroup, + kMaxSockets, + kMaxSocketsPerGroup, &tcp_histograms_, session_deps_.deterministic_socket_factory.get()), ssl_histograms_("MockSSL"), - ssl_socket_pool_(kMaxSockets, kMaxSocketsPerGroup, + ssl_socket_pool_(kMaxSockets, + kMaxSocketsPerGroup, &ssl_histograms_, session_deps_.host_resolver.get(), session_deps_.cert_verifier.get(), NULL /* server_bound_cert_store */, NULL /* transport_security_state */, - "" /* ssl_session_cache_shard */, + std::string() /* ssl_session_cache_shard */, session_deps_.deterministic_socket_factory.get(), &transport_socket_pool_, NULL, @@ -77,13 +88,13 @@ class HttpProxyClientSocketPoolSpdy3Test : public TestWithHttpParam { http_proxy_histograms_("HttpProxyUnitTest"), ssl_data_(NULL), data_(NULL), - pool_(kMaxSockets, kMaxSocketsPerGroup, + pool_(kMaxSockets, + kMaxSocketsPerGroup, &http_proxy_histograms_, NULL, &transport_socket_pool_, &ssl_socket_pool_, - NULL) { - } + NULL) {} virtual ~HttpProxyClientSocketPoolSpdy3Test() { } @@ -115,17 +126,16 @@ class HttpProxyClientSocketPoolSpdy3Test : public TestWithHttpParam { // Returns the a correctly constructed HttpProxyParms // for the HTTP or HTTPS proxy. scoped_refptr<HttpProxySocketParams> GetParams(bool tunnel) { - return scoped_refptr<HttpProxySocketParams>( - new HttpProxySocketParams( - GetTcpParams(), - GetSslParams(), - GURL(tunnel ? "https://www.google.com/" : "http://www.google.com"), - "", - HostPortPair("www.google.com", tunnel ? 443 : 80), - session_->http_auth_cache(), - session_->http_auth_handler_factory(), - session_->spdy_session_pool(), - tunnel)); + return scoped_refptr<HttpProxySocketParams>(new HttpProxySocketParams( + GetTcpParams(), + GetSslParams(), + GURL(tunnel ? "https://www.google.com/" : "http://www.google.com"), + std::string(), + HostPortPair("www.google.com", tunnel ? 443 : 80), + session_->http_auth_cache(), + session_->http_auth_handler_factory(), + session_->spdy_session_pool(), + tunnel)); } scoped_refptr<HttpProxySocketParams> GetTunnelParams() { diff --git a/net/http/http_security_headers_unittest.cc b/net/http/http_security_headers_unittest.cc index a142486..4f1e580 100644 --- a/net/http/http_security_headers_unittest.cc +++ b/net/http/http_security_headers_unittest.cc @@ -51,7 +51,8 @@ TEST_F(HttpSecurityHeadersTest, BogusHeaders) { base::Time expiry = now; bool include_subdomains = false; - EXPECT_FALSE(ParseHSTSHeader(now, "", &expiry, &include_subdomains)); + EXPECT_FALSE( + ParseHSTSHeader(now, std::string(), &expiry, &include_subdomains)); EXPECT_FALSE(ParseHSTSHeader(now, " ", &expiry, &include_subdomains)); EXPECT_FALSE(ParseHSTSHeader(now, "abc", &expiry, &include_subdomains)); EXPECT_FALSE(ParseHSTSHeader(now, " abc", &expiry, &include_subdomains)); @@ -135,7 +136,8 @@ static void TestBogusPinsHeaders(HashValueTag tag) { std::string good_pin = GetTestPin(2, tag); std::string backup_pin = GetTestPin(4, tag); - EXPECT_FALSE(ParseHPKPHeader(now, "", chain_hashes, &expiry, &hashes)); + EXPECT_FALSE( + ParseHPKPHeader(now, std::string(), chain_hashes, &expiry, &hashes)); EXPECT_FALSE(ParseHPKPHeader(now, " ", chain_hashes, &expiry, &hashes)); EXPECT_FALSE(ParseHPKPHeader(now, "abc", chain_hashes, &expiry, &hashes)); EXPECT_FALSE(ParseHPKPHeader(now, " abc", chain_hashes, &expiry, &hashes)); diff --git a/net/http/http_server_properties_impl_unittest.cc b/net/http/http_server_properties_impl_unittest.cc index 8dc9de3..b9ef0bf 100644 --- a/net/http/http_server_properties_impl_unittest.cc +++ b/net/http/http_server_properties_impl_unittest.cc @@ -65,7 +65,7 @@ TEST_F(SpdyServerPropertiesTest, Initialize) { } TEST_F(SpdyServerPropertiesTest, SupportsSpdyTest) { - HostPortPair spdy_server_empty("", 443); + HostPortPair spdy_server_empty(std::string(), 443); EXPECT_FALSE(impl_.SupportsSpdy(spdy_server_empty)); // Add www.google.com:443 as supporting SPDY. @@ -89,7 +89,7 @@ TEST_F(SpdyServerPropertiesTest, SupportsSpdyTest) { } TEST_F(SpdyServerPropertiesTest, SetSupportsSpdy) { - HostPortPair spdy_server_empty("", 443); + HostPortPair spdy_server_empty(std::string(), 443); impl_.SetSupportsSpdy(spdy_server_empty, true); EXPECT_FALSE(impl_.SupportsSpdy(spdy_server_empty)); @@ -134,7 +134,7 @@ TEST_F(SpdyServerPropertiesTest, GetSpdyServerList) { EXPECT_EQ(0U, spdy_server_list.GetSize()); // Check empty server is not added. - HostPortPair spdy_server_empty("", 443); + HostPortPair spdy_server_empty(std::string(), 443); impl_.SetSupportsSpdy(spdy_server_empty, true); impl_.GetSpdyServerList(&spdy_server_list); EXPECT_EQ(0U, spdy_server_list.GetSize()); @@ -303,7 +303,7 @@ TEST_F(SpdySettingsServerPropertiesTest, Initialize) { } TEST_F(SpdySettingsServerPropertiesTest, SetSpdySetting) { - HostPortPair spdy_server_empty("", 443); + HostPortPair spdy_server_empty(std::string(), 443); const SettingsMap& settings_map0 = impl_.GetSpdySettings(spdy_server_empty); EXPECT_EQ(0U, settings_map0.size()); // Returns kEmptySettingsMap. diff --git a/net/http/http_stream_factory_impl_unittest.cc b/net/http/http_stream_factory_impl_unittest.cc index 0a9437f..f228d9a 100644 --- a/net/http/http_stream_factory_impl_unittest.cc +++ b/net/http/http_stream_factory_impl_unittest.cc @@ -271,11 +271,24 @@ CapturePreconnectsHttpProxySocketPool::CapturePreconnectsSocketPool( : HttpProxyClientSocketPool(0, 0, NULL, host_resolver, NULL, NULL, NULL), last_num_streams_(-1) {} -template<> +template <> CapturePreconnectsSSLSocketPool::CapturePreconnectsSocketPool( - HostResolver* host_resolver, CertVerifier* cert_verifier) - : SSLClientSocketPool(0, 0, NULL, host_resolver, cert_verifier, NULL, - NULL, "", NULL, NULL, NULL, NULL, NULL, NULL), + HostResolver* host_resolver, + CertVerifier* cert_verifier) + : SSLClientSocketPool(0, + 0, + NULL, + host_resolver, + cert_verifier, + NULL, + NULL, + std::string(), + NULL, + NULL, + NULL, + NULL, + NULL, + NULL), last_num_streams_(-1) {} TEST(HttpStreamFactoryTest, PreconnectDirect) { diff --git a/net/http/http_util_unittest.cc b/net/http/http_util_unittest.cc index 083343d..f86821c 100644 --- a/net/http/http_util_unittest.cc +++ b/net/http/http_util_unittest.cc @@ -966,12 +966,12 @@ TEST(HttpUtilTest, NameValuePairsIteratorCopyAndAssign) { } TEST(HttpUtilTest, NameValuePairsIteratorEmptyInput) { - std::string data = ""; + std::string data; HttpUtil::NameValuePairsIterator parser(data.begin(), data.end(), ';'); EXPECT_TRUE(parser.valid()); - ASSERT_NO_FATAL_FAILURE( - CheckNextNameValuePair(&parser, false, true, "", "")); + ASSERT_NO_FATAL_FAILURE(CheckNextNameValuePair( + &parser, false, true, std::string(), std::string())); } TEST(HttpUtilTest, NameValuePairsIterator) { @@ -997,19 +997,19 @@ TEST(HttpUtilTest, NameValuePairsIterator) { ASSERT_NO_FATAL_FAILURE( CheckNextNameValuePair(&parser, true, true, "f", "'hello world'")); ASSERT_NO_FATAL_FAILURE( - CheckNextNameValuePair(&parser, true, true, "g", "")); + CheckNextNameValuePair(&parser, true, true, "g", std::string())); ASSERT_NO_FATAL_FAILURE( CheckNextNameValuePair(&parser, true, true, "h", "hello")); - ASSERT_NO_FATAL_FAILURE( - CheckNextNameValuePair(&parser, false, true, "", "")); + ASSERT_NO_FATAL_FAILURE(CheckNextNameValuePair( + &parser, false, true, std::string(), std::string())); } TEST(HttpUtilTest, NameValuePairsIteratorIllegalInputs) { ASSERT_NO_FATAL_FAILURE(CheckInvalidNameValuePair("alpha=1", "; beta")); - ASSERT_NO_FATAL_FAILURE(CheckInvalidNameValuePair("", "beta")); + ASSERT_NO_FATAL_FAILURE(CheckInvalidNameValuePair(std::string(), "beta")); ASSERT_NO_FATAL_FAILURE(CheckInvalidNameValuePair("alpha=1", "; 'beta'=2")); - ASSERT_NO_FATAL_FAILURE(CheckInvalidNameValuePair("", "'beta'=2")); + ASSERT_NO_FATAL_FAILURE(CheckInvalidNameValuePair(std::string(), "'beta'=2")); ASSERT_NO_FATAL_FAILURE(CheckInvalidNameValuePair("alpha=1", ";beta=")); ASSERT_NO_FATAL_FAILURE(CheckInvalidNameValuePair("alpha=1", ";beta=;cappa=2")); @@ -1033,8 +1033,8 @@ TEST(HttpUtilTest, NameValuePairsIteratorExtraSeparators) { CheckNextNameValuePair(&parser, true, true, "beta", "2")); ASSERT_NO_FATAL_FAILURE( CheckNextNameValuePair(&parser, true, true, "cappa", "3")); - ASSERT_NO_FATAL_FAILURE( - CheckNextNameValuePair(&parser, false, true, "", "")); + ASSERT_NO_FATAL_FAILURE(CheckNextNameValuePair( + &parser, false, true, std::string(), std::string())); } // See comments on the implementation of NameValuePairsIterator::GetNext @@ -1046,6 +1046,6 @@ TEST(HttpUtilTest, NameValuePairsIteratorMissingEndQuote) { ASSERT_NO_FATAL_FAILURE( CheckNextNameValuePair(&parser, true, true, "name", "value")); - ASSERT_NO_FATAL_FAILURE( - CheckNextNameValuePair(&parser, false, true, "", "")); + ASSERT_NO_FATAL_FAILURE(CheckNextNameValuePair( + &parser, false, true, std::string(), std::string())); } diff --git a/net/http/http_vary_data.cc b/net/http/http_vary_data.cc index c716ca0..51b74a4 100644 --- a/net/http/http_vary_data.cc +++ b/net/http/http_vary_data.cc @@ -105,7 +105,7 @@ std::string HttpVaryData::GetRequestValue( if (request_info.extra_headers.GetHeader(request_header, &result)) return result; - return ""; + return std::string(); } // static diff --git a/net/http/http_vary_data_unittest.cc b/net/http/http_vary_data_unittest.cc index 38e4e32..93ee4f45 100644 --- a/net/http/http_vary_data_unittest.cc +++ b/net/http/http_vary_data_unittest.cc @@ -41,7 +41,7 @@ TEST(HttpVaryDataTest, IsInvalid) { for (size_t i = 0; i < arraysize(kTestResponses); ++i) { TestTransaction t; - t.Init("", kTestResponses[i]); + t.Init(std::string(), kTestResponses[i]); net::HttpVaryData v; EXPECT_FALSE(v.is_valid()); diff --git a/net/proxy/dhcp_proxy_script_fetcher.cc b/net/proxy/dhcp_proxy_script_fetcher.cc index 4771d9d..1771be0 100644 --- a/net/proxy/dhcp_proxy_script_fetcher.cc +++ b/net/proxy/dhcp_proxy_script_fetcher.cc @@ -9,7 +9,7 @@ namespace net { std::string DhcpProxyScriptFetcher::GetFetcherName() const { - return ""; + return std::string(); } DhcpProxyScriptFetcher::DhcpProxyScriptFetcher() {} diff --git a/net/proxy/proxy_resolver_v8_tracing_unittest.cc b/net/proxy/proxy_resolver_v8_tracing_unittest.cc index b5503e5..5e0e108 100644 --- a/net/proxy/proxy_resolver_v8_tracing_unittest.cc +++ b/net/proxy/proxy_resolver_v8_tracing_unittest.cc @@ -282,7 +282,8 @@ TEST_F(ProxyResolverV8TracingTest, Dns) { host_resolver.rules()->AddRuleForAddressFamily( "host1", ADDRESS_FAMILY_IPV4, "166.155.144.44"); - host_resolver.rules()->AddIPLiteralRule("host1", "::1,192.168.1.1", ""); + host_resolver.rules() + ->AddIPLiteralRule("host1", "::1,192.168.1.1", std::string()); host_resolver.rules()->AddSimulatedFailure("host2"); host_resolver.rules()->AddRule("host3", "166.155.144.33"); host_resolver.rules()->AddRule("host5", "166.155.144.55"); @@ -995,7 +996,8 @@ TEST_F(ProxyResolverV8TracingTest, MultipleResolvers) { MockHostResolver host_resolver0; host_resolver0.rules()->AddRuleForAddressFamily( "host1", ADDRESS_FAMILY_IPV4, "166.155.144.44"); - host_resolver0.rules()->AddIPLiteralRule("host1", "::1,192.168.1.1", ""); + host_resolver0.rules() + ->AddIPLiteralRule("host1", "::1,192.168.1.1", std::string()); host_resolver0.rules()->AddSimulatedFailure("host2"); host_resolver0.rules()->AddRule("host3", "166.155.144.33"); host_resolver0.rules()->AddRule("host5", "166.155.144.55"); diff --git a/net/proxy/proxy_service_unittest.cc b/net/proxy/proxy_service_unittest.cc index ec4a0fa..53cc326 100644 --- a/net/proxy/proxy_service_unittest.cc +++ b/net/proxy/proxy_service_unittest.cc @@ -1723,7 +1723,7 @@ TEST_F(ProxyServiceTest, FallbackFromAutodetectToCustomPac) { // the script download. EXPECT_TRUE(fetcher->has_pending_request()); EXPECT_EQ(GURL("http://wpad/wpad.dat"), fetcher->pending_request_url()); - fetcher->NotifyFetchCompletion(ERR_FAILED, ""); + fetcher->NotifyFetchCompletion(ERR_FAILED, std::string()); // Next it should be trying the custom PAC url. EXPECT_TRUE(fetcher->has_pending_request()); @@ -1872,12 +1872,12 @@ TEST_F(ProxyServiceTest, FallbackFromAutodetectToCustomToManual) { // It should be trying to auto-detect first -- fail the download. EXPECT_TRUE(fetcher->has_pending_request()); EXPECT_EQ(GURL("http://wpad/wpad.dat"), fetcher->pending_request_url()); - fetcher->NotifyFetchCompletion(ERR_FAILED, ""); + fetcher->NotifyFetchCompletion(ERR_FAILED, std::string()); // Next it should be trying the custom PAC url -- fail the download. EXPECT_TRUE(fetcher->has_pending_request()); EXPECT_EQ(GURL("http://foopy/proxy.pac"), fetcher->pending_request_url()); - fetcher->NotifyFetchCompletion(ERR_FAILED, ""); + fetcher->NotifyFetchCompletion(ERR_FAILED, std::string()); // Since we never managed to initialize a ProxyResolver, nothing should have // been sent to it. @@ -2251,7 +2251,7 @@ TEST_F(ProxyServiceTest, PACScriptRefetchAfterFailure) { // // We simulate a failed download attempt, the proxy service should now // fall-back to DIRECT connections. - fetcher->NotifyFetchCompletion(ERR_FAILED, ""); + fetcher->NotifyFetchCompletion(ERR_FAILED, std::string()); ASSERT_TRUE(resolver->pending_requests().empty()); @@ -2604,7 +2604,7 @@ TEST_F(ProxyServiceTest, PACScriptRefetchAfterSuccess) { // to download the script. EXPECT_TRUE(fetcher->has_pending_request()); EXPECT_EQ(GURL("http://foopy/proxy.pac"), fetcher->pending_request_url()); - fetcher->NotifyFetchCompletion(ERR_FAILED, ""); + fetcher->NotifyFetchCompletion(ERR_FAILED, std::string()); MessageLoop::current()->RunUntilIdle(); @@ -2771,7 +2771,7 @@ TEST_F(ProxyServiceTest, PACScriptRefetchAfterActivity) { EXPECT_EQ(GURL("http://foopy/proxy.pac"), fetcher->pending_request_url()); // This time we will fail the download, to simulate a PAC script change. - fetcher->NotifyFetchCompletion(ERR_FAILED, ""); + fetcher->NotifyFetchCompletion(ERR_FAILED, std::string()); // Drain the message loop, so ProxyService is notified of the change // and has a chance to re-configure itself. diff --git a/net/quic/quic_http_stream_test.cc b/net/quic/quic_http_stream_test.cc index f3f4c33..1370ced 100644 --- a/net/quic/quic_http_stream_test.cc +++ b/net/quic/quic_http_stream_test.cc @@ -348,7 +348,7 @@ TEST_F(QuicHttpStreamTest, GetRequest) { stream_->ReadResponseHeaders(callback_.callback())); // Send the response without a body. - SetResponseString("404 Not Found", ""); + SetResponseString("404 Not Found", std::string()); scoped_ptr<QuicEncryptedPacket> resp( ConstructDataPacket(2, false, kFin, 0, response_data_)); ProcessPacket(*resp); @@ -440,7 +440,7 @@ TEST_F(QuicHttpStreamTest, SendPostRequest) { ProcessPacket(*ack); // Send the response headers (but not the body). - SetResponseString("200 OK", ""); + SetResponseString("200 OK", std::string()); scoped_ptr<QuicEncryptedPacket> resp( ConstructDataPacket(2, false, !kFin, 0, response_data_)); ProcessPacket(*resp); @@ -502,7 +502,7 @@ TEST_F(QuicHttpStreamTest, SendChunkedPostRequest) { ProcessPacket(*ack); // Send the response headers (but not the body). - SetResponseString("200 OK", ""); + SetResponseString("200 OK", std::string()); scoped_ptr<QuicEncryptedPacket> resp( ConstructDataPacket(2, false, !kFin, 0, response_data_)); ProcessPacket(*resp); diff --git a/net/quic/quic_packet_creator_test.cc b/net/quic/quic_packet_creator_test.cc index 5e7ed61..2f4e2e9 100644 --- a/net/quic/quic_packet_creator_test.cc +++ b/net/quic/quic_packet_creator_test.cc @@ -180,7 +180,7 @@ TEST_F(QuicPacketCreatorTest, CreateStreamFrameFinOnly) { QuicFrame frame; size_t consumed = creator_.CreateStreamFrame(1u, "", 0u, true, &frame); EXPECT_EQ(0u, consumed); - CheckStreamFrame(frame, 1u, "", 0u, true); + CheckStreamFrame(frame, 1u, std::string(), 0u, true); delete frame.stream_frame; } diff --git a/net/quic/quic_packet_generator_test.cc b/net/quic/quic_packet_generator_test.cc index c7e2918..4e84d0b 100644 --- a/net/quic/quic_packet_generator_test.cc +++ b/net/quic/quic_packet_generator_test.cc @@ -120,7 +120,7 @@ class QuicPacketGeneratorTest : public ::testing::Test { } QuicGoAwayFrame* CreateGoAwayFrame() { - return new QuicGoAwayFrame(QUIC_NO_ERROR, 1, ""); + return new QuicGoAwayFrame(QUIC_NO_ERROR, 1, std::string()); } void CheckPacketContains(const PacketContents& contents, diff --git a/net/server/http_server.cc b/net/server/http_server.cc index 4f1fb08..a0c9a3a 100644 --- a/net/server/http_server.cc +++ b/net/server/http_server.cc @@ -62,7 +62,7 @@ void HttpServer::Send200(int connection_id, } void HttpServer::Send404(int connection_id) { - Send(connection_id, HTTP_NOT_FOUND, "", "text/html"); + Send(connection_id, HTTP_NOT_FOUND, std::string(), "text/html"); } void HttpServer::Send500(int connection_id, const std::string& message) { diff --git a/net/server/http_server_request_info.cc b/net/server/http_server_request_info.cc index eda597a..08b925f 100644 --- a/net/server/http_server_request_info.cc +++ b/net/server/http_server_request_info.cc @@ -16,7 +16,7 @@ std::string HttpServerRequestInfo::GetHeaderValue( headers.find(header_name); if (it != headers.end()) return it->second; - return ""; + return std::string(); } } // namespace net diff --git a/net/socket/client_socket_pool_base_unittest.cc b/net/socket/client_socket_pool_base_unittest.cc index 0628d91..bc64306 100644 --- a/net/socket/client_socket_pool_base_unittest.cc +++ b/net/socket/client_socket_pool_base_unittest.cc @@ -274,7 +274,7 @@ class TestConnectJob : public ConnectJob { // Set all of the additional error state fields in some way. handle->set_is_ssl_error(true); HttpResponseInfo info; - info.headers = new HttpResponseHeaders(""); + info.headers = new HttpResponseHeaders(std::string()); handle->set_ssl_error_response_info(info); } } @@ -846,7 +846,7 @@ TEST_F(ClientSocketPoolBaseTest, InitConnectionFailure) { // Set the additional error state members to ensure that they get cleared. handle.set_is_ssl_error(true); HttpResponseInfo info; - info.headers = new HttpResponseHeaders(""); + info.headers = new HttpResponseHeaders(std::string()); handle.set_ssl_error_response_info(info); EXPECT_EQ(ERR_CONNECTION_FAILED, handle.Init("a", @@ -1720,7 +1720,7 @@ TEST_F(ClientSocketPoolBaseTest, // Set the additional error state members to ensure that they get cleared. handle.set_is_ssl_error(true); HttpResponseInfo info; - info.headers = new HttpResponseHeaders(""); + info.headers = new HttpResponseHeaders(std::string()); handle.set_ssl_error_response_info(info); EXPECT_EQ(ERR_IO_PENDING, handle.Init("a", params_, diff --git a/net/socket/deterministic_socket_data_unittest.cc b/net/socket/deterministic_socket_data_unittest.cc index a007e36..aea8160 100644 --- a/net/socket/deterministic_socket_data_unittest.cc +++ b/net/socket/deterministic_socket_data_unittest.cc @@ -77,9 +77,8 @@ DeterministicSocketDataTest::DeterministicSocketDataTest() false, false, OnHostResolutionCallback())), - histograms_(""), - socket_pool_(10, 10, &histograms_, &socket_factory_) { -} + histograms_(std::string()), + socket_pool_(10, 10, &histograms_, &socket_factory_) {} void DeterministicSocketDataTest::TearDown() { // Empty the current queue. diff --git a/net/socket/ssl_client_socket_pool_unittest.cc b/net/socket/ssl_client_socket_pool_unittest.cc index c188a80..fe7e3d2 100644 --- a/net/socket/ssl_client_socket_pool_unittest.cc +++ b/net/socket/ssl_client_socket_pool_unittest.cc @@ -79,46 +79,54 @@ class SSLClientSocketPoolTest : public testing::Test { SSLClientSocketPoolTest() : proxy_service_(ProxyService::CreateDirect()), ssl_config_service_(new SSLConfigServiceDefaults), - http_auth_handler_factory_(HttpAuthHandlerFactory::CreateDefault( - &host_resolver_)), + http_auth_handler_factory_( + HttpAuthHandlerFactory::CreateDefault(&host_resolver_)), session_(CreateNetworkSession()), - direct_transport_socket_params_(new TransportSocketParams( - HostPortPair("host", 443), MEDIUM, false, false, - OnHostResolutionCallback())), + direct_transport_socket_params_( + new TransportSocketParams(HostPortPair("host", 443), + MEDIUM, + false, + false, + OnHostResolutionCallback())), transport_histograms_("MockTCP"), - transport_socket_pool_( - kMaxSockets, - kMaxSocketsPerGroup, - &transport_histograms_, - &socket_factory_), - proxy_transport_socket_params_(new TransportSocketParams( - HostPortPair("proxy", 443), MEDIUM, false, false, - OnHostResolutionCallback())), - socks_socket_params_(new SOCKSSocketParams( - proxy_transport_socket_params_, true, - HostPortPair("sockshost", 443), MEDIUM)), + transport_socket_pool_(kMaxSockets, + kMaxSocketsPerGroup, + &transport_histograms_, + &socket_factory_), + proxy_transport_socket_params_( + new TransportSocketParams(HostPortPair("proxy", 443), + MEDIUM, + false, + false, + OnHostResolutionCallback())), + socks_socket_params_( + new SOCKSSocketParams(proxy_transport_socket_params_, + true, + HostPortPair("sockshost", 443), + MEDIUM)), socks_histograms_("MockSOCKS"), - socks_socket_pool_( - kMaxSockets, - kMaxSocketsPerGroup, - &socks_histograms_, - &transport_socket_pool_), - http_proxy_socket_params_(new HttpProxySocketParams( - proxy_transport_socket_params_, NULL, GURL("http://host"), "", - HostPortPair("host", 80), - session_->http_auth_cache(), - session_->http_auth_handler_factory(), - session_->spdy_session_pool(), - true)), + socks_socket_pool_(kMaxSockets, + kMaxSocketsPerGroup, + &socks_histograms_, + &transport_socket_pool_), + http_proxy_socket_params_( + new HttpProxySocketParams(proxy_transport_socket_params_, + NULL, + GURL("http://host"), + std::string(), + HostPortPair("host", 80), + session_->http_auth_cache(), + session_->http_auth_handler_factory(), + session_->spdy_session_pool(), + true)), http_proxy_histograms_("MockHttpProxy"), - http_proxy_socket_pool_( - kMaxSockets, - kMaxSocketsPerGroup, - &http_proxy_histograms_, - &host_resolver_, - &transport_socket_pool_, - NULL, - NULL) { + http_proxy_socket_pool_(kMaxSockets, + kMaxSocketsPerGroup, + &http_proxy_histograms_, + &host_resolver_, + &transport_socket_pool_, + NULL, + NULL) { scoped_refptr<SSLConfigService> ssl_config_service( new SSLConfigServiceDefaults); ssl_config_service->GetSSLConfig(&ssl_config_); @@ -134,7 +142,7 @@ class SSLClientSocketPoolTest : public testing::Test { NULL /* cert_verifier */, NULL /* server_bound_cert_service */, NULL /* transport_security_state */, - "" /* ssl_session_cache_shard */, + std::string() /* ssl_session_cache_shard */, &socket_factory_, transport_pool ? &transport_socket_pool_ : NULL, socks_pool ? &socks_socket_pool_ : NULL, @@ -722,8 +730,8 @@ TEST_F(SSLClientSocketPoolTest, IPPooling) { host_resolver_.set_synchronous_mode(true); for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_hosts); i++) { - host_resolver_.rules()->AddIPLiteralRule(test_hosts[i].name, - test_hosts[i].iplist, ""); + host_resolver_.rules()->AddIPLiteralRule( + test_hosts[i].name, test_hosts[i].iplist, std::string()); // This test requires that the HostResolver cache be populated. Normal // code would have done this already, but we do it manually. @@ -805,8 +813,8 @@ void SSLClientSocketPoolTest::TestIPPoolingDisabled( TestCompletionCallback callback; int rv; for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_hosts); i++) { - host_resolver_.rules()->AddIPLiteralRule(test_hosts[i].name, - test_hosts[i].iplist, ""); + host_resolver_.rules()->AddIPLiteralRule( + test_hosts[i].name, test_hosts[i].iplist, std::string()); // This test requires that the HostResolver cache be populated. Normal // code would have done this already, but we do it manually. diff --git a/net/socket/transport_client_socket_pool_unittest.cc b/net/socket/transport_client_socket_pool_unittest.cc index eba7c26..9d95a1b 100644 --- a/net/socket/transport_client_socket_pool_unittest.cc +++ b/net/socket/transport_client_socket_pool_unittest.cc @@ -1210,8 +1210,8 @@ TEST_F(TransportClientSocketPoolTest, IPv6FallbackSocketIPv4FinishesFirst) { client_socket_factory_.set_client_socket_types(case_types, 2); // Resolve an AddressList with a IPv6 address first and then a IPv4 address. - host_resolver_->rules()->AddIPLiteralRule( - "*", "2:abcd::3:4:ff,2.2.2.2", ""); + host_resolver_->rules() + ->AddIPLiteralRule("*", "2:abcd::3:4:ff,2.2.2.2", std::string()); TestCompletionCallback callback; ClientSocketHandle handle; @@ -1255,8 +1255,8 @@ TEST_F(TransportClientSocketPoolTest, IPv6FallbackSocketIPv6FinishesFirst) { TransportConnectJob::kIPv6FallbackTimerInMs + 50)); // Resolve an AddressList with a IPv6 address first and then a IPv4 address. - host_resolver_->rules()->AddIPLiteralRule( - "*", "2:abcd::3:4:ff,2.2.2.2", ""); + host_resolver_->rules() + ->AddIPLiteralRule("*", "2:abcd::3:4:ff,2.2.2.2", std::string()); TestCompletionCallback callback; ClientSocketHandle handle; @@ -1289,8 +1289,8 @@ TEST_F(TransportClientSocketPoolTest, IPv6NoIPv4AddressesToFallbackTo) { MockClientSocketFactory::MOCK_DELAYED_CLIENT_SOCKET); // Resolve an AddressList with only IPv6 addresses. - host_resolver_->rules()->AddIPLiteralRule( - "*", "2:abcd::3:4:ff,3:abcd::3:4:ff", ""); + host_resolver_->rules() + ->AddIPLiteralRule("*", "2:abcd::3:4:ff,3:abcd::3:4:ff", std::string()); TestCompletionCallback callback; ClientSocketHandle handle; @@ -1323,8 +1323,7 @@ TEST_F(TransportClientSocketPoolTest, IPv4HasNoFallback) { MockClientSocketFactory::MOCK_DELAYED_CLIENT_SOCKET); // Resolve an AddressList with only IPv4 addresses. - host_resolver_->rules()->AddIPLiteralRule( - "*", "1.1.1.1", ""); + host_resolver_->rules()->AddIPLiteralRule("*", "1.1.1.1", std::string()); TestCompletionCallback callback; ClientSocketHandle handle; diff --git a/net/spdy/spdy_framer_test.cc b/net/spdy/spdy_framer_test.cc index 46d44c9..3ae8871a 100644 --- a/net/spdy/spdy_framer_test.cc +++ b/net/spdy/spdy_framer_test.cc @@ -1826,7 +1826,7 @@ TEST_P(SpdyFramerTest, CreateSynStreamUncompressed) { "max stream ID"; SpdyHeaderBlock headers; - headers[""] = "foo"; + headers[std::string()] = "foo"; headers["foo"] = "bar"; const unsigned char kV2FrameData[] = { @@ -2103,7 +2103,7 @@ TEST_P(SpdyFramerTest, CreateSynReplyUncompressed) { "SYN_REPLY frame with a 0-length header name, FIN, max stream ID"; SpdyHeaderBlock headers; - headers[""] = "foo"; + headers[std::string()] = "foo"; headers["foo"] = "bar"; const unsigned char kV2FrameData[] = { @@ -2619,7 +2619,7 @@ TEST_P(SpdyFramerTest, CreateHeadersUncompressed) { "HEADERS frame with a 0-length header name, FIN, max stream ID"; SpdyHeaderBlock headers; - headers[""] = "foo"; + headers[std::string()] = "foo"; headers["foo"] = "bar"; const unsigned char kV2FrameData[] = { diff --git a/net/spdy/spdy_http_utils.cc b/net/spdy/spdy_http_utils.cc index 41647c1..49fb8ca 100644 --- a/net/spdy/spdy_http_utils.cc +++ b/net/spdy/spdy_http_utils.cc @@ -188,8 +188,9 @@ GURL GetUrlFromHeaderBlock(const SpdyHeaderBlock& headers, if (it != headers.end()) path = it->second; - std::string url = (scheme.empty() || host_port.empty() || path.empty()) - ? "" : scheme + "://" + host_port + path; + std::string url = (scheme.empty() || host_port.empty() || path.empty()) + ? std::string() + : scheme + "://" + host_port + path; return GURL(url); } diff --git a/net/spdy/spdy_session_spdy2_unittest.cc b/net/spdy/spdy_session_spdy2_unittest.cc index 0b93815..1d7026f 100644 --- a/net/spdy/spdy_session_spdy2_unittest.cc +++ b/net/spdy/spdy_session_spdy2_unittest.cc @@ -678,8 +678,8 @@ void IPPoolingTest(SpdyPoolCloseSessionsType close_sessions_type) { SpdySessionDependencies session_deps; session_deps.host_resolver->set_synchronous_mode(true); for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_hosts); i++) { - session_deps.host_resolver->rules()->AddIPLiteralRule(test_hosts[i].name, - test_hosts[i].iplist, ""); + session_deps.host_resolver->rules()->AddIPLiteralRule( + test_hosts[i].name, test_hosts[i].iplist, std::string()); // This test requires that the HostResolver cache be populated. Normal // code would have done this already, but we do it manually. @@ -1139,7 +1139,7 @@ TEST_F(SpdySessionSpdy2Test, CloseSessionWithTwoCreatedStreams) { EXPECT_EQ(0u, spdy_stream2->stream_id()); // Ensure we don't crash while closing the session. - session->CloseSessionOnError(ERR_ABORTED, true, ""); + session->CloseSessionOnError(ERR_ABORTED, true, std::string()); EXPECT_TRUE(spdy_stream1->closed()); EXPECT_TRUE(spdy_stream2->closed()); diff --git a/net/spdy/spdy_session_spdy3_unittest.cc b/net/spdy/spdy_session_spdy3_unittest.cc index c790251..eaf23ffe 100644 --- a/net/spdy/spdy_session_spdy3_unittest.cc +++ b/net/spdy/spdy_session_spdy3_unittest.cc @@ -704,8 +704,8 @@ void IPPoolingTest(SpdyPoolCloseSessionsType close_sessions_type) { SpdySessionDependencies session_deps; session_deps.host_resolver->set_synchronous_mode(true); for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_hosts); i++) { - session_deps.host_resolver->rules()->AddIPLiteralRule(test_hosts[i].name, - test_hosts[i].iplist, ""); + session_deps.host_resolver->rules()->AddIPLiteralRule( + test_hosts[i].name, test_hosts[i].iplist, std::string()); // This test requires that the HostResolver cache be populated. Normal // code would have done this already, but we do it manually. @@ -1140,7 +1140,7 @@ TEST_F(SpdySessionSpdy3Test, CloseSessionWithTwoCreatedStreams) { EXPECT_EQ(0u, spdy_stream2->stream_id()); // Ensure we don't crash while closing the session. - session->CloseSessionOnError(ERR_ABORTED, true, ""); + session->CloseSessionOnError(ERR_ABORTED, true, std::string()); EXPECT_TRUE(spdy_stream1->closed()); EXPECT_TRUE(spdy_stream2->closed()); diff --git a/net/spdy/spdy_stream.cc b/net/spdy/spdy_stream.cc index 5725253..70412dd 100644 --- a/net/spdy/spdy_stream.cc +++ b/net/spdy/spdy_stream.cc @@ -534,7 +534,7 @@ void SpdyStream::Cancel() { cancelled_ = true; if (session_->IsStreamActive(stream_id_)) - session_->ResetStream(stream_id_, RST_STREAM_CANCEL, ""); + session_->ResetStream(stream_id_, RST_STREAM_CANCEL, std::string()); else if (stream_id_ == 0) session_->CloseCreatedStream(this, RST_STREAM_CANCEL); } diff --git a/net/spdy/spdy_stream_test_util.cc b/net/spdy/spdy_stream_test_util.cc index 3b2235f..00a58df 100644 --- a/net/spdy/spdy_stream_test_util.cc +++ b/net/spdy/spdy_stream_test_util.cc @@ -101,7 +101,7 @@ int StreamDelegateBase::WaitForClose() { std::string StreamDelegateBase::GetResponseHeaderValue( const std::string& name) const { SpdyHeaderBlock::const_iterator it = response_.find(name); - return (it == response_.end()) ? "" : it->second; + return (it == response_.end()) ? std::string() : it->second; } StreamDelegateSendImmediate::StreamDelegateSendImmediate( diff --git a/net/spdy/spdy_write_queue_unittest.cc b/net/spdy/spdy_write_queue_unittest.cc index c295db8..26029e4 100644 --- a/net/spdy/spdy_write_queue_unittest.cc +++ b/net/spdy/spdy_write_queue_unittest.cc @@ -60,7 +60,8 @@ int ProducerToInt(scoped_ptr<SpdyFrameProducer> producer) { // -- be careful to not call any functions that expect the session to // be there. SpdyStream* MakeTestStream(RequestPriority priority) { - return new SpdyStream(NULL, "", priority, 0, 0, false, BoundNetLog()); + return new SpdyStream( + NULL, std::string(), priority, 0, 0, false, BoundNetLog()); } // Add some frame producers of different priority. The producers diff --git a/net/ssl/server_bound_cert_service.cc b/net/ssl/server_bound_cert_service.cc index bed97cf..3a50ed6 100644 --- a/net/ssl/server_bound_cert_service.cc +++ b/net/ssl/server_bound_cert_service.cc @@ -579,8 +579,11 @@ void ServerBoundCertService::GotServerBoundCert( delete worker; // TODO(rkn): Log to the NetLog. LOG(ERROR) << "ServerBoundCertServiceWorker couldn't be started."; - HandleResult(ERR_INSUFFICIENT_RESOURCES, server_identifier, - CLIENT_CERT_INVALID_TYPE, "", ""); + HandleResult(ERR_INSUFFICIENT_RESOURCES, + server_identifier, + CLIENT_CERT_INVALID_TYPE, + std::string(), + std::string()); return; } } @@ -610,7 +613,11 @@ void ServerBoundCertService::GeneratedServerBoundCert( HandleResult(error, server_identifier, cert->type(), cert->private_key(), cert->cert()); } else { - HandleResult(error, server_identifier, CLIENT_CERT_INVALID_TYPE, "", ""); + HandleResult(error, + server_identifier, + CLIENT_CERT_INVALID_TYPE, + std::string(), + std::string()); } } diff --git a/net/test/base_test_server.cc b/net/test/base_test_server.cc index 3a2dc11..ab9b121 100644 --- a/net/test/base_test_server.cc +++ b/net/test/base_test_server.cc @@ -92,7 +92,7 @@ base::FilePath BaseTestServer::SSLOptions::GetCertificateFile() const { std::string BaseTestServer::SSLOptions::GetOCSPArgument() const { if (server_certificate != CERT_AUTO) - return ""; + return std::string(); switch (ocsp_status) { case OCSP_OK: @@ -107,7 +107,7 @@ std::string BaseTestServer::SSLOptions::GetOCSPArgument() const { return "unknown"; default: NOTREACHED(); - return ""; + return std::string(); } } diff --git a/net/tools/dump_cache/url_to_filename_encoder_unittest.cc b/net/tools/dump_cache/url_to_filename_encoder_unittest.cc index 2e09e0b..23bbc6d 100644 --- a/net/tools/dump_cache/url_to_filename_encoder_unittest.cc +++ b/net/tools/dump_cache/url_to_filename_encoder_unittest.cc @@ -57,7 +57,8 @@ class UrlToFilenameEncoderTest : public ::testing::Test { void Validate(const string& in_word, const string& gold_word) { string escaped_word, url; - UrlToFilenameEncoder::EncodeSegment("", in_word, '/', &escaped_word); + UrlToFilenameEncoder::EncodeSegment( + std::string(), in_word, '/', &escaped_word); EXPECT_EQ(gold_word, escaped_word); CheckSegmentLength(escaped_word); CheckValidChars(escaped_word, '\\'); @@ -67,7 +68,8 @@ class UrlToFilenameEncoderTest : public ::testing::Test { void ValidateAllSegmentsSmall(const string& in_word) { string escaped_word, url; - UrlToFilenameEncoder::EncodeSegment("", in_word, '/', &escaped_word); + UrlToFilenameEncoder::EncodeSegment( + std::string(), in_word, '/', &escaped_word); CheckSegmentLength(escaped_word); CheckValidChars(escaped_word, '\\'); UrlToFilenameEncoder::Decode(escaped_word, '/', &url); @@ -106,13 +108,13 @@ class UrlToFilenameEncoderTest : public ::testing::Test { void ValidateUrlOldNew(const string& url, const string& gold_old_filename, const string& gold_new_filename) { - ValidateUrl(url, "", true, gold_old_filename); - ValidateUrl(url, "", false, gold_new_filename); + ValidateUrl(url, std::string(), true, gold_old_filename); + ValidateUrl(url, std::string(), false, gold_new_filename); } void ValidateEncodeSame(const string& url1, const string& url2) { - string filename1 = UrlToFilenameEncoder::Encode(url1, "", false); - string filename2 = UrlToFilenameEncoder::Encode(url2, "", false); + string filename1 = UrlToFilenameEncoder::Encode(url1, std::string(), false); + string filename2 = UrlToFilenameEncoder::Encode(url2, std::string(), false); EXPECT_EQ(filename1, filename2); } @@ -121,7 +123,7 @@ class UrlToFilenameEncoderTest : public ::testing::Test { }; TEST_F(UrlToFilenameEncoderTest, DoesNotEscape) { - ValidateNoChange(""); + ValidateNoChange(std::string()); ValidateNoChange("abcdefg"); ValidateNoChange("abcdefghijklmnopqrstuvwxyz"); ValidateNoChange("ZYXWVUT"); @@ -193,7 +195,8 @@ TEST_F(UrlToFilenameEncoderTest, EncodeUrlCorrectly) { // From bug: Double slash preserved. ValidateUrl("http://www.foo.com/u?site=http://www.google.com/index.html", - "", false, + std::string(), + false, "www.foo.com" + dir_sep_ + "u" + escape_ + "3Fsite=http" + escape_ + "3A" + dir_sep_ + escape_ + "2Fwww.google.com" + dir_sep_ + "index.html" + escape_); @@ -326,7 +329,8 @@ TEST_F(UrlToFilenameEncoderTest, BackslashSeparator) { string long_word; string escaped_word; long_word.append(UrlToFilenameEncoder::kMaximumSubdirectoryLength + 1, 'x'); - UrlToFilenameEncoder::EncodeSegment("", long_word, '\\', &escaped_word); + UrlToFilenameEncoder::EncodeSegment( + std::string(), long_word, '\\', &escaped_word); // check that one backslash, plus the escape ",-", and the ending , got added. EXPECT_EQ(long_word.size() + 4, escaped_word.size()); diff --git a/net/tools/fetch/fetch_server.cc b/net/tools/fetch/fetch_server.cc index 830cd18..34c7c83 100644 --- a/net/tools/fetch/fetch_server.cc +++ b/net/tools/fetch/fetch_server.cc @@ -36,7 +36,8 @@ int main(int argc, char**argv) { // Do work here. MessageLoop loop; - HttpServer server("", 80); // TODO(mbelshe): make port configurable + HttpServer server(std::string(), + 80); // TODO(mbelshe): make port configurable MessageLoop::current()->Run(); if (parsed_command_line.HasSwitch("stats")) { diff --git a/net/tools/flip_server/acceptor_thread.cc b/net/tools/flip_server/acceptor_thread.cc index b16d181..ed8a3ec 100644 --- a/net/tools/flip_server/acceptor_thread.cc +++ b/net/tools/flip_server/acceptor_thread.cc @@ -105,7 +105,9 @@ void SMAcceptorThread::HandleConnection(int server_fd, NULL, &epoll_server_, server_fd, - "", "", remote_ip, + std::string(), + std::string(), + remote_ip, use_ssl_); if (server_connection->initialized()) active_server_connections_.push_back(server_connection); diff --git a/net/tools/flip_server/flip_in_mem_edsm_server.cc b/net/tools/flip_server/flip_in_mem_edsm_server.cc index 8ba1505..15fb9644 100644 --- a/net/tools/flip_server/flip_in_mem_edsm_server.cc +++ b/net/tools/flip_server/flip_in_mem_edsm_server.cc @@ -335,11 +335,16 @@ int main (int argc, char**argv) std::string value = cl.GetSwitchValueASCII("spdy-server"); std::vector<std::string> valueArgs = split(value, ','); while (valueArgs.size() < 4) - valueArgs.push_back(""); + valueArgs.push_back(std::string()); g_proxy_config.AddAcceptor(net::FLIP_HANDLER_SPDY_SERVER, - valueArgs[0], valueArgs[1], - valueArgs[2], valueArgs[3], - "", "", "", "", + valueArgs[0], + valueArgs[1], + valueArgs[2], + valueArgs[3], + std::string(), + std::string(), + std::string(), + std::string(), 0, FLAGS_accept_backlog_size, FLAGS_disable_nagle, @@ -356,11 +361,16 @@ int main (int argc, char**argv) std::string value = cl.GetSwitchValueASCII("http-server"); std::vector<std::string> valueArgs = split(value, ','); while (valueArgs.size() < 4) - valueArgs.push_back(""); + valueArgs.push_back(std::string()); g_proxy_config.AddAcceptor(net::FLIP_HANDLER_HTTP_SERVER, - valueArgs[0], valueArgs[1], - valueArgs[2], valueArgs[3], - "", "", "", "", + valueArgs[0], + valueArgs[1], + valueArgs[2], + valueArgs[3], + std::string(), + std::string(), + std::string(), + std::string(), 0, FLAGS_accept_backlog_size, FLAGS_disable_nagle, diff --git a/net/tools/flip_server/spdy_interface.cc b/net/tools/flip_server/spdy_interface.cc index 1c34e79..649e99e 100644 --- a/net/tools/flip_server/spdy_interface.cc +++ b/net/tools/flip_server/spdy_interface.cc @@ -112,9 +112,14 @@ SMInterface* SpdySM::FindOrMakeNewSMConnectionInterface( } sm_http_interface->InitSMInterface(this, server_idx); - sm_http_interface->InitSMConnection(NULL, sm_http_interface, - epoll_server_, -1, - server_ip, server_port, "", false); + sm_http_interface->InitSMConnection(NULL, + sm_http_interface, + epoll_server_, + -1, + server_ip, + server_port, + std::string(), + false); return sm_http_interface; } diff --git a/net/tools/flip_server/streamer_interface.cc b/net/tools/flip_server/streamer_interface.cc index 9e6e6c8..b1612e7 100644 --- a/net/tools/flip_server/streamer_interface.cc +++ b/net/tools/flip_server/streamer_interface.cc @@ -131,11 +131,13 @@ int StreamerSM::PostAcceptHook() { } // The Streamer interface is used to stream HTTPS connections, so we // will always use the https_server_ip/port here. - sm_other_interface_->InitSMConnection(NULL, sm_other_interface_, - epoll_server_, -1, + sm_other_interface_->InitSMConnection(NULL, + sm_other_interface_, + epoll_server_, + -1, acceptor_->https_server_ip_, acceptor_->https_server_port_, - "", + std::string(), false); return 1; diff --git a/net/tools/quic/end_to_end_test.cc b/net/tools/quic/end_to_end_test.cc index e98c4ea..cb14db8 100644 --- a/net/tools/quic/end_to_end_test.cc +++ b/net/tools/quic/end_to_end_test.cc @@ -234,7 +234,7 @@ TEST_F(EndToEndTest, SeparateFinPacket) { client_->SendMessage(request); - client_->SendData("", true); + client_->SendData(std::string(), true); client_->WaitForResponse(); EXPECT_EQ(kFooResponseBody, client_->response_body()); @@ -243,7 +243,7 @@ TEST_F(EndToEndTest, SeparateFinPacket) { request.AddBody("foo", true); client_->SendMessage(request); - client_->SendData("", true); + client_->SendData(std::string(), true); client_->WaitForResponse(); EXPECT_EQ(kFooResponseBody, client_->response_body()); EXPECT_EQ(200ul, client_->response_headers()->parsed_response_code()); diff --git a/net/tools/quic/quic_client.cc b/net/tools/quic/quic_client.cc index 4a61ab4..8acb85a 100644 --- a/net/tools/quic/quic_client.cc +++ b/net/tools/quic/quic_client.cc @@ -43,8 +43,8 @@ QuicClient::QuicClient(IPEndPoint server_address, QuicClient::~QuicClient() { if (connected()) { - session()->connection()->SendConnectionClosePacket( - QUIC_PEER_GOING_AWAY, ""); + session()->connection() + ->SendConnectionClosePacket(QUIC_PEER_GOING_AWAY, std::string()); } } diff --git a/net/tools/quic/test_tools/quic_test_client.cc b/net/tools/quic/test_tools/quic_test_client.cc index 53bc057..843af2f 100644 --- a/net/tools/quic/test_tools/quic_test_client.cc +++ b/net/tools/quic/test_tools/quic_test_client.cc @@ -85,7 +85,7 @@ string QuicTestClient::SendCustomSynchronousRequest( string QuicTestClient::SendSynchronousRequest(const string& uri) { if (SendRequest(uri) == 0) { DLOG(ERROR) << "Failed to the request for uri:" << uri; - return ""; + return std::string(); } WaitForResponse(); return response_; diff --git a/net/udp/udp_socket_unittest.cc b/net/udp/udp_socket_unittest.cc index c2085ad..09a2806 100644 --- a/net/udp/udp_socket_unittest.cc +++ b/net/udp/udp_socket_unittest.cc @@ -38,7 +38,7 @@ class UDPSocketTest : public PlatformTest { if (rv == ERR_IO_PENDING) rv = callback.WaitForResult(); if (rv < 0) - return ""; // error! + return std::string(); // error! return std::string(buffer_->data(), rv); } @@ -82,7 +82,7 @@ class UDPSocketTest : public PlatformTest { if (rv == ERR_IO_PENDING) rv = callback.WaitForResult(); if (rv < 0) - return ""; // error! + return std::string(); // error! return std::string(buffer_->data(), rv); } diff --git a/net/url_request/url_fetcher_impl_unittest.cc b/net/url_request/url_fetcher_impl_unittest.cc index 98a3a11..c8cbd1a 100644 --- a/net/url_request/url_fetcher_impl_unittest.cc +++ b/net/url_request/url_fetcher_impl_unittest.cc @@ -441,11 +441,16 @@ class CancelTestURLRequestContextGetter // The initial backoff is 2 seconds and maximum backoff is 4 seconds. // Maximum retries allowed is set to 2. scoped_refptr<URLRequestThrottlerEntry> entry( - new URLRequestThrottlerEntry( - context_->throttler_manager(), - "", 200, 3, 2000, 2.0, 0.0, 4000)); - context_->throttler_manager()->OverrideEntryForTests( - throttle_for_url_, entry); + new URLRequestThrottlerEntry(context_->throttler_manager(), + std::string(), + 200, + 3, + 2000, + 2.0, + 0.0, + 4000)); + context_->throttler_manager() + ->OverrideEntryForTests(throttle_for_url_, entry); context_created_.Signal(); } @@ -553,7 +558,7 @@ void URLFetcherEmptyPostTest::CreateFetcher(const GURL& url) { fetcher_ = new URLFetcherImpl(url, URLFetcher::POST, this); fetcher_->SetRequestContext(new TestURLRequestContextGetter( io_message_loop_proxy())); - fetcher_->SetUploadData("text/plain", ""); + fetcher_->SetUploadData("text/plain", std::string()); fetcher_->Start(); } @@ -1163,9 +1168,14 @@ TEST_F(URLFetcherProtectTest, Overload) { // Registers an entry for test url. It only allows 3 requests to be sent // in 200 milliseconds. scoped_refptr<URLRequestThrottlerEntry> entry( - new URLRequestThrottlerEntry( - request_context()->throttler_manager(), - "", 200, 3, 1, 2.0, 0.0, 256)); + new URLRequestThrottlerEntry(request_context()->throttler_manager(), + std::string(), + 200, + 3, + 1, + 2.0, + 0.0, + 256)); request_context()->throttler_manager()->OverrideEntryForTests(url, entry); CreateFetcher(url); @@ -1186,9 +1196,14 @@ TEST_F(URLFetcherProtectTest, ServerUnavailable) { // and maximum backoff time is 256 milliseconds. // Maximum retries allowed is set to 11. scoped_refptr<URLRequestThrottlerEntry> entry( - new URLRequestThrottlerEntry( - request_context()->throttler_manager(), - "", 200, 3, 1, 2.0, 0.0, 256)); + new URLRequestThrottlerEntry(request_context()->throttler_manager(), + std::string(), + 200, + 3, + 1, + 2.0, + 0.0, + 256)); request_context()->throttler_manager()->OverrideEntryForTests(url, entry); CreateFetcher(url); @@ -1209,9 +1224,14 @@ TEST_F(URLFetcherProtectTestPassedThrough, ServerUnavailablePropagateResponse) { // and maximum backoff time is 150000 milliseconds. // Maximum retries allowed is set to 11. scoped_refptr<URLRequestThrottlerEntry> entry( - new URLRequestThrottlerEntry( - request_context()->throttler_manager(), - "", 200, 3, 100, 2.0, 0.0, 150000)); + new URLRequestThrottlerEntry(request_context()->throttler_manager(), + std::string(), + 200, + 3, + 100, + 2.0, + 0.0, + 150000)); // Total time if *not* for not doing automatic backoff would be 150s. // In reality it should be "as soon as server responds". request_context()->throttler_manager()->OverrideEntryForTests(url, entry); @@ -1268,9 +1288,14 @@ TEST_F(URLFetcherCancelTest, CancelWhileDelayedStartTaskPending) { // Using a sliding window of 4 seconds, and max of 1 request, under a fast // run we expect to have a 4 second delay when posting the Start task. scoped_refptr<URLRequestThrottlerEntry> entry( - new URLRequestThrottlerEntry( - request_context()->throttler_manager(), - "", 4000, 1, 2000, 2.0, 0.0, 4000)); + new URLRequestThrottlerEntry(request_context()->throttler_manager(), + std::string(), + 4000, + 1, + 2000, + 2.0, + 0.0, + 4000)); request_context()->throttler_manager()->OverrideEntryForTests(url, entry); // Fake that a request has just started. entry->ReserveSendingTimeForNextRequest(base::TimeTicks()); diff --git a/net/url_request/url_request_throttler_simulation_unittest.cc b/net/url_request/url_request_throttler_simulation_unittest.cc index 3a5a399..cbb8be8 100644 --- a/net/url_request/url_request_throttler_simulation_unittest.cc +++ b/net/url_request/url_request_throttler_simulation_unittest.cc @@ -297,11 +297,9 @@ class Server : public DiscreteTimeSimulation::Actor { // Mock throttler entry used by Requester class. class MockURLRequestThrottlerEntry : public URLRequestThrottlerEntry { public: - explicit MockURLRequestThrottlerEntry( - URLRequestThrottlerManager* manager) - : URLRequestThrottlerEntry(manager, ""), - mock_backoff_entry_(&backoff_policy_) { - } + explicit MockURLRequestThrottlerEntry(URLRequestThrottlerManager* manager) + : URLRequestThrottlerEntry(manager, std::string()), + mock_backoff_entry_(&backoff_policy_) {} virtual const BackoffEntry* GetBackoffEntry() const OVERRIDE { return &mock_backoff_entry_; @@ -433,7 +431,7 @@ class Requester : public DiscreteTimeSimulation::Actor { if (!throttler_entry_->ShouldRejectRequest(server_->mock_request())) { int status_code = server_->HandleRequest(); MockURLRequestThrottlerHeaderAdapter response_headers(status_code); - throttler_entry_->UpdateWithResponse("", &response_headers); + throttler_entry_->UpdateWithResponse(std::string(), &response_headers); if (status_code == 200) { if (results_) diff --git a/net/url_request/url_request_throttler_test_support.cc b/net/url_request/url_request_throttler_test_support.cc index b6088ec..9d3f4e2 100644 --- a/net/url_request/url_request_throttler_test_support.cc +++ b/net/url_request/url_request_throttler_test_support.cc @@ -48,7 +48,7 @@ std::string MockURLRequestThrottlerHeaderAdapter::GetNormalizedValue( return fake_opt_out_value_; } - return ""; + return std::string(); } int MockURLRequestThrottlerHeaderAdapter::GetResponseCode() const { diff --git a/net/url_request/url_request_throttler_unittest.cc b/net/url_request/url_request_throttler_unittest.cc index cb20a95..ed3eb87 100644 --- a/net/url_request/url_request_throttler_unittest.cc +++ b/net/url_request/url_request_throttler_unittest.cc @@ -37,7 +37,7 @@ class MockURLRequestThrottlerEntry : public URLRequestThrottlerEntry { public: explicit MockURLRequestThrottlerEntry( net::URLRequestThrottlerManager* manager) - : net::URLRequestThrottlerEntry(manager, ""), + : net::URLRequestThrottlerEntry(manager, std::string()), mock_backoff_entry_(&backoff_policy_) { InitPolicy(); } @@ -46,7 +46,7 @@ class MockURLRequestThrottlerEntry : public URLRequestThrottlerEntry { const TimeTicks& exponential_backoff_release_time, const TimeTicks& sliding_window_release_time, const TimeTicks& fake_now) - : net::URLRequestThrottlerEntry(manager, ""), + : net::URLRequestThrottlerEntry(manager, std::string()), fake_time_now_(fake_now), mock_backoff_entry_(&backoff_policy_) { InitPolicy(); @@ -279,14 +279,14 @@ TEST_F(URLRequestThrottlerEntryTest, InterfaceNotDuringExponentialBackoff) { TEST_F(URLRequestThrottlerEntryTest, InterfaceUpdateFailure) { MockURLRequestThrottlerHeaderAdapter failure_response(503); - entry_->UpdateWithResponse("", &failure_response); + entry_->UpdateWithResponse(std::string(), &failure_response); EXPECT_GT(entry_->GetExponentialBackoffReleaseTime(), entry_->fake_time_now_) << "A failure should increase the release_time"; } TEST_F(URLRequestThrottlerEntryTest, InterfaceUpdateSuccess) { MockURLRequestThrottlerHeaderAdapter success_response(200); - entry_->UpdateWithResponse("", &success_response); + entry_->UpdateWithResponse(std::string(), &success_response); EXPECT_EQ(entry_->GetExponentialBackoffReleaseTime(), entry_->fake_time_now_) << "A success should not add any delay"; } @@ -294,11 +294,11 @@ TEST_F(URLRequestThrottlerEntryTest, InterfaceUpdateSuccess) { TEST_F(URLRequestThrottlerEntryTest, InterfaceUpdateSuccessThenFailure) { MockURLRequestThrottlerHeaderAdapter failure_response(503); MockURLRequestThrottlerHeaderAdapter success_response(200); - entry_->UpdateWithResponse("", &success_response); - entry_->UpdateWithResponse("", &failure_response); + entry_->UpdateWithResponse(std::string(), &success_response); + entry_->UpdateWithResponse(std::string(), &failure_response); EXPECT_GT(entry_->GetExponentialBackoffReleaseTime(), entry_->fake_time_now_) << "This scenario should add delay"; - entry_->UpdateWithResponse("", &success_response); + entry_->UpdateWithResponse(std::string(), &success_response); } TEST_F(URLRequestThrottlerEntryTest, IsEntryReallyOutdated) { @@ -324,7 +324,7 @@ TEST_F(URLRequestThrottlerEntryTest, IsEntryReallyOutdated) { TEST_F(URLRequestThrottlerEntryTest, MaxAllowedBackoff) { for (int i = 0; i < 30; ++i) { MockURLRequestThrottlerHeaderAdapter response_adapter(503); - entry_->UpdateWithResponse("", &response_adapter); + entry_->UpdateWithResponse(std::string(), &response_adapter); } TimeDelta delay = entry_->GetExponentialBackoffReleaseTime() - now_; @@ -335,7 +335,7 @@ TEST_F(URLRequestThrottlerEntryTest, MaxAllowedBackoff) { TEST_F(URLRequestThrottlerEntryTest, MalformedContent) { MockURLRequestThrottlerHeaderAdapter response_adapter(503); for (int i = 0; i < 5; ++i) - entry_->UpdateWithResponse("", &response_adapter); + entry_->UpdateWithResponse(std::string(), &response_adapter); TimeTicks release_after_failures = entry_->GetExponentialBackoffReleaseTime(); @@ -346,7 +346,7 @@ TEST_F(URLRequestThrottlerEntryTest, MalformedContent) { // response must also have been received). entry_->ReceivedContentWasMalformed(200); MockURLRequestThrottlerHeaderAdapter success_adapter(200); - entry_->UpdateWithResponse("", &success_adapter); + entry_->UpdateWithResponse(std::string(), &success_adapter); EXPECT_GT(entry_->GetExponentialBackoffReleaseTime(), release_after_failures); } @@ -475,7 +475,7 @@ void ExpectEntryAllowsAllOnErrorIfOptedOut( MockURLRequestThrottlerHeaderAdapter failure_adapter(503); for (int i = 0; i < 10; ++i) { // Host doesn't really matter in this scenario so we skip it. - entry->UpdateWithResponse("", &failure_adapter); + entry->UpdateWithResponse(std::string(), &failure_adapter); } EXPECT_NE(opted_out, entry->ShouldRejectRequest(request)); @@ -500,7 +500,7 @@ TEST_F(URLRequestThrottlerManagerTest, OptOutHeader) { // Fake a response with the opt-out header. MockURLRequestThrottlerHeaderAdapter response_adapter( - "", + std::string(), MockURLRequestThrottlerEntry::kExponentialThrottlingDisableValue, 200); entry->UpdateWithResponse("www.google.com", &response_adapter); @@ -517,7 +517,8 @@ TEST_F(URLRequestThrottlerManagerTest, OptOutHeader) { // Fake a response with the opt-out header incorrectly specified. scoped_refptr<net::URLRequestThrottlerEntryInterface> no_opt_out_entry = manager.RegisterRequestUrl(GURL("http://www.nike.com/justdoit")); - MockURLRequestThrottlerHeaderAdapter wrong_adapter("", "yesplease", 200); + MockURLRequestThrottlerHeaderAdapter wrong_adapter( + std::string(), "yesplease", 200); no_opt_out_entry->UpdateWithResponse("www.nike.com", &wrong_adapter); ExpectEntryAllowsAllOnErrorIfOptedOut(no_opt_out_entry, false, request_); @@ -535,7 +536,7 @@ TEST_F(URLRequestThrottlerManagerTest, ClearOnNetworkChange) { MockURLRequestThrottlerHeaderAdapter failure_adapter(503); for (int j = 0; j < 10; ++j) { // Host doesn't really matter in this scenario so we skip it. - entry_before->UpdateWithResponse("", &failure_adapter); + entry_before->UpdateWithResponse(std::string(), &failure_adapter); } EXPECT_TRUE(entry_before->ShouldRejectRequest(request_)); diff --git a/net/url_request/url_request_unittest.cc b/net/url_request/url_request_unittest.cc index 494e6b3..c3c68a1 100644 --- a/net/url_request/url_request_unittest.cc +++ b/net/url_request/url_request_unittest.cc @@ -2577,7 +2577,7 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateCancelRequest) { &network_delegate); { - URLRequest r(test_server_.GetURL(""), &d, &context); + URLRequest r(test_server_.GetURL(std::string()), &d, &context); r.Start(); MessageLoop::current()->Run(); @@ -2626,21 +2626,21 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateCancelRequestSynchronously1) { ASSERT_TRUE(test_server_.Start()); NetworkDelegateCancelRequest(BlockingNetworkDelegate::SYNCHRONOUS, BlockingNetworkDelegate::ON_BEFORE_URL_REQUEST, - test_server_.GetURL("")); + test_server_.GetURL(std::string())); } TEST_F(URLRequestTestHTTP, NetworkDelegateCancelRequestSynchronously2) { ASSERT_TRUE(test_server_.Start()); NetworkDelegateCancelRequest(BlockingNetworkDelegate::SYNCHRONOUS, BlockingNetworkDelegate::ON_BEFORE_SEND_HEADERS, - test_server_.GetURL("")); + test_server_.GetURL(std::string())); } TEST_F(URLRequestTestHTTP, NetworkDelegateCancelRequestSynchronously3) { ASSERT_TRUE(test_server_.Start()); NetworkDelegateCancelRequest(BlockingNetworkDelegate::SYNCHRONOUS, BlockingNetworkDelegate::ON_HEADERS_RECEIVED, - test_server_.GetURL("")); + test_server_.GetURL(std::string())); } // The following 3 tests check that the network delegate can cancel a request @@ -2649,21 +2649,21 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateCancelRequestAsynchronously1) { ASSERT_TRUE(test_server_.Start()); NetworkDelegateCancelRequest(BlockingNetworkDelegate::AUTO_CALLBACK, BlockingNetworkDelegate::ON_BEFORE_URL_REQUEST, - test_server_.GetURL("")); + test_server_.GetURL(std::string())); } TEST_F(URLRequestTestHTTP, NetworkDelegateCancelRequestAsynchronously2) { ASSERT_TRUE(test_server_.Start()); NetworkDelegateCancelRequest(BlockingNetworkDelegate::AUTO_CALLBACK, BlockingNetworkDelegate::ON_BEFORE_SEND_HEADERS, - test_server_.GetURL("")); + test_server_.GetURL(std::string())); } TEST_F(URLRequestTestHTTP, NetworkDelegateCancelRequestAsynchronously3) { ASSERT_TRUE(test_server_.Start()); NetworkDelegateCancelRequest(BlockingNetworkDelegate::AUTO_CALLBACK, BlockingNetworkDelegate::ON_HEADERS_RECEIVED, - test_server_.GetURL("")); + test_server_.GetURL(std::string())); } // Tests that the network delegate can block and redirect a request to a new @@ -2992,7 +2992,7 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateCancelWhileWaiting1) { context.Init(); { - URLRequest r(test_server_.GetURL(""), &d, &context); + URLRequest r(test_server_.GetURL(std::string()), &d, &context); r.Start(); MessageLoop::current()->Run(); @@ -3028,7 +3028,7 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateCancelWhileWaiting2) { context.Init(); { - URLRequest r(test_server_.GetURL(""), &d, &context); + URLRequest r(test_server_.GetURL(std::string()), &d, &context); r.Start(); MessageLoop::current()->Run(); @@ -3063,7 +3063,7 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateCancelWhileWaiting3) { context.Init(); { - URLRequest r(test_server_.GetURL(""), &d, &context); + URLRequest r(test_server_.GetURL(std::string()), &d, &context); r.Start(); MessageLoop::current()->Run(); @@ -3147,7 +3147,7 @@ TEST_F(URLRequestTestHTTP, GetTest_NoCache) { TestDelegate d; { - URLRequest r(test_server_.GetURL(""), &d, &default_context_); + URLRequest r(test_server_.GetURL(std::string()), &d, &default_context_); r.Start(); EXPECT_TRUE(r.is_pending()); @@ -3213,7 +3213,7 @@ TEST_F(URLRequestTestHTTP, GetTest) { TestDelegate d; { - URLRequest r(test_server_.GetURL(""), &d, &default_context_); + URLRequest r(test_server_.GetURL(std::string()), &d, &default_context_); r.Start(); EXPECT_TRUE(r.is_pending()); @@ -3235,7 +3235,7 @@ TEST_F(URLRequestTestHTTP, GetTestLoadTiming) { TestDelegate d; { - URLRequest r(test_server_.GetURL(""), &d, &default_context_); + URLRequest r(test_server_.GetURL(std::string()), &d, &default_context_); r.Start(); EXPECT_TRUE(r.is_pending()); @@ -3319,7 +3319,7 @@ TEST_F(URLRequestTestHTTP, HTTPSToHTTPRedirectNoRefererTest) { // An https server is sent a request with an https referer, // and responds with a redirect to an http url. The http // server should not be sent the referer. - GURL http_destination = test_server_.GetURL(""); + GURL http_destination = test_server_.GetURL(std::string()); TestDelegate d; URLRequest req(https_test_server.GetURL( "server-redirect?" + http_destination.spec()), &d, &default_context_); @@ -3336,9 +3336,9 @@ TEST_F(URLRequestTestHTTP, HTTPSToHTTPRedirectNoRefererTest) { TEST_F(URLRequestTestHTTP, RedirectLoadTiming) { ASSERT_TRUE(test_server_.Start()); - GURL destination_url = test_server_.GetURL(""); - GURL original_url = test_server_.GetURL( - "server-redirect?" + destination_url.spec()); + GURL destination_url = test_server_.GetURL(std::string()); + GURL original_url = + test_server_.GetURL("server-redirect?" + destination_url.spec()); TestDelegate d; URLRequest req(original_url, &d, &default_context_); req.Start(); @@ -3374,9 +3374,9 @@ TEST_F(URLRequestTestHTTP, RedirectLoadTiming) { TEST_F(URLRequestTestHTTP, MultipleRedirectTest) { ASSERT_TRUE(test_server_.Start()); - GURL destination_url = test_server_.GetURL(""); - GURL middle_redirect_url = test_server_.GetURL( - "server-redirect?" + destination_url.spec()); + GURL destination_url = test_server_.GetURL(std::string()); + GURL middle_redirect_url = + test_server_.GetURL("server-redirect?" + destination_url.spec()); GURL original_url = test_server_.GetURL( "server-redirect?" + middle_redirect_url.spec()); TestDelegate d; @@ -3492,7 +3492,7 @@ TEST_F(URLRequestTestHTTP, CancelTest2) { TestDelegate d; { - URLRequest r(test_server_.GetURL(""), &d, &default_context_); + URLRequest r(test_server_.GetURL(std::string()), &d, &default_context_); d.set_cancel_in_response_started(true); @@ -3513,7 +3513,7 @@ TEST_F(URLRequestTestHTTP, CancelTest3) { TestDelegate d; { - URLRequest r(test_server_.GetURL(""), &d, &default_context_); + URLRequest r(test_server_.GetURL(std::string()), &d, &default_context_); d.set_cancel_in_received_data(true); @@ -3537,7 +3537,7 @@ TEST_F(URLRequestTestHTTP, CancelTest4) { TestDelegate d; { - URLRequest r(test_server_.GetURL(""), &d, &default_context_); + URLRequest r(test_server_.GetURL(std::string()), &d, &default_context_); r.Start(); EXPECT_TRUE(r.is_pending()); @@ -4496,7 +4496,7 @@ TEST_F(HTTPSRequestTest, HTTPSGetTest) { TestDelegate d; { - URLRequest r(test_server.GetURL(""), &d, &default_context_); + URLRequest r(test_server.GetURL(std::string()), &d, &default_context_); r.Start(); EXPECT_TRUE(r.is_pending()); @@ -4526,7 +4526,7 @@ TEST_F(HTTPSRequestTest, HTTPSMismatchedTest) { TestDelegate d; { d.set_allow_certificate_errors(err_allowed); - URLRequest r(test_server.GetURL(""), &d, &default_context_); + URLRequest r(test_server.GetURL(std::string()), &d, &default_context_); r.Start(); EXPECT_TRUE(r.is_pending()); @@ -4561,7 +4561,7 @@ TEST_F(HTTPSRequestTest, HTTPSExpiredTest) { TestDelegate d; { d.set_allow_certificate_errors(err_allowed); - URLRequest r(test_server.GetURL(""), &d, &default_context_); + URLRequest r(test_server.GetURL(std::string()), &d, &default_context_); r.Start(); EXPECT_TRUE(r.is_pending()); @@ -4605,7 +4605,7 @@ TEST_F(HTTPSRequestTest, TLSv1Fallback) { TestURLRequestContext context(true); context.Init(); d.set_allow_certificate_errors(true); - URLRequest r(test_server.GetURL(""), &d, &context); + URLRequest r(test_server.GetURL(std::string()), &d, &context); r.Start(); MessageLoop::current()->Run(); @@ -4784,7 +4784,7 @@ TEST_F(HTTPSRequestTest, SSLv3Fallback) { TestURLRequestContext context(true); context.Init(); d.set_allow_certificate_errors(true); - URLRequest r(test_server.GetURL(""), &d, &context); + URLRequest r(test_server.GetURL(std::string()), &d, &context); r.Start(); MessageLoop::current()->Run(); @@ -4832,7 +4832,7 @@ TEST_F(HTTPSRequestTest, ClientAuthTest) { SSLClientAuthTestDelegate d; { - URLRequest r(test_server.GetURL(""), &d, &default_context_); + URLRequest r(test_server.GetURL(std::string()), &d, &default_context_); r.Start(); EXPECT_TRUE(r.is_pending()); @@ -5072,7 +5072,7 @@ class HTTPSOCSPTest : public HTTPSRequestTest { TestDelegate d; d.set_allow_certificate_errors(true); - URLRequest r(test_server.GetURL(""), &d, &context_); + URLRequest r(test_server.GetURL(std::string()), &d, &context_); r.Start(); MessageLoop::current()->Run(); diff --git a/net/websockets/websocket_net_log_params_unittest.cc b/net/websockets/websocket_net_log_params_unittest.cc index e3c92a9..0519390f 100644 --- a/net/websockets/websocket_net_log_params_unittest.cc +++ b/net/websockets/websocket_net_log_params_unittest.cc @@ -21,7 +21,7 @@ TEST(NetLogWebSocketHandshakeParameterTest, ToValue) { list->Append(new StringValue("Upgrade: WebSocket")); list->Append(new StringValue("Sec-WebSocket-Key1: 4 @1 46546xW%0l 1 5")); list->Append(new StringValue("Origin: http://example.com")); - list->Append(new StringValue("")); + list->Append(new StringValue(std::string())); list->Append(new StringValue("\\x00\\x01\\x0a\\x0d\\xff\\xfe\\x0d\\x0a")); DictionaryValue expected; diff --git a/ppapi/cpp/dev/text_input_dev.cc b/ppapi/cpp/dev/text_input_dev.cc index 3b38df8..657a0b3 100644 --- a/ppapi/cpp/dev/text_input_dev.cc +++ b/ppapi/cpp/dev/text_input_dev.cc @@ -54,7 +54,7 @@ TextInput_Dev::~TextInput_Dev() { void TextInput_Dev::RequestSurroundingText(uint32_t) { // Default implementation. Send a null range. - UpdateSurroundingText("", 0, 0); + UpdateSurroundingText(std::string(), 0, 0); } void TextInput_Dev::SetTextInputType(PP_TextInput_Type type) { diff --git a/ppapi/examples/ime/ime.cc b/ppapi/examples/ime/ime.cc index f5e2e44..6f3e655 100644 --- a/ppapi/examples/ime/ime.cc +++ b/ppapi/examples/ime/ime.cc @@ -245,7 +245,7 @@ class MyTextField { int32_t target_segment, const std::pair<uint32_t, uint32_t>& selection) { if (HasSelection() && !text.empty()) - InsertText(""); + InsertText(std::string()); composition_ = text; segments_ = segments; target_segment_ = target_segment; @@ -344,7 +344,7 @@ class MyTextField { if (!Focused()) return; if (HasSelection()) { - InsertText(""); + InsertText(std::string()); } else { size_t i = GetNextCharOffsetUtf8(utf8_text_, caret_pos_); utf8_text_.erase(caret_pos_, i - caret_pos_); @@ -356,7 +356,7 @@ class MyTextField { if (!Focused()) return; if (HasSelection()) { - InsertText(""); + InsertText(std::string()); } else if (caret_pos_ != 0) { size_t i = GetPrevCharOffsetUtf8(utf8_text_, caret_pos_); utf8_text_.erase(i, caret_pos_ - i); @@ -565,8 +565,10 @@ class MyInstance : public pp::Instance { it != textfield_.end(); ++it) { if (it->Focused()) { - it->SetComposition("", std::vector< std::pair<uint32_t, uint32_t> >(), - 0, std::make_pair(0, 0)); + it->SetComposition(std::string(), + std::vector<std::pair<uint32_t, uint32_t> >(), + 0, + std::make_pair(0, 0)); return true; } } diff --git a/ppapi/native_client/src/trusted/plugin/plugin.cc b/ppapi/native_client/src/trusted/plugin/plugin.cc index e1f3ad9..7b2f0a9 100644 --- a/ppapi/native_client/src/trusted/plugin/plugin.cc +++ b/ppapi/native_client/src/trusted/plugin/plugin.cc @@ -677,7 +677,6 @@ bool Plugin::Init(uint32_t argc, const char* argn[], const char* argv[]) { return status; } - Plugin::Plugin(PP_Instance pp_instance) : pp::InstancePrivate(pp_instance), scriptable_plugin_(NULL), @@ -688,7 +687,6 @@ Plugin::Plugin(PP_Instance pp_instance) nacl_ready_state_(UNSENT), nexe_error_reported_(false), wrapper_factory_(NULL), - last_error_string_(""), enable_dev_interfaces_(false), is_installed_(false), init_time_(0), diff --git a/ppapi/native_client/src/trusted/plugin/plugin_error.h b/ppapi/native_client/src/trusted/plugin/plugin_error.h index 90c0284..f02ef83 100644 --- a/ppapi/native_client/src/trusted/plugin/plugin_error.h +++ b/ppapi/native_client/src/trusted/plugin/plugin_error.h @@ -109,7 +109,7 @@ class ErrorInfo { } void Reset() { - SetReport(ERROR_UNKNOWN, ""); + SetReport(ERROR_UNKNOWN, std::string()); } void SetReport(PluginErrorCode error_code, const std::string& message) { diff --git a/ppapi/native_client/src/trusted/plugin/pnacl_translate_thread.cc b/ppapi/native_client/src/trusted/plugin/pnacl_translate_thread.cc index a7d3f24..ff0982e 100644 --- a/ppapi/native_client/src/trusted/plugin/pnacl_translate_thread.cc +++ b/ppapi/native_client/src/trusted/plugin/pnacl_translate_thread.cc @@ -224,9 +224,7 @@ void PnaclTranslateThread::DoTranslate() { } PLUGIN_PRINTF(("PnaclTranslateThread done with chunks\n")); // Finish llc. - if(!llc_subprocess_->InvokeSrpcMethod("StreamEnd", - "", - ¶ms)) { + if (!llc_subprocess_->InvokeSrpcMethod("StreamEnd", std::string(), ¶ms)) { PLUGIN_PRINTF(("PnaclTranslateThread StreamEnd failed\n")); if (llc_subprocess_->srpc_client()->GetLastError() == NACL_SRPC_RESULT_APP_ERROR) { diff --git a/ppapi/native_client/src/trusted/plugin/service_runtime.cc b/ppapi/native_client/src/trusted/plugin/service_runtime.cc index 00f64c7..68a50d3 100644 --- a/ppapi/native_client/src/trusted/plugin/service_runtime.cc +++ b/ppapi/native_client/src/trusted/plugin/service_runtime.cc @@ -846,7 +846,7 @@ nacl::string ServiceRuntime::GetCrashLogOutput() { if (NULL != subprocess_.get()) { return subprocess_->GetCrashLogOutput(); } else { - return ""; + return std::string(); } } diff --git a/ppapi/proxy/audio_input_resource.cc b/ppapi/proxy/audio_input_resource.cc index 5f700ec..4f321c2 100644 --- a/ppapi/proxy/audio_input_resource.cc +++ b/ppapi/proxy/audio_input_resource.cc @@ -217,7 +217,10 @@ void AudioInputResource::SetStreamInfo( shared_memory_size_ = shared_memory_size; if (!shared_memory_->Map(shared_memory_size_)) { - PpapiGlobals::Get()->LogWithSource(pp_instance(), PP_LOGLEVEL_WARNING, "", + PpapiGlobals::Get()->LogWithSource( + pp_instance(), + PP_LOGLEVEL_WARNING, + std::string(), "Failed to map shared memory for PPB_AudioInput_Shared."); } diff --git a/ppapi/shared_impl/ppb_audio_shared.cc b/ppapi/shared_impl/ppb_audio_shared.cc index f275559..f6d0cac 100644 --- a/ppapi/shared_impl/ppb_audio_shared.cc +++ b/ppapi/shared_impl/ppb_audio_shared.cc @@ -80,8 +80,11 @@ void PPB_Audio_Shared::SetStreamInfo( if (!shared_memory_->Map( media::TotalSharedMemorySizeInBytes(shared_memory_size_))) { - PpapiGlobals::Get()->LogWithSource(instance, PP_LOGLEVEL_WARNING, "", - "Failed to map shared memory for PPB_Audio_Shared."); + PpapiGlobals::Get()->LogWithSource( + instance, + PP_LOGLEVEL_WARNING, + std::string(), + "Failed to map shared memory for PPB_Audio_Shared."); } else { audio_bus_ = media::AudioBus::WrapMemory( kChannels, sample_frame_count, shared_memory_->memory()); diff --git a/ppapi/tests/test_file_ref.cc b/ppapi/tests/test_file_ref.cc index 2dfea85..f3217f9 100644 --- a/ppapi/tests/test_file_ref.cc +++ b/ppapi/tests/test_file_ref.cc @@ -85,7 +85,7 @@ void TestFileRef::RunTests(const std::string& filter) { std::string TestFileRef::TestCreate() { std::vector<std::string> invalid_paths; invalid_paths.push_back("invalid_path"); // no '/' at the first character - invalid_paths.push_back(""); // empty path + invalid_paths.push_back(std::string()); // empty path // The following are directory traversal checks invalid_paths.push_back(".."); invalid_paths.push_back("/../invalid_path"); diff --git a/ppapi/tests/test_flash_clipboard.cc b/ppapi/tests/test_flash_clipboard.cc index e38c145..8eb756b 100644 --- a/ppapi/tests/test_flash_clipboard.cc +++ b/ppapi/tests/test_flash_clipboard.cc @@ -253,7 +253,7 @@ std::string TestFlashClipboard::TestInvalidFormat() { std::string TestFlashClipboard::TestRegisterCustomFormat() { // Test an empty name is rejected. uint32_t format_id = - pp::flash::Clipboard::RegisterCustomFormat(instance_, ""); + pp::flash::Clipboard::RegisterCustomFormat(instance_, std::string()); ASSERT_EQ(format_id, PP_FLASH_CLIPBOARD_FORMAT_INVALID); // Test a valid format name. diff --git a/ppapi/tests/test_flash_file.cc b/ppapi/tests/test_flash_file.cc index 86100d9..e5a8ee9 100644 --- a/ppapi/tests/test_flash_file.cc +++ b/ppapi/tests/test_flash_file.cc @@ -285,12 +285,10 @@ std::string TestFlashFile::TestGetDirContents() { CloseFileHandle(file_handle); ASSERT_TRUE(FileModuleLocal::CreateDir(instance_, dirname)); - ASSERT_TRUE(FileModuleLocal::GetDirContents(instance_, "", &result)); - FileModuleLocal::DirEntry expected[] = - { {"..", true}, - {filename, false}, - {dirname, true} - }; + ASSERT_TRUE( + FileModuleLocal::GetDirContents(instance_, std::string(), &result)); + FileModuleLocal::DirEntry expected[] = { { "..", true }, { filename, false }, + { dirname, true } }; size_t expected_size = sizeof(expected) / sizeof(expected[0]); std::sort(expected, expected + expected_size, DirEntryLessThan); @@ -329,7 +327,8 @@ std::string TestFlashFile::TestCreateTemporaryFile() { std::string TestFlashFile::GetItemCountUnderModuleLocalRoot( size_t* item_count) { std::vector<FileModuleLocal::DirEntry> contents; - ASSERT_TRUE(FileModuleLocal::GetDirContents(instance_, "", &contents)); + ASSERT_TRUE( + FileModuleLocal::GetDirContents(instance_, std::string(), &contents)); *item_count = contents.size(); PASS(); } diff --git a/ppapi/tests/test_ime_input_event.cc b/ppapi/tests/test_ime_input_event.cc index 804e17d7a..500fcbb 100644 --- a/ppapi/tests/test_ime_input_event.cc +++ b/ppapi/tests/test_ime_input_event.cc @@ -357,11 +357,11 @@ std::string TestImeInputEvent::TestImeCancel() { expected_events_.clear(); expected_events_.push_back(CreateImeCompositionStartEvent()); expected_events_.push_back(update_event); - expected_events_.push_back(CreateImeCompositionEndEvent("")); + expected_events_.push_back(CreateImeCompositionEndEvent(std::string())); // Simulate the case when IME canceled composition. ASSERT_TRUE(SimulateInputEvent(update_event)); - ASSERT_TRUE(SimulateInputEvent(CreateImeCompositionEndEvent(""))); + ASSERT_TRUE(SimulateInputEvent(CreateImeCompositionEndEvent(std::string()))); ASSERT_TRUE(expected_events_.empty()); PASS(); @@ -417,7 +417,7 @@ std::string TestImeInputEvent::TestImeUnawareCancel() { // Test for IME-unaware plugins. Cancel won't issue any events. ASSERT_TRUE(SimulateInputEvent(update_event)); - ASSERT_TRUE(SimulateInputEvent(CreateImeCompositionEndEvent(""))); + ASSERT_TRUE(SimulateInputEvent(CreateImeCompositionEndEvent(std::string()))); ASSERT_TRUE(expected_events_.empty()); PASS(); diff --git a/ppapi/tests/test_url_loader.cc b/ppapi/tests/test_url_loader.cc index 112a483..320167a 100644 --- a/ppapi/tests/test_url_loader.cc +++ b/ppapi/tests/test_url_loader.cc @@ -375,7 +375,7 @@ std::string TestURLLoader::TestEmptyDataPOST() { request.SetURL("/echo"); request.SetMethod("POST"); request.AppendDataToBody("", 0); - return LoadAndCompareBody(request, ""); + return LoadAndCompareBody(request, std::string()); } std::string TestURLLoader::TestBinaryDataPOST() { @@ -558,11 +558,12 @@ std::string TestURLLoader::TestUntrustedHttpRequests() { // valid token (containing special characters like CR, LF). // http://www.w3.org/TR/XMLHttpRequest/ { - ASSERT_EQ(OpenUntrusted("cOnNeCt", ""), PP_ERROR_NOACCESS); - ASSERT_EQ(OpenUntrusted("tRaCk", ""), PP_ERROR_NOACCESS); - ASSERT_EQ(OpenUntrusted("tRaCe", ""), PP_ERROR_NOACCESS); - ASSERT_EQ(OpenUntrusted("POST\x0d\x0ax-csrf-token:\x20test1234", ""), - PP_ERROR_NOACCESS); + ASSERT_EQ(OpenUntrusted("cOnNeCt", std::string()), PP_ERROR_NOACCESS); + ASSERT_EQ(OpenUntrusted("tRaCk", std::string()), PP_ERROR_NOACCESS); + ASSERT_EQ(OpenUntrusted("tRaCe", std::string()), PP_ERROR_NOACCESS); + ASSERT_EQ( + OpenUntrusted("POST\x0d\x0ax-csrf-token:\x20test1234", std::string()), + PP_ERROR_NOACCESS); } // HTTP methods are restricted only for untrusted loaders. Try all headers // that are forbidden by http://www.w3.org/TR/XMLHttpRequest/. @@ -619,9 +620,9 @@ std::string TestURLLoader::TestUntrustedHttpRequests() { std::string TestURLLoader::TestTrustedHttpRequests() { // Trusted requests can use restricted methods. { - ASSERT_EQ(OpenTrusted("cOnNeCt", ""), PP_OK); - ASSERT_EQ(OpenTrusted("tRaCk", ""), PP_OK); - ASSERT_EQ(OpenTrusted("tRaCe", ""), PP_OK); + ASSERT_EQ(OpenTrusted("cOnNeCt", std::string()), PP_OK); + ASSERT_EQ(OpenTrusted("tRaCk", std::string()), PP_OK); + ASSERT_EQ(OpenTrusted("tRaCe", std::string()), PP_OK); } // Trusted requests can use restricted headers. { diff --git a/ppapi/tests/test_websocket.cc b/ppapi/tests/test_websocket.cc index e61185d..61a8e19 100644 --- a/ppapi/tests/test_websocket.cc +++ b/ppapi/tests/test_websocket.cc @@ -350,18 +350,18 @@ std::string TestWebSocket::TestUninitializedPropertiesAccess() { ASSERT_EQ(0U, close_code); PP_Var close_reason = websocket_interface_->GetCloseReason(ws); - ASSERT_TRUE(AreEqualWithString(close_reason, "")); + ASSERT_TRUE(AreEqualWithString(close_reason, std::string())); ReleaseVar(close_reason); PP_Bool close_was_clean = websocket_interface_->GetCloseWasClean(ws); ASSERT_EQ(PP_FALSE, close_was_clean); PP_Var extensions = websocket_interface_->GetExtensions(ws); - ASSERT_TRUE(AreEqualWithString(extensions, "")); + ASSERT_TRUE(AreEqualWithString(extensions, std::string())); ReleaseVar(extensions); PP_Var protocol = websocket_interface_->GetProtocol(ws); - ASSERT_TRUE(AreEqualWithString(protocol, "")); + ASSERT_TRUE(AreEqualWithString(protocol, std::string())); ReleaseVar(protocol); PP_WebSocketReadyState ready_state = @@ -369,7 +369,7 @@ std::string TestWebSocket::TestUninitializedPropertiesAccess() { ASSERT_EQ(PP_WEBSOCKETREADYSTATE_INVALID, ready_state); PP_Var url = websocket_interface_->GetURL(ws); - ASSERT_TRUE(AreEqualWithString(url, "")); + ASSERT_TRUE(AreEqualWithString(url, std::string())); ReleaseVar(url); core_interface_->ReleaseResource(ws); @@ -398,7 +398,7 @@ std::string TestWebSocket::TestInvalidConnect() { for (int i = 0; kInvalidURLs[i]; ++i) { int32_t result; - ws = Connect(kInvalidURLs[i], &result, ""); + ws = Connect(kInvalidURLs[i], &result, std::string()); ASSERT_TRUE(ws); ASSERT_EQ(PP_ERROR_BADARGUMENT, result); @@ -448,7 +448,7 @@ std::string TestWebSocket::TestProtocols() { std::string TestWebSocket::TestGetURL() { for (int i = 0; kInvalidURLs[i]; ++i) { int32_t result; - PP_Resource ws = Connect(kInvalidURLs[i], &result, ""); + PP_Resource ws = Connect(kInvalidURLs[i], &result, std::string()); ASSERT_TRUE(ws); PP_Var url = websocket_interface_->GetURL(ws); ASSERT_TRUE(AreEqualWithString(url, kInvalidURLs[i])); @@ -463,11 +463,11 @@ std::string TestWebSocket::TestGetURL() { std::string TestWebSocket::TestValidConnect() { int32_t result; - PP_Resource ws = Connect(GetFullURL(kEchoServerURL), &result, ""); + PP_Resource ws = Connect(GetFullURL(kEchoServerURL), &result, std::string()); ASSERT_TRUE(ws); ASSERT_EQ(PP_OK, result); PP_Var extensions = websocket_interface_->GetExtensions(ws); - ASSERT_TRUE(AreEqualWithString(extensions, "")); + ASSERT_TRUE(AreEqualWithString(extensions, std::string())); core_interface_->ReleaseResource(ws); ReleaseVar(extensions); @@ -489,7 +489,7 @@ std::string TestWebSocket::TestInvalidClose() { // Close with bad arguments. int32_t result; - ws = Connect(GetFullURL(kEchoServerURL), &result, ""); + ws = Connect(GetFullURL(kEchoServerURL), &result, std::string()); ASSERT_TRUE(ws); ASSERT_EQ(PP_OK, result); callback.WaitForResult(websocket_interface_->Close( @@ -498,7 +498,7 @@ std::string TestWebSocket::TestInvalidClose() { core_interface_->ReleaseResource(ws); // Close with PP_VARTYPE_NULL. - ws = Connect(GetFullURL(kEchoServerURL), &result, ""); + ws = Connect(GetFullURL(kEchoServerURL), &result, std::string()); ASSERT_TRUE(ws); ASSERT_EQ(PP_OK, result); callback.WaitForResult(websocket_interface_->Close( @@ -508,7 +508,7 @@ std::string TestWebSocket::TestInvalidClose() { core_interface_->ReleaseResource(ws); // Close with PP_VARTYPE_NULL and ongoing receive message. - ws = Connect(GetFullURL(kEchoServerURL), &result, ""); + ws = Connect(GetFullURL(kEchoServerURL), &result, std::string()); ASSERT_TRUE(ws); ASSERT_EQ(PP_OK, result); PP_Var receive_message_var; @@ -532,7 +532,7 @@ std::string TestWebSocket::TestInvalidClose() { core_interface_->ReleaseResource(ws); // Close twice. - ws = Connect(GetFullURL(kEchoServerURL), &result, ""); + ws = Connect(GetFullURL(kEchoServerURL), &result, std::string()); ASSERT_TRUE(ws); ASSERT_EQ(PP_OK, result); result = websocket_interface_->Close( @@ -569,7 +569,7 @@ std::string TestWebSocket::TestValidClose() { // Close. int32_t result; - PP_Resource ws = Connect(GetFullURL(kEchoServerURL), &result, ""); + PP_Resource ws = Connect(GetFullURL(kEchoServerURL), &result, std::string()); ASSERT_TRUE(ws); ASSERT_EQ(PP_OK, result); callback.WaitForResult(websocket_interface_->Close( @@ -580,7 +580,7 @@ std::string TestWebSocket::TestValidClose() { core_interface_->ReleaseResource(ws); // Close without code and reason. - ws = Connect(GetFullURL(kEchoServerURL), &result, ""); + ws = Connect(GetFullURL(kEchoServerURL), &result, std::string()); ASSERT_TRUE(ws); ASSERT_EQ(PP_OK, result); callback.WaitForResult(websocket_interface_->Close( @@ -590,7 +590,7 @@ std::string TestWebSocket::TestValidClose() { core_interface_->ReleaseResource(ws); // Close with PP_VARTYPE_UNDEFINED. - ws = Connect(GetFullURL(kEchoServerURL), &result, ""); + ws = Connect(GetFullURL(kEchoServerURL), &result, std::string()); ASSERT_TRUE(ws); ASSERT_EQ(PP_OK, result); callback.WaitForResult(websocket_interface_->Close( @@ -620,7 +620,7 @@ std::string TestWebSocket::TestValidClose() { // Close in closing. // The first close will be done successfully, then the second one failed with // with PP_ERROR_INPROGRESS immediately. - ws = Connect(GetFullURL(kEchoServerURL), &result, ""); + ws = Connect(GetFullURL(kEchoServerURL), &result, std::string()); ASSERT_TRUE(ws); ASSERT_EQ(PP_OK, result); result = websocket_interface_->Close( @@ -636,7 +636,7 @@ std::string TestWebSocket::TestValidClose() { core_interface_->ReleaseResource(ws); // Close with ongoing receive message. - ws = Connect(GetFullURL(kEchoServerURL), &result, ""); + ws = Connect(GetFullURL(kEchoServerURL), &result, std::string()); ASSERT_TRUE(ws); ASSERT_EQ(PP_OK, result); PP_Var receive_message_var; @@ -655,7 +655,7 @@ std::string TestWebSocket::TestValidClose() { core_interface_->ReleaseResource(ws); // Close with PP_VARTYPE_UNDEFINED and ongoing receive message. - ws = Connect(GetFullURL(kEchoServerURL), &result, ""); + ws = Connect(GetFullURL(kEchoServerURL), &result, std::string()); ASSERT_TRUE(ws); ASSERT_EQ(PP_OK, result); result = websocket_interface_->ReceiveMessage( @@ -673,7 +673,8 @@ std::string TestWebSocket::TestValidClose() { core_interface_->ReleaseResource(ws); // Server initiated closing handshake. - ws = Connect(GetFullURL(kCloseWithCodeAndReasonServerURL), &result, ""); + ws = Connect( + GetFullURL(kCloseWithCodeAndReasonServerURL), &result, std::string()); ASSERT_TRUE(ws); ASSERT_EQ(PP_OK, result); // Text messsage "1000 bye" requests the server to initiate closing handshake @@ -720,7 +721,8 @@ std::string TestWebSocket::TestGetProtocol() { std::string TestWebSocket::TestTextSendReceive() { // Connect to test echo server. int32_t connect_result; - PP_Resource ws = Connect(GetFullURL(kEchoServerURL), &connect_result, ""); + PP_Resource ws = + Connect(GetFullURL(kEchoServerURL), &connect_result, std::string()); ASSERT_TRUE(ws); ASSERT_EQ(PP_OK, connect_result); @@ -747,7 +749,8 @@ std::string TestWebSocket::TestTextSendReceive() { std::string TestWebSocket::TestBinarySendReceive() { // Connect to test echo server. int32_t connect_result; - PP_Resource ws = Connect(GetFullURL(kEchoServerURL), &connect_result, ""); + PP_Resource ws = + Connect(GetFullURL(kEchoServerURL), &connect_result, std::string()); ASSERT_TRUE(ws); ASSERT_EQ(PP_OK, connect_result); @@ -776,7 +779,8 @@ std::string TestWebSocket::TestBinarySendReceive() { std::string TestWebSocket::TestStressedSendReceive() { // Connect to test echo server. int32_t connect_result; - PP_Resource ws = Connect(GetFullURL(kEchoServerURL), &connect_result, ""); + PP_Resource ws = + Connect(GetFullURL(kEchoServerURL), &connect_result, std::string()); ASSERT_TRUE(ws); ASSERT_EQ(PP_OK, connect_result); @@ -836,7 +840,8 @@ std::string TestWebSocket::TestStressedSendReceive() { std::string TestWebSocket::TestBufferedAmount() { // Connect to test echo server. int32_t connect_result; - PP_Resource ws = Connect(GetFullURL(kEchoServerURL), &connect_result, ""); + PP_Resource ws = + Connect(GetFullURL(kEchoServerURL), &connect_result, std::string()); ASSERT_TRUE(ws); ASSERT_EQ(PP_OK, connect_result); @@ -876,7 +881,7 @@ std::string TestWebSocket::TestBufferedAmount() { // After connection closure, all sending requests fail and just increase // the bufferedAmount property. - PP_Var empty_string = CreateVarString(""); + PP_Var empty_string = CreateVarString(std::string()); result = websocket_interface_->SendMessage(ws, empty_string); ASSERT_EQ(PP_ERROR_FAILED, result); buffered_amount = websocket_interface_->GetBufferedAmount(ws); @@ -919,7 +924,7 @@ std::string TestWebSocket::TestAbortCallsWithCallback() { ASSERT_EQ(PP_ERROR_ABORTED, connect_callback.result()); // Test the behavior for Close(). - ws = Connect(url, &result, ""); + ws = Connect(url, &result, std::string()); ASSERT_TRUE(ws); ASSERT_EQ(PP_OK, result); PP_Var reason_var = CreateVarString("abort"); @@ -936,7 +941,7 @@ std::string TestWebSocket::TestAbortCallsWithCallback() { // Test the behavior for ReceiveMessage(). // Make sure the simplest case to wait for data which never arrives, here. - ws = Connect(url, &result, ""); + ws = Connect(url, &result, std::string()); ASSERT_TRUE(ws); ASSERT_EQ(PP_OK, result); PP_Var receive_var; @@ -952,7 +957,7 @@ std::string TestWebSocket::TestAbortCallsWithCallback() { // Release the resource in the aborting receive completion callback which is // introduced by calling Close(). - ws = Connect(url, &result, ""); + ws = Connect(url, &result, std::string()); ASSERT_TRUE(ws); ASSERT_EQ(PP_OK, result); result = websocket_interface_->ReceiveMessage( @@ -986,7 +991,7 @@ std::string TestWebSocket::TestAbortSendMessageCall() { int32_t result; std::string url = GetFullURL(kEchoServerURL); - PP_Resource ws = Connect(url, &result, ""); + PP_Resource ws = Connect(url, &result, std::string()); ASSERT_TRUE(ws); ASSERT_EQ(PP_OK, result); result = websocket_interface_->SendMessage(ws, large_var); @@ -1001,7 +1006,7 @@ std::string TestWebSocket::TestAbortCloseCall() { // Release the resource in the close completion callback. int32_t result; std::string url = GetFullURL(kEchoServerURL); - PP_Resource ws = Connect(url, &result, ""); + PP_Resource ws = Connect(url, &result, std::string()); ASSERT_TRUE(ws); ASSERT_EQ(PP_OK, result); TestCompletionCallback close_callback( @@ -1034,7 +1039,7 @@ std::string TestWebSocket::TestAbortReceiveMessageCall() { // released while the next message is going to be received. const int trial_count = 8; for (int trial = 1; trial <= trial_count; trial++) { - ws = Connect(url, &result, ""); + ws = Connect(url, &result, std::string()); ASSERT_TRUE(ws); ASSERT_EQ(PP_OK, result); for (int i = 0; i <= trial_count; ++i) { @@ -1060,7 +1065,7 @@ std::string TestWebSocket::TestAbortReceiveMessageCall() { } // Same test, but the last receiving message is large message over 64KiB. for (int trial = 1; trial <= trial_count; trial++) { - ws = Connect(url, &result, ""); + ws = Connect(url, &result, std::string()); ASSERT_TRUE(ws); ASSERT_EQ(PP_OK, result); for (int i = 0; i <= trial_count; ++i) { @@ -1102,12 +1107,12 @@ std::string TestWebSocket::TestCcInterfaces() { // Check uninitialized properties access. ASSERT_EQ(0, ws.GetBufferedAmount()); ASSERT_EQ(0, ws.GetCloseCode()); - ASSERT_TRUE(AreEqualWithString(ws.GetCloseReason().pp_var(), "")); + ASSERT_TRUE(AreEqualWithString(ws.GetCloseReason().pp_var(), std::string())); ASSERT_EQ(false, ws.GetCloseWasClean()); - ASSERT_TRUE(AreEqualWithString(ws.GetExtensions().pp_var(), "")); - ASSERT_TRUE(AreEqualWithString(ws.GetProtocol().pp_var(), "")); + ASSERT_TRUE(AreEqualWithString(ws.GetExtensions().pp_var(), std::string())); + ASSERT_TRUE(AreEqualWithString(ws.GetProtocol().pp_var(), std::string())); ASSERT_EQ(PP_WEBSOCKETREADYSTATE_INVALID, ws.GetReadyState()); - ASSERT_TRUE(AreEqualWithString(ws.GetURL().pp_var(), "")); + ASSERT_TRUE(AreEqualWithString(ws.GetURL().pp_var(), std::string())); // Check communication interfaces (connect, send, receive, and close). TestCompletionCallback connect_callback( @@ -1163,7 +1168,7 @@ std::string TestWebSocket::TestCcInterfaces() { ASSERT_TRUE( AreEqualWithString(ws.GetCloseReason().pp_var(), reason.c_str())); ASSERT_EQ(true, ws.GetCloseWasClean()); - ASSERT_TRUE(AreEqualWithString(ws.GetProtocol().pp_var(), "")); + ASSERT_TRUE(AreEqualWithString(ws.GetProtocol().pp_var(), std::string())); ASSERT_EQ(PP_WEBSOCKETREADYSTATE_CLOSED, ws.GetReadyState()); ASSERT_TRUE(AreEqualWithString( ws.GetURL().pp_var(), GetFullURL(kCloseServerURL).c_str())); @@ -1268,7 +1273,8 @@ std::string TestWebSocket::TestUtilityValidConnect() { const std::vector<WebSocketEvent>& events = websocket.GetSeenEvents(); ASSERT_EQ(1U, events.size()); ASSERT_EQ(WebSocketEvent::EVENT_OPEN, events[0].event_type); - ASSERT_TRUE(AreEqualWithString(websocket.GetExtensions().pp_var(), "")); + ASSERT_TRUE( + AreEqualWithString(websocket.GetExtensions().pp_var(), std::string())); PASS(); } @@ -1496,7 +1502,7 @@ std::string TestWebSocket::TestUtilityBufferedAmount() { // After connection closure, all sending requests fail and just increase // the bufferedAmount property. - result = websocket.Send(pp::Var(std::string(""))); + result = websocket.Send(pp::Var(std::string())); ASSERT_EQ(PP_ERROR_FAILED, result); buffered_amount = websocket.GetBufferedAmount(); ASSERT_EQ(base_buffered_amount + kMessageFrameOverhead, buffered_amount); diff --git a/ppapi/tests/test_x509_certificate_private.cc b/ppapi/tests/test_x509_certificate_private.cc index 6aee30f..fab2f21 100644 --- a/ppapi/tests/test_x509_certificate_private.cc +++ b/ppapi/tests/test_x509_certificate_private.cc @@ -166,22 +166,30 @@ std::string TestX509CertificatePrivate::TestValidCertificate() { PP_X509CERTIFICATE_PRIVATE_SUBJECT_COUNTRY_NAME, "US")); ASSERT_TRUE(FieldMatchesString(certificate, PP_X509CERTIFICATE_PRIVATE_SUBJECT_ORGANIZATION_NAME, "Google Inc")); - ASSERT_TRUE(FieldMatchesString(certificate, - PP_X509CERTIFICATE_PRIVATE_SUBJECT_ORGANIZATION_UNIT_NAME, "")); + ASSERT_TRUE(FieldMatchesString( + certificate, + PP_X509CERTIFICATE_PRIVATE_SUBJECT_ORGANIZATION_UNIT_NAME, + std::string())); ASSERT_TRUE(FieldMatchesString(certificate, PP_X509CERTIFICATE_PRIVATE_ISSUER_COMMON_NAME, "Thawte SGC CA")); - ASSERT_TRUE(FieldMatchesString(certificate, - PP_X509CERTIFICATE_PRIVATE_ISSUER_LOCALITY_NAME, "")); - ASSERT_TRUE(FieldMatchesString(certificate, - PP_X509CERTIFICATE_PRIVATE_ISSUER_STATE_OR_PROVINCE_NAME, "")); - ASSERT_TRUE(FieldMatchesString(certificate, - PP_X509CERTIFICATE_PRIVATE_ISSUER_COUNTRY_NAME, "ZA")); + ASSERT_TRUE( + FieldMatchesString(certificate, + PP_X509CERTIFICATE_PRIVATE_ISSUER_LOCALITY_NAME, + std::string())); + ASSERT_TRUE(FieldMatchesString( + certificate, + PP_X509CERTIFICATE_PRIVATE_ISSUER_STATE_OR_PROVINCE_NAME, + std::string())); + ASSERT_TRUE(FieldMatchesString( + certificate, PP_X509CERTIFICATE_PRIVATE_ISSUER_COUNTRY_NAME, "ZA")); ASSERT_TRUE(FieldMatchesString(certificate, PP_X509CERTIFICATE_PRIVATE_ISSUER_ORGANIZATION_NAME, "Thawte Consulting (Pty) Ltd.")); - ASSERT_TRUE(FieldMatchesString(certificate, - PP_X509CERTIFICATE_PRIVATE_ISSUER_ORGANIZATION_UNIT_NAME, "")); + ASSERT_TRUE(FieldMatchesString( + certificate, + PP_X509CERTIFICATE_PRIVATE_ISSUER_ORGANIZATION_UNIT_NAME, + std::string())); ASSERT_FALSE(FieldIsNull(certificate, PP_X509CERTIFICATE_PRIVATE_SERIAL_NUMBER)); diff --git a/remoting/client/plugin/chromoting_instance.cc b/remoting/client/plugin/chromoting_instance.cc index aff8c10..057c4a1 100644 --- a/remoting/client/plugin/chromoting_instance.cc +++ b/remoting/client/plugin/chromoting_instance.cc @@ -81,7 +81,7 @@ std::string ConnectionStateToString(protocol::ConnectionToHost::State state) { return "FAILED"; } NOTREACHED(); - return ""; + return std::string(); } // TODO(sergeyu): Ideally we should just pass ErrorCode to the webapp @@ -115,7 +115,7 @@ std::string ConnectionErrorToString(protocol::ErrorCode error) { return "NETWORK_FAILURE"; } DLOG(FATAL) << "Unknown error code" << error; - return ""; + return std::string(); } // This flag blocks LOGs to the UI if we're already in the middle of logging diff --git a/remoting/client/plugin/pepper_port_allocator.cc b/remoting/client/plugin/pepper_port_allocator.cc index 62a5822..423102a 100644 --- a/remoting/client/plugin/pepper_port_allocator.cc +++ b/remoting/client/plugin/pepper_port_allocator.cc @@ -82,9 +82,15 @@ PepperPortAllocatorSession::PepperPortAllocatorSession( const std::vector<std::string>& relay_hosts, const std::string& relay_token, const pp::InstanceHandle& instance) - : HttpPortAllocatorSessionBase( - allocator, content_name, component, ice_username_fragment, ice_password, - stun_hosts, relay_hosts, relay_token, ""), + : HttpPortAllocatorSessionBase(allocator, + content_name, + component, + ice_username_fragment, + ice_password, + stun_hosts, + relay_hosts, + relay_token, + std::string()), instance_(instance), stun_address_resolver_(instance_), stun_port_(0), @@ -129,7 +135,7 @@ void PepperPortAllocatorSession::GetPortConfigurations() { // Add an empty configuration synchronously, so a local connection // can be started immediately. ConfigReady(new cricket::PortConfiguration( - talk_base::SocketAddress(), "", "")); + talk_base::SocketAddress(), std::string(), std::string())); ResolveStunServerAddress(); TryCreateRelaySession(); @@ -195,7 +201,8 @@ void PepperPortAllocatorSession::OnStunAddressResolved(int32_t result) { ReceiveSessionResponse(std::string(relay_response_body_.begin(), relay_response_body_.end())); } else { - ConfigReady(new cricket::PortConfiguration(stun_address_, "", "")); + ConfigReady(new cricket::PortConfiguration( + stun_address_, std::string(), std::string())); } } @@ -304,7 +311,9 @@ PepperPortAllocator::PepperPortAllocator( const pp::InstanceHandle& instance, scoped_ptr<talk_base::NetworkManager> network_manager, scoped_ptr<talk_base::PacketSocketFactory> socket_factory) - : HttpPortAllocatorBase(network_manager.get(), socket_factory.get(), ""), + : HttpPortAllocatorBase(network_manager.get(), + socket_factory.get(), + std::string()), instance_(instance), network_manager_(network_manager.Pass()), socket_factory_(socket_factory.Pass()) { diff --git a/remoting/host/desktop_process_unittest.cc b/remoting/host/desktop_process_unittest.cc index b861cf0..bc50988 100644 --- a/remoting/host/desktop_process_unittest.cc +++ b/remoting/host/desktop_process_unittest.cc @@ -172,7 +172,7 @@ void DesktopProcessTest::ConnectNetworkChannel( IPC::PlatformFileForTransit desktop_process) { #if defined(OS_POSIX) - IPC::ChannelHandle channel_handle("", desktop_process); + IPC::ChannelHandle channel_handle(std::string(), desktop_process); #elif defined(OS_WIN) IPC::ChannelHandle channel_handle(desktop_process); #endif // defined(OS_WIN) diff --git a/remoting/host/desktop_session_proxy.cc b/remoting/host/desktop_session_proxy.cc index 05a8188..04add54 100644 --- a/remoting/host/desktop_session_proxy.cc +++ b/remoting/host/desktop_session_proxy.cc @@ -143,7 +143,7 @@ bool DesktopSessionProxy::AttachToDesktop( // On posix: |desktop_pipe| is a valid file descriptor. DCHECK(desktop_pipe.auto_close); - IPC::ChannelHandle desktop_channel_handle("", desktop_pipe); + IPC::ChannelHandle desktop_channel_handle(std::string(), desktop_pipe); #else #error Unsupported platform. diff --git a/remoting/host/heartbeat_sender_unittest.cc b/remoting/host/heartbeat_sender_unittest.cc index 99880b4..ea5eeb8 100644 --- a/remoting/host/heartbeat_sender_unittest.cc +++ b/remoting/host/heartbeat_sender_unittest.cc @@ -176,9 +176,9 @@ TEST_F(HeartbeatSenderTest, DoSendStanzaWithExpectedSequenceId) { .WillOnce(DoAll(SaveArg<0>(&sent_iq2), Return(true))); scoped_ptr<XmlElement> response(new XmlElement(buzz::QN_IQ)); - response->AddAttr(QName("", "type"), "result"); - XmlElement* result = new XmlElement( - QName(kChromotingXmlNamespace, "heartbeat-result")); + response->AddAttr(QName(std::string(), "type"), "result"); + XmlElement* result = + new XmlElement(QName(kChromotingXmlNamespace, "heartbeat-result")); response->AddElement(result); XmlElement* expected_sequence_id = new XmlElement( QName(kChromotingXmlNamespace, "expected-sequence-id")); @@ -200,7 +200,7 @@ TEST_F(HeartbeatSenderTest, DoSendStanzaWithExpectedSequenceId) { // Verify that ProcessResponse parses set-interval result. TEST_F(HeartbeatSenderTest, ProcessResponseSetInterval) { scoped_ptr<XmlElement> response(new XmlElement(buzz::QN_IQ)); - response->AddAttr(QName("", "type"), "result"); + response->AddAttr(QName(std::string(), "type"), "result"); XmlElement* result = new XmlElement( QName(kChromotingXmlNamespace, "heartbeat-result")); @@ -221,9 +221,9 @@ TEST_F(HeartbeatSenderTest, ProcessResponseSetInterval) { // Validate a heartbeat stanza. void HeartbeatSenderTest::ValidateHeartbeatStanza( XmlElement* stanza, const char* expectedSequenceId) { - EXPECT_EQ(stanza->Attr(buzz::QName("", "to")), + EXPECT_EQ(stanza->Attr(buzz::QName(std::string(), "to")), std::string(kTestBotJid)); - EXPECT_EQ(stanza->Attr(buzz::QName("", "type")), "set"); + EXPECT_EQ(stanza->Attr(buzz::QName(std::string(), "type")), "set"); XmlElement* heartbeat_stanza = stanza->FirstNamed(QName(kChromotingXmlNamespace, "heartbeat")); ASSERT_TRUE(heartbeat_stanza != NULL); diff --git a/remoting/host/host_change_notification_listener_unittest.cc b/remoting/host/host_change_notification_listener_unittest.cc index 1f9305e..5ec6ff8 100644 --- a/remoting/host/host_change_notification_listener_unittest.cc +++ b/remoting/host/host_change_notification_listener_unittest.cc @@ -69,9 +69,9 @@ class HostChangeNotificationListenerTest : public testing::Test { std::string hostId, std::string botJid) { scoped_ptr<XmlElement> stanza(new XmlElement(buzz::QN_IQ)); - stanza->AddAttr(QName("", "type"), "set"); - XmlElement* host_changed = new XmlElement( - QName(kChromotingXmlNamespace, "host-changed")); + stanza->AddAttr(QName(std::string(), "type"), "set"); + XmlElement* host_changed = + new XmlElement(QName(kChromotingXmlNamespace, "host-changed")); host_changed->AddAttr(QName(kChromotingXmlNamespace, "operation"), operation); host_changed->AddAttr(QName(kChromotingXmlNamespace, "hostid"), hostId); diff --git a/remoting/host/host_port_allocator.cc b/remoting/host/host_port_allocator.cc index ba53322..cf8a84c 100644 --- a/remoting/host/host_port_allocator.cc +++ b/remoting/host/host_port_allocator.cc @@ -59,11 +59,16 @@ HostPortAllocatorSession::HostPortAllocatorSession( const std::vector<std::string>& relay_hosts, const std::string& relay, const scoped_refptr<net::URLRequestContextGetter>& url_context) - : HttpPortAllocatorSessionBase( - allocator, content_name, component, ice_username_fragment, ice_password, - stun_hosts, relay_hosts, relay, ""), - url_context_(url_context) { -} + : HttpPortAllocatorSessionBase(allocator, + content_name, + component, + ice_username_fragment, + ice_password, + stun_hosts, + relay_hosts, + relay, + std::string()), + url_context_(url_context) {} HostPortAllocatorSession::~HostPortAllocatorSession() { STLDeleteElements(&url_fetchers_); @@ -157,11 +162,12 @@ HostPortAllocator::HostPortAllocator( const scoped_refptr<net::URLRequestContextGetter>& url_context, scoped_ptr<talk_base::NetworkManager> network_manager, scoped_ptr<talk_base::PacketSocketFactory> socket_factory) - : HttpPortAllocatorBase(network_manager.get(), socket_factory.get(), ""), + : HttpPortAllocatorBase(network_manager.get(), + socket_factory.get(), + std::string()), url_context_(url_context), network_manager_(network_manager.Pass()), - socket_factory_(socket_factory.Pass()) { -} + socket_factory_(socket_factory.Pass()) {} HostPortAllocator::~HostPortAllocator() { } diff --git a/remoting/host/log_to_server_unittest.cc b/remoting/host/log_to_server_unittest.cc index 1fb0500..99a51ec 100644 --- a/remoting/host/log_to_server_unittest.cc +++ b/remoting/host/log_to_server_unittest.cc @@ -36,11 +36,12 @@ const char kHostJid[] = "host@domain.com/1234"; bool IsLogEntryForConnection(XmlElement* node, const char* connection_type) { return (node->Name() == QName(kChromotingNamespace, "entry") && - node->Attr(QName("", "event-name")) == "session-state" && - node->Attr(QName("", "session-state")) == "connected" && - node->Attr(QName("", "role")) == "host" && - node->Attr(QName("", "mode")) == "me2me" && - node->Attr(QName("", "connection-type")) == connection_type); + node->Attr(QName(std::string(), "event-name")) == "session-state" && + node->Attr(QName(std::string(), "session-state")) == "connected" && + node->Attr(QName(std::string(), "role")) == "host" && + node->Attr(QName(std::string(), "mode")) == "me2me" && + node->Attr(QName(std::string(), "connection-type")) == + connection_type); } MATCHER_P(IsClientConnected, connection_type, "") { @@ -91,10 +92,10 @@ MATCHER_P2(IsTwoClientsConnected, connection_type1, connection_type2, "") { bool IsLogEntryForDisconnection(XmlElement* node) { return (node->Name() == QName(kChromotingNamespace, "entry") && - node->Attr(QName("", "event-name")) == "session-state" && - node->Attr(QName("", "session-state")) == "closed" && - node->Attr(QName("", "role")) == "host" && - node->Attr(QName("", "mode")) == "me2me"); + node->Attr(QName(std::string(), "event-name")) == "session-state" && + node->Attr(QName(std::string(), "session-state")) == "closed" && + node->Attr(QName(std::string(), "role")) == "host" && + node->Attr(QName(std::string(), "mode")) == "me2me"); } MATCHER(IsClientDisconnected, "") { diff --git a/remoting/host/policy_hack/policy_watcher_unittest.cc b/remoting/host/policy_hack/policy_watcher_unittest.cc index d323718..ff1aa8a 100644 --- a/remoting/host/policy_hack/policy_watcher_unittest.cc +++ b/remoting/host/policy_hack/policy_watcher_unittest.cc @@ -29,7 +29,8 @@ class PolicyWatcherTest : public testing::Test { nat_true_.SetBoolean(PolicyWatcher::kNatPolicyName, true); nat_false_.SetBoolean(PolicyWatcher::kNatPolicyName, false); nat_one_.SetInteger(PolicyWatcher::kNatPolicyName, 1); - domain_empty_.SetString(PolicyWatcher::kHostDomainPolicyName, ""); + domain_empty_.SetString(PolicyWatcher::kHostDomainPolicyName, + std::string()); domain_full_.SetString(PolicyWatcher::kHostDomainPolicyName, kHostDomain); SetDefaults(nat_true_others_default_); nat_true_others_default_.SetBoolean(PolicyWatcher::kNatPolicyName, true); @@ -37,17 +38,19 @@ class PolicyWatcherTest : public testing::Test { nat_false_others_default_.SetBoolean(PolicyWatcher::kNatPolicyName, false); SetDefaults(domain_empty_others_default_); domain_empty_others_default_.SetString(PolicyWatcher::kHostDomainPolicyName, - ""); + std::string()); SetDefaults(domain_full_others_default_); domain_full_others_default_.SetString(PolicyWatcher::kHostDomainPolicyName, kHostDomain); nat_true_domain_empty_.SetBoolean(PolicyWatcher::kNatPolicyName, true); - nat_true_domain_empty_.SetString(PolicyWatcher::kHostDomainPolicyName, ""); + nat_true_domain_empty_.SetString(PolicyWatcher::kHostDomainPolicyName, + std::string()); nat_true_domain_full_.SetBoolean(PolicyWatcher::kNatPolicyName, true); nat_true_domain_full_.SetString(PolicyWatcher::kHostDomainPolicyName, kHostDomain); nat_false_domain_empty_.SetBoolean(PolicyWatcher::kNatPolicyName, false); - nat_false_domain_empty_.SetString(PolicyWatcher::kHostDomainPolicyName, ""); + nat_false_domain_empty_.SetString(PolicyWatcher::kHostDomainPolicyName, + std::string()); nat_false_domain_full_.SetBoolean(PolicyWatcher::kNatPolicyName, false); nat_false_domain_full_.SetString(PolicyWatcher::kHostDomainPolicyName, kHostDomain); @@ -55,9 +58,9 @@ class PolicyWatcherTest : public testing::Test { nat_true_domain_empty_others_default_.SetBoolean( PolicyWatcher::kNatPolicyName, true); nat_true_domain_empty_others_default_.SetString( - PolicyWatcher::kHostDomainPolicyName, ""); - unknown_policies_.SetString("UnknownPolicyOne", ""); - unknown_policies_.SetString("UnknownPolicyTwo", ""); + PolicyWatcher::kHostDomainPolicyName, std::string()); + unknown_policies_.SetString("UnknownPolicyOne", std::string()); + unknown_policies_.SetString("UnknownPolicyTwo", std::string()); const char kOverrideNatTraversalToFalse[] = "{ \"RemoteAccessHostFirewallTraversal\": false }"; @@ -117,13 +120,14 @@ class PolicyWatcherTest : public testing::Test { void SetDefaults(base::DictionaryValue& dict) { dict.SetBoolean(PolicyWatcher::kNatPolicyName, true); dict.SetBoolean(PolicyWatcher::kHostRequireTwoFactorPolicyName, false); - dict.SetString(PolicyWatcher::kHostDomainPolicyName, ""); + dict.SetString(PolicyWatcher::kHostDomainPolicyName, std::string()); dict.SetBoolean(PolicyWatcher::kHostMatchUsernamePolicyName, false); dict.SetString(PolicyWatcher::kHostTalkGadgetPrefixPolicyName, kDefaultHostTalkGadgetPrefix); dict.SetBoolean(PolicyWatcher::kHostRequireCurtainPolicyName, false); - dict.SetString(PolicyWatcher::kHostTokenUrlPolicyName, ""); - dict.SetString(PolicyWatcher::kHostTokenValidationUrlPolicyName, ""); + dict.SetString(PolicyWatcher::kHostTokenUrlPolicyName, std::string()); + dict.SetString(PolicyWatcher::kHostTokenValidationUrlPolicyName, + std::string()); #if !defined(NDEBUG) dict.SetString(PolicyWatcher::kHostDebugOverridePoliciesName, ""); #endif diff --git a/remoting/host/register_support_host_request_unittest.cc b/remoting/host/register_support_host_request_unittest.cc index cd5da6e..6080304 100644 --- a/remoting/host/register_support_host_request_unittest.cc +++ b/remoting/host/register_support_host_request_unittest.cc @@ -99,9 +99,9 @@ TEST_F(RegisterSupportHostRequestTest, Send) { scoped_ptr<XmlElement> stanza(sent_iq); ASSERT_TRUE(stanza != NULL); - EXPECT_EQ(stanza->Attr(buzz::QName("", "to")), + EXPECT_EQ(stanza->Attr(buzz::QName(std::string(), "to")), std::string(kTestBotJid)); - EXPECT_EQ(stanza->Attr(buzz::QName("", "type")), "set"); + EXPECT_EQ(stanza->Attr(buzz::QName(std::string(), "type")), "set"); EXPECT_EQ(QName(kChromotingXmlNamespace, "register-support-host"), stanza->FirstElement()->Name()); @@ -131,9 +131,9 @@ TEST_F(RegisterSupportHostRequestTest, Send) { base::TimeDelta::FromSeconds(300))); scoped_ptr<XmlElement> response(new XmlElement(buzz::QN_IQ)); - response->AddAttr(QName("", "from"), kTestBotJid); - response->AddAttr(QName("", "type"), "result"); - response->AddAttr(QName("", "id"), kStanzaId); + response->AddAttr(QName(std::string(), "from"), kTestBotJid); + response->AddAttr(QName(std::string(), "type"), "result"); + response->AddAttr(QName(std::string(), "id"), kStanzaId); XmlElement* result = new XmlElement( QName(kChromotingXmlNamespace, "register-support-host-result")); diff --git a/remoting/host/server_log_entry.cc b/remoting/host/server_log_entry.cc index cf6f861..f18b2378 100644 --- a/remoting/host/server_log_entry.cc +++ b/remoting/host/server_log_entry.cc @@ -140,7 +140,7 @@ scoped_ptr<XmlElement> ServerLogEntry::ToStanza() const { kChromotingXmlNamespace, kLogEntry))); ValuesMap::const_iterator iter; for (iter = values_map_.begin(); iter != values_map_.end(); ++iter) { - stanza->AddAttr(QName("", iter->first), iter->second); + stanza->AddAttr(QName(std::string(), iter->first), iter->second); } return stanza.Pass(); } diff --git a/remoting/host/service_client.cc b/remoting/host/service_client.cc index 6db1c6e..d487a97 100644 --- a/remoting/host/service_client.cc +++ b/remoting/host/service_client.cc @@ -78,7 +78,10 @@ void ServiceClient::Core::RegisterHost( post_body.SetString("data.publicKey", public_key); std::string post_body_str; base::JSONWriter::Write(&post_body, &post_body_str); - MakeGaiaRequest(net::URLFetcher::POST, "", post_body_str, oauth_access_token, + MakeGaiaRequest(net::URLFetcher::POST, + std::string(), + post_body_str, + oauth_access_token, delegate); } @@ -88,8 +91,11 @@ void ServiceClient::Core::UnregisterHost( Delegate* delegate) { DCHECK(pending_request_type_ == PENDING_REQUEST_NONE); pending_request_type_ = PENDING_REQUEST_UNREGISTER_HOST; - MakeGaiaRequest(net::URLFetcher::DELETE_REQUEST, host_id, "", - oauth_access_token, delegate); + MakeGaiaRequest(net::URLFetcher::DELETE_REQUEST, + host_id, + std::string(), + oauth_access_token, + delegate); } void ServiceClient::Core::MakeGaiaRequest( diff --git a/remoting/host/setup/daemon_controller_linux.cc b/remoting/host/setup/daemon_controller_linux.cc index f5076d4..216572f 100644 --- a/remoting/host/setup/daemon_controller_linux.cc +++ b/remoting/host/setup/daemon_controller_linux.cc @@ -318,7 +318,7 @@ void DaemonControllerLinux::DoGetVersion( const GetVersionCallback& done_callback) { base::FilePath script_path; if (!GetScriptPath(&script_path)) { - done_callback.Run(""); + done_callback.Run(std::string()); return; } CommandLine command_line(script_path); @@ -331,14 +331,14 @@ void DaemonControllerLinux::DoGetVersion( if (!result || exit_code != 0) { LOG(ERROR) << "Failed to run \"" << command_line.GetCommandLineString() << "\". Exit code: " << exit_code; - done_callback.Run(""); + done_callback.Run(std::string()); return; } TrimWhitespaceASCII(version, TRIM_ALL, &version); if (!ContainsOnlyChars(version, "0123456789.")) { LOG(ERROR) << "Received invalid host version number: " << version; - done_callback.Run(""); + done_callback.Run(std::string()); return; } diff --git a/remoting/host/setup/oauth_helper.cc b/remoting/host/setup/oauth_helper.cc index 6f110f6..6ea46d5 100644 --- a/remoting/host/setup/oauth_helper.cc +++ b/remoting/host/setup/oauth_helper.cc @@ -14,7 +14,7 @@ namespace { std::string GetComponent(const std::string& url, const url_parse::Component component) { if (component.len < 0) { - return ""; + return std::string(); } return url.substr(component.begin, component.len); } @@ -60,11 +60,11 @@ std::string GetOauthCodeInUrl(const std::string& url, &redirect_url_parsed); if (GetComponent(url, url_parsed.scheme) != GetComponent(redirect_url, redirect_url_parsed.scheme)) { - return ""; + return std::string(); } if (GetComponent(url, url_parsed.host) != GetComponent(redirect_url, redirect_url_parsed.host)) { - return ""; + return std::string(); } url_parse::Component query = url_parsed.query; url_parse::Component key; @@ -74,7 +74,7 @@ std::string GetOauthCodeInUrl(const std::string& url, return GetComponent(url, value); } } - return ""; + return std::string(); } } // namespace remoting diff --git a/remoting/host/setup/start_host.cc b/remoting/host/setup/start_host.cc index 4d8ba75..256fb3c 100644 --- a/remoting/host/setup/start_host.cc +++ b/remoting/host/setup/start_host.cc @@ -53,7 +53,7 @@ std::string ReadString(bool no_echo) { SetEcho(true); } if (!result) - return ""; + return std::string(); size_t newline_index = str.find('\n'); if (newline_index != std::string::npos) str[newline_index] = '\0'; diff --git a/remoting/jingle_glue/iq_sender_unittest.cc b/remoting/jingle_glue/iq_sender_unittest.cc index b09f114..2876735 100644 --- a/remoting/jingle_glue/iq_sender_unittest.cc +++ b/remoting/jingle_glue/iq_sender_unittest.cc @@ -91,9 +91,9 @@ TEST_F(IqSenderTest, SendIq) { }); scoped_ptr<XmlElement> response(new XmlElement(buzz::QN_IQ)); - response->AddAttr(QName("", "type"), "result"); - response->AddAttr(QName("", "id"), kStanzaId); - response->AddAttr(QName("", "from"), kTo); + response->AddAttr(QName(std::string(), "type"), "result"); + response->AddAttr(QName(std::string(), "id"), kStanzaId); + response->AddAttr(QName(std::string(), "from"), kTo); XmlElement* result = new XmlElement( QName("test:namespace", "response-body")); @@ -123,9 +123,9 @@ TEST_F(IqSenderTest, InvalidFrom) { }); scoped_ptr<XmlElement> response(new XmlElement(buzz::QN_IQ)); - response->AddAttr(QName("", "type"), "result"); - response->AddAttr(QName("", "id"), kStanzaId); - response->AddAttr(QName("", "from"), "different_user@domain.com"); + response->AddAttr(QName(std::string(), "type"), "result"); + response->AddAttr(QName(std::string(), "id"), kStanzaId); + response->AddAttr(QName(std::string(), "from"), "different_user@domain.com"); XmlElement* result = new XmlElement( QName("test:namespace", "response-body")); @@ -143,9 +143,9 @@ TEST_F(IqSenderTest, IdMatchingHack) { }); scoped_ptr<XmlElement> response(new XmlElement(buzz::QN_IQ)); - response->AddAttr(QName("", "type"), "result"); - response->AddAttr(QName("", "id"), "DIFFERENT_ID"); - response->AddAttr(QName("", "from"), kTo); + response->AddAttr(QName(std::string(), "type"), "result"); + response->AddAttr(QName(std::string(), "id"), "DIFFERENT_ID"); + response->AddAttr(QName(std::string(), "from"), kTo); XmlElement* result = new XmlElement( QName("test:namespace", "response-body")); diff --git a/remoting/jingle_glue/xmpp_signal_strategy.cc b/remoting/jingle_glue/xmpp_signal_strategy.cc index 51bbade..88fc9f3 100644 --- a/remoting/jingle_glue/xmpp_signal_strategy.cc +++ b/remoting/jingle_glue/xmpp_signal_strategy.cc @@ -91,9 +91,10 @@ void XmppSignalStrategy::Connect() { task_runner_.reset(new jingle_glue::TaskPump()); xmpp_client_ = new buzz::XmppClient(task_runner_.get()); - xmpp_client_->Connect(settings, "", socket, CreatePreXmppAuth(settings)); - xmpp_client_->SignalStateChange.connect( - this, &XmppSignalStrategy::OnConnectionStateChanged); + xmpp_client_->Connect( + settings, std::string(), socket, CreatePreXmppAuth(settings)); + xmpp_client_->SignalStateChange + .connect(this, &XmppSignalStrategy::OnConnectionStateChanged); xmpp_client_->engine()->AddStanzaHandler(this, buzz::XmppEngine::HL_TYPE); xmpp_client_->Start(); @@ -156,7 +157,7 @@ std::string XmppSignalStrategy::GetNextId() { if (!xmpp_client_) { // If the connection has been terminated then it doesn't matter // what Id we return. - return ""; + return std::string(); } return xmpp_client_->NextId(); } diff --git a/remoting/protocol/jingle_messages.cc b/remoting/protocol/jingle_messages.cc index 7d82443..e2408e0 100644 --- a/remoting/protocol/jingle_messages.cc +++ b/remoting/protocol/jingle_messages.cc @@ -124,10 +124,9 @@ JingleMessage::NamedCandidate::NamedCandidate( // static bool JingleMessage::IsJingleMessage(const buzz::XmlElement* stanza) { - return - stanza->Name() == QName(kJabberNamespace, "iq") && - stanza->Attr(QName("", "type")) == "set" && - stanza->FirstNamed(QName(kJingleNamespace, "jingle")) != NULL; + return stanza->Name() == QName(kJabberNamespace, "iq") && + stanza->Attr(QName(std::string(), "type")) == "set" && + stanza->FirstNamed(QName(kJingleNamespace, "jingle")) != NULL; } // static @@ -373,7 +372,7 @@ scoped_ptr<buzz::XmlElement> JingleMessageReply::ToXml( std::string type; std::string error_text; - QName name(""); + QName name; switch (error_type) { case BAD_REQUEST: type = "modify"; diff --git a/remoting/protocol/jingle_session.cc b/remoting/protocol/jingle_session.cc index c6a4f22..72985c2 100644 --- a/remoting/protocol/jingle_session.cc +++ b/remoting/protocol/jingle_session.cc @@ -323,7 +323,8 @@ void JingleSession::OnMessageResponse( CloseInternal(SIGNALING_TIMEOUT); return; } else { - const std::string& type = response->Attr(buzz::QName("", "type")); + const std::string& type = + response->Attr(buzz::QName(std::string(), "type")); if (type != "result") { LOG(ERROR) << "Received error in response to " << type_str << " message: \"" << response->Str() @@ -383,7 +384,7 @@ void JingleSession::OnTransportInfoResponse(IqRequest* request, return; } - const std::string& type = response->Attr(buzz::QName("", "type")); + const std::string& type = response->Attr(buzz::QName(std::string(), "type")); if (type != "result") { LOG(ERROR) << "Received error in response to transport-info message: \"" << response->Str() << "\". Terminating the session."; diff --git a/remoting/protocol/jingle_session_unittest.cc b/remoting/protocol/jingle_session_unittest.cc index 433356b..76aee23 100644 --- a/remoting/protocol/jingle_session_unittest.cc +++ b/remoting/protocol/jingle_session_unittest.cc @@ -323,7 +323,7 @@ TEST_F(JingleSessionTest, Connect) { initiate_xml->FirstNamed(buzz::QName(kJingleNamespace, "jingle")); ASSERT_TRUE(jingle_element); ASSERT_EQ(kClientJid, - jingle_element->Attr(buzz::QName("", "initiator"))); + jingle_element->Attr(buzz::QName(std::string(), "initiator"))); } // Verify that we can connect two endpoints with multi-step authentication. diff --git a/remoting/protocol/libjingle_transport_factory.cc b/remoting/protocol/libjingle_transport_factory.cc index e27b619..7a09d09 100644 --- a/remoting/protocol/libjingle_transport_factory.cc +++ b/remoting/protocol/libjingle_transport_factory.cc @@ -139,7 +139,7 @@ void LibjingleStreamTransport::Connect( // Create P2PTransportChannel, attach signal handlers and connect it. // TODO(sergeyu): Specify correct component ID for the channel. channel_.reset(new cricket::P2PTransportChannel( - "", 0, NULL, port_allocator_)); + std::string(), 0, NULL, port_allocator_)); channel_->SetIceCredentials(ice_username_fragment_, ice_password_); channel_->SignalRequestSignaling.connect( this, &LibjingleStreamTransport::OnRequestSignaling); diff --git a/remoting/protocol/third_party_authenticator_unittest.cc b/remoting/protocol/third_party_authenticator_unittest.cc index b787a62..0298877 100644 --- a/remoting/protocol/third_party_authenticator_unittest.cc +++ b/remoting/protocol/third_party_authenticator_unittest.cc @@ -153,7 +153,8 @@ TEST_F(ThirdPartyAuthenticatorTest, ClientNoSecret) { ASSERT_NO_FATAL_FAILURE(InitAuthenticators()); ASSERT_NO_FATAL_FAILURE(RunHostInitiatedAuthExchange()); ASSERT_EQ(Authenticator::PROCESSING_MESSAGE, client_->state()); - ASSERT_NO_FATAL_FAILURE(token_fetcher_->OnTokenFetched(kToken, "")); + ASSERT_NO_FATAL_FAILURE( + token_fetcher_->OnTokenFetched(kToken, std::string())); // The end result is that the client rejected the connection, since it // couldn't fetch the secret. @@ -167,7 +168,7 @@ TEST_F(ThirdPartyAuthenticatorTest, InvalidToken) { ASSERT_NO_FATAL_FAILURE(token_fetcher_->OnTokenFetched( kToken, kSharedSecret)); ASSERT_EQ(Authenticator::PROCESSING_MESSAGE, host_->state()); - ASSERT_NO_FATAL_FAILURE(token_validator_->OnTokenValidated("")); + ASSERT_NO_FATAL_FAILURE(token_validator_->OnTokenValidated(std::string())); // The end result is that the host rejected the token. ASSERT_EQ(Authenticator::REJECTED, host_->state()); @@ -177,7 +178,8 @@ TEST_F(ThirdPartyAuthenticatorTest, CannotFetchToken) { ASSERT_NO_FATAL_FAILURE(InitAuthenticators()); ASSERT_NO_FATAL_FAILURE(RunHostInitiatedAuthExchange()); ASSERT_EQ(Authenticator::PROCESSING_MESSAGE, client_->state()); - ASSERT_NO_FATAL_FAILURE(token_fetcher_->OnTokenFetched("", "")); + ASSERT_NO_FATAL_FAILURE( + token_fetcher_->OnTokenFetched(std::string(), std::string())); // The end result is that the client rejected the connection, since it // couldn't fetch the token. diff --git a/remoting/protocol/transport.cc b/remoting/protocol/transport.cc index 4ccbcde..13ed29f 100644 --- a/remoting/protocol/transport.cc +++ b/remoting/protocol/transport.cc @@ -20,7 +20,7 @@ std::string TransportRoute::GetTypeString(RouteType type) { return "relay"; } NOTREACHED(); - return ""; + return std::string(); } TransportRoute::TransportRoute() : type(DIRECT) { diff --git a/sandbox/linux/tests/unit_tests.cc b/sandbox/linux/tests/unit_tests.cc index 63fbb2b..5d6cf30 100644 --- a/sandbox/linux/tests/unit_tests.cc +++ b/sandbox/linux/tests/unit_tests.cc @@ -16,7 +16,7 @@ namespace { std::string TestFailedMessage(const std::string& msg) { - return msg.empty() ? "" : "Actual test failure: " + msg; + return msg.empty() ? std::string() : "Actual test failure: " + msg; } int GetSubProcessTimeoutTimeInSeconds() { diff --git a/sql/statement.cc b/sql/statement.cc index d92be01..fe0accb 100644 --- a/sql/statement.cc +++ b/sql/statement.cc @@ -210,7 +210,7 @@ double Statement::ColumnDouble(int col) const { std::string Statement::ColumnString(int col) const { if (!CheckValid()) - return ""; + return std::string(); const char* str = reinterpret_cast<const char*>( sqlite3_column_text(ref_->stmt(), col)); diff --git a/sync/api/sync_data.cc b/sync/api/sync_data.cc index b9e2ca9..e0b6f1a 100644 --- a/sync/api/sync_data.cc +++ b/sync/api/sync_data.cc @@ -59,7 +59,7 @@ SyncData SyncData::CreateLocalDelete( ModelType datatype) { sync_pb::EntitySpecifics specifics; AddDefaultFieldValue(datatype, &specifics); - return CreateLocalData(sync_tag, "", specifics); + return CreateLocalData(sync_tag, std::string(), specifics); } // Static. diff --git a/sync/engine/syncer_unittest.cc b/sync/engine/syncer_unittest.cc index 5ee9e47..2dcc4b7 100644 --- a/sync/engine/syncer_unittest.cc +++ b/sync/engine/syncer_unittest.cc @@ -1641,15 +1641,15 @@ TEST_F(SyncerTest, TestCommitListOrderingAndNewParentAndChild) { TEST_F(SyncerTest, UpdateWithZeroLengthName) { // One illegal update - mock_server_->AddUpdateDirectory(1, 0, "", 1, 10, - foreign_cache_guid(), "-1"); + mock_server_->AddUpdateDirectory( + 1, 0, std::string(), 1, 10, foreign_cache_guid(), "-1"); // And one legal one that we're going to delete. mock_server_->AddUpdateDirectory(2, 0, "FOO", 1, 10, foreign_cache_guid(), "-2"); SyncShareNudge(); // Delete the legal one. The new update has a null name. - mock_server_->AddUpdateDirectory(2, 0, "", 2, 20, - foreign_cache_guid(), "-2"); + mock_server_->AddUpdateDirectory( + 2, 0, std::string(), 2, 20, foreign_cache_guid(), "-2"); mock_server_->SetLastUpdateDeleted(); SyncShareNudge(); } @@ -4044,9 +4044,11 @@ TEST_F(SyncerTest, UniqueServerTagUpdates) { } // Now download some tagged items as updates. - mock_server_->AddUpdateDirectory(1, 0, "update1", 1, 10, "", ""); + mock_server_->AddUpdateDirectory( + 1, 0, "update1", 1, 10, std::string(), std::string()); mock_server_->SetLastUpdateServerTag("alpha"); - mock_server_->AddUpdateDirectory(2, 0, "update2", 2, 20, "", ""); + mock_server_->AddUpdateDirectory( + 2, 0, "update2", 2, 20, std::string(), std::string()); mock_server_->SetLastUpdateServerTag("bob"); SyncShareNudge(); @@ -4252,7 +4254,7 @@ TEST_F(SyncerTest, GetKeyEmpty) { EXPECT_TRUE(directory()->GetNigoriHandler()->NeedKeystoreKey(&rtrans)); } - mock_server_->SetKeystoreKey(""); + mock_server_->SetKeystoreKey(std::string()); SyncShareConfigure(); EXPECT_NE(session_->status_controller().last_get_key_result(), SYNCER_OK); diff --git a/sync/engine/syncer_util.cc b/sync/engine/syncer_util.cc index c571b10..d1bde98 100644 --- a/sync/engine/syncer_util.cc +++ b/sync/engine/syncer_util.cc @@ -633,7 +633,7 @@ VerifyResult VerifyUndelete(syncable::WriteTransaction* trans, DCHECK(target->Get(UNIQUE_CLIENT_TAG).empty()) << "Doing move-aside undeletion on client-tagged item."; target->Put(ID, trans->directory()->NextId()); - target->Put(UNIQUE_CLIENT_TAG, ""); + target->Put(UNIQUE_CLIENT_TAG, std::string()); target->Put(BASE_VERSION, CHANGES_VERSION); target->Put(SERVER_VERSION, 0); return VERIFY_SUCCESS; diff --git a/sync/internal_api/public/base/model_type_invalidation_map_unittest.cc b/sync/internal_api/public/base/model_type_invalidation_map_unittest.cc index f051479..772ee7e 100644 --- a/sync/internal_api/public/base/model_type_invalidation_map_unittest.cc +++ b/sync/internal_api/public/base/model_type_invalidation_map_unittest.cc @@ -35,7 +35,7 @@ TEST_F(ModelTypeInvalidationMapTest, TypeInvalidationMapToValue) { scoped_ptr<DictionaryValue> value(ModelTypeInvalidationMapToValue(states)); EXPECT_EQ(2u, value->size()); ExpectDictStringValue(states[BOOKMARKS].payload, *value, "Bookmarks"); - ExpectDictStringValue("", *value, "Apps"); + ExpectDictStringValue(std::string(), *value, "Apps"); EXPECT_FALSE(value->HasKey("Preferences")); } diff --git a/sync/internal_api/public/base/ordinal_unittest.cc b/sync/internal_api/public/base/ordinal_unittest.cc index 20a6d19..8c77d6d 100644 --- a/sync/internal_api/public/base/ordinal_unittest.cc +++ b/sync/internal_api/public/base/ordinal_unittest.cc @@ -87,7 +87,7 @@ COMPILE_ASSERT(LargeOrdinal::kRadix == 256, // IsValid() should return false for all of them. TEST(Ordinal, Invalid) { // Length criterion. - EXPECT_FALSE(TestOrdinal("").IsValid()); + EXPECT_FALSE(TestOrdinal(std::string()).IsValid()); EXPECT_FALSE(LongOrdinal("0001").IsValid()); const char kBeforeZero[] = { '0' - 1, '\0' }; diff --git a/sync/internal_api/public/base/unique_position.cc b/sync/internal_api/public/base/unique_position.cc index a47d42b..b6c18ef 100644 --- a/sync/internal_api/public/base/unique_position.cc +++ b/sync/internal_api/public/base/unique_position.cc @@ -61,7 +61,7 @@ UniquePosition UniquePosition::FromInt64( UniquePosition UniquePosition::InitialPosition( const std::string& suffix) { DCHECK(IsValidSuffix(suffix)); - return UniquePosition("", suffix); + return UniquePosition(std::string(), suffix); } // static. @@ -175,7 +175,7 @@ std::string UniquePosition::FindSmallerWithSuffix( if (suffix_zeroes > ref_zeroes) { // Implies suffix < ref. - return ""; + return std::string(); } if (suffix.substr(suffix_zeroes) < reference.substr(ref_zeroes)) { @@ -210,7 +210,7 @@ std::string UniquePosition::FindGreaterWithSuffix( if (suffix_FFs > ref_FFs) { // Implies suffix > reference. - return ""; + return std::string(); } if (suffix.substr(suffix_FFs) > reference.substr(ref_FFs)) { @@ -244,7 +244,7 @@ std::string UniquePosition::FindBetweenWithSuffix( // Sometimes our suffix puts us where we want to be. if (before < suffix && suffix < after) { - return ""; + return std::string(); } size_t i = 0; diff --git a/sync/internal_api/sync_encryption_handler_impl.cc b/sync/internal_api/sync_encryption_handler_impl.cc index 1a645bf..655feb2 100644 --- a/sync/internal_api/sync_encryption_handler_impl.cc +++ b/sync/internal_api/sync_encryption_handler_impl.cc @@ -136,7 +136,7 @@ std::string PackKeystoreBootstrapToken( const std::string& current_keystore_key, Encryptor* encryptor) { if (current_keystore_key.empty()) - return ""; + return std::string(); base::ListValue keystore_key_values; for (size_t i = 0; i < old_keystore_keys.size(); ++i) @@ -1112,7 +1112,7 @@ void SyncEncryptionHandlerImpl::SetCustomPassphrase( if (passphrase_type_ != KEYSTORE_PASSPHRASE) { DVLOG(1) << "Failing to set a custom passphrase because one has already " << "been set."; - FinishSetPassphrase(false, "", trans, nigori_node); + FinishSetPassphrase(false, std::string(), trans, nigori_node); return; } @@ -1125,7 +1125,7 @@ void SyncEncryptionHandlerImpl::SetCustomPassphrase( // if statement above. For the sake of safety though, we check for it in // case a client is misbehaving. LOG(ERROR) << "Failing to set custom passphrase because of pending keys."; - FinishSetPassphrase(false, "", trans, nigori_node); + FinishSetPassphrase(false, std::string(), trans, nigori_node); return; } diff --git a/sync/internal_api/sync_encryption_handler_impl_unittest.cc b/sync/internal_api/sync_encryption_handler_impl_unittest.cc index 8abbd7e..919a65d 100644 --- a/sync/internal_api/sync_encryption_handler_impl_unittest.cc +++ b/sync/internal_api/sync_encryption_handler_impl_unittest.cc @@ -91,7 +91,8 @@ class SyncEncryptionHandlerImplTest : public ::testing::Test { encryption_handler_.reset( new SyncEncryptionHandlerImpl(user_share(), &encryptor_, - "", "" /* bootstrap tokens */)); + std::string(), + std::string() /* bootstrap tokens */)); encryption_handler_->AddObserver(&observer_); } @@ -347,7 +348,8 @@ TEST_F(SyncEncryptionHandlerImplTest, NigoriEncryptionTypes) { StrictMock<SyncEncryptionHandlerObserverMock> observer2; SyncEncryptionHandlerImpl handler2(user_share(), &encryptor_, - "", "" /* bootstrap tokens */); + std::string(), + std::string() /* bootstrap tokens */); handler2.AddObserver(&observer2); // Just set the sensitive types (shouldn't trigger any notifications). @@ -611,9 +613,8 @@ TEST_F(SyncEncryptionHandlerImplTest, SetKeystoreMigratesAndUpdatesBootstrap) { WriteTransaction trans(FROM_HERE, user_share()); EXPECT_FALSE(GetCryptographer()->is_initialized()); EXPECT_TRUE(encryption_handler()->NeedKeystoreKey(trans.GetWrappedTrans())); - EXPECT_FALSE( - encryption_handler()->SetKeystoreKeys(BuildEncryptionKeyProto(""), - trans.GetWrappedTrans())); + EXPECT_FALSE(encryption_handler()->SetKeystoreKeys( + BuildEncryptionKeyProto(std::string()), trans.GetWrappedTrans())); EXPECT_TRUE(encryption_handler()->NeedKeystoreKey(trans.GetWrappedTrans())); } Mock::VerifyAndClearExpectations(observer()); @@ -679,7 +680,7 @@ TEST_F(SyncEncryptionHandlerImplTest, SetKeystoreMigratesAndUpdatesBootstrap) { // token. SyncEncryptionHandlerImpl handler2(user_share(), &encryptor_, - "", // Cryptographer bootstrap. + std::string(), // Cryptographer bootstrap. keystore_bootstrap); { diff --git a/sync/internal_api/sync_manager_impl.cc b/sync/internal_api/sync_manager_impl.cc index 97d03ba..7413b71 100644 --- a/sync/internal_api/sync_manager_impl.cc +++ b/sync/internal_api/sync_manager_impl.cc @@ -1289,7 +1289,7 @@ void SyncManagerImpl::OnIncomingInvalidation( void SyncManagerImpl::RefreshTypes(ModelTypeSet types) { DCHECK(thread_checker_.CalledOnValidThread()); const ModelTypeInvalidationMap& type_invalidation_map = - ModelTypeSetToInvalidationMap(types, ""); + ModelTypeSetToInvalidationMap(types, std::string()); if (type_invalidation_map.empty()) { LOG(WARNING) << "Sync received refresh request with no types specified."; } else { diff --git a/sync/internal_api/sync_manager_impl_unittest.cc b/sync/internal_api/sync_manager_impl_unittest.cc index 9a6ddee..7f96f49 100644 --- a/sync/internal_api/sync_manager_impl_unittest.cc +++ b/sync/internal_api/sync_manager_impl_unittest.cc @@ -723,7 +723,7 @@ class TestHttpPostProviderInterface : public HttpPostProviderInterface { } virtual const std::string GetResponseHeaderValue( const std::string& name) const OVERRIDE { - return ""; + return std::string(); } virtual void Abort() OVERRIDE {} }; @@ -820,20 +820,25 @@ class SyncManagerTest : public testing::Test, GetModelSafeRoutingInfo(&routing_info); // Takes ownership of |fake_invalidator_|. - sync_manager_.Init(temp_dir_.path(), - WeakHandle<JsEventHandler>(), - "bogus", 0, false, - scoped_ptr<HttpPostProviderFactory>( - new TestHttpPostProviderFactory()), - workers, &extensions_activity_monitor_, this, - credentials, - scoped_ptr<Invalidator>(fake_invalidator_), - "fake_invalidator_client_id", - "", "", // bootstrap tokens - scoped_ptr<InternalComponentsFactory>(GetFactory()), - &encryptor_, - &handler_, - NULL); + sync_manager_.Init( + temp_dir_.path(), + WeakHandle<JsEventHandler>(), + "bogus", + 0, + false, + scoped_ptr<HttpPostProviderFactory>(new TestHttpPostProviderFactory()), + workers, + &extensions_activity_monitor_, + this, + credentials, + scoped_ptr<Invalidator>(fake_invalidator_), + "fake_invalidator_client_id", + std::string(), + std::string(), // bootstrap tokens + scoped_ptr<InternalComponentsFactory>(GetFactory()), + &encryptor_, + &handler_, + NULL); sync_manager_.GetEncryptionHandler()->AddObserver(&encryption_observer_); @@ -1181,9 +1186,9 @@ class SyncManagerGetNodesByIdTest : public SyncManagerTest { base::ListValue args; base::ListValue* ids = new base::ListValue(); args.Append(ids); - ids->Append(new base::StringValue("")); - SendJsMessage(message_name, - JsArgList(&args), reply_handler.AsWeakHandle()); + ids->Append(new base::StringValue(std::string())); + SendJsMessage( + message_name, JsArgList(&args), reply_handler.AsWeakHandle()); } { @@ -1273,9 +1278,9 @@ TEST_F(SyncManagerTest, GetChildNodeIdsFailure) { { base::ListValue args; - args.Append(new base::StringValue("")); - SendJsMessage("getChildNodeIds", - JsArgList(&args), reply_handler.AsWeakHandle()); + args.Append(new base::StringValue(std::string())); + SendJsMessage( + "getChildNodeIds", JsArgList(&args), reply_handler.AsWeakHandle()); } { diff --git a/sync/internal_api/syncapi_server_connection_manager_unittest.cc b/sync/internal_api/syncapi_server_connection_manager_unittest.cc index f90c5e8..a0fe420 100644 --- a/sync/internal_api/syncapi_server_connection_manager_unittest.cc +++ b/sync/internal_api/syncapi_server_connection_manager_unittest.cc @@ -45,7 +45,7 @@ class BlockingHttpPost : public HttpPostProviderInterface { } virtual const std::string GetResponseHeaderValue( const std::string& name) const OVERRIDE { - return ""; + return std::string(); } virtual void Abort() OVERRIDE { wait_for_abort_.Signal(); diff --git a/sync/notifier/p2p_invalidator.cc b/sync/notifier/p2p_invalidator.cc index dd9a34d..7825757 100644 --- a/sync/notifier/p2p_invalidator.cc +++ b/sync/notifier/p2p_invalidator.cc @@ -40,7 +40,7 @@ std::string P2PNotificationTargetToString(P2PNotificationTarget target) { return kNotifyAll; default: NOTREACHED(); - return ""; + return std::string(); } } @@ -171,8 +171,9 @@ void P2PInvalidator::UpdateRegisteredIds(InvalidationHandler* handler, ObjectIdLessThan()); registrar_.UpdateRegisteredIds(handler, ids); const P2PNotificationData notification_data( - invalidator_client_id_, NOTIFY_SELF, - ObjectIdSetToInvalidationMap(new_ids, "")); + invalidator_client_id_, + NOTIFY_SELF, + ObjectIdSetToInvalidationMap(new_ids, std::string())); SendNotificationData(notification_data); } @@ -224,8 +225,10 @@ void P2PInvalidator::OnNotificationsEnabled() { registrar_.UpdateInvalidatorState(INVALIDATIONS_ENABLED); if (just_turned_on) { const P2PNotificationData notification_data( - invalidator_client_id_, NOTIFY_SELF, - ObjectIdSetToInvalidationMap(registrar_.GetAllRegisteredIds(), "")); + invalidator_client_id_, + NOTIFY_SELF, + ObjectIdSetToInvalidationMap(registrar_.GetAllRegisteredIds(), + std::string())); SendNotificationData(notification_data); } } @@ -256,10 +259,11 @@ void P2PInvalidator::OnIncomingNotification( if (!notification_data.ResetFromString(notification.data)) { LOG(WARNING) << "Could not parse notification data from " << notification.data; - notification_data = - P2PNotificationData( - invalidator_client_id_, NOTIFY_ALL, - ObjectIdSetToInvalidationMap(registrar_.GetAllRegisteredIds(), "")); + notification_data = P2PNotificationData( + invalidator_client_id_, + NOTIFY_ALL, + ObjectIdSetToInvalidationMap(registrar_.GetAllRegisteredIds(), + std::string())); } if (!notification_data.IsTargeted(invalidator_client_id_)) { DVLOG(1) << "Not a target of the notification -- " diff --git a/sync/notifier/p2p_invalidator_unittest.cc b/sync/notifier/p2p_invalidator_unittest.cc index 1b7aad4..6acc3d1 100644 --- a/sync/notifier/p2p_invalidator_unittest.cc +++ b/sync/notifier/p2p_invalidator_unittest.cc @@ -69,7 +69,7 @@ class P2PInvalidatorTestDelegate { void TriggerOnIncomingInvalidation( const ObjectIdInvalidationMap& invalidation_map) { const P2PNotificationData notification_data( - "", NOTIFY_ALL, invalidation_map); + std::string(), NOTIFY_ALL, invalidation_map); notifier::Notification notification; notification.channel = kSyncP2PNotificationChannel; notification.data = notification_data.ToString(); @@ -160,7 +160,7 @@ TEST_F(P2PInvalidatorTest, P2PNotificationDataIsTargeted) { // default-constructed P2PNotificationData. TEST_F(P2PInvalidatorTest, P2PNotificationDataDefault) { const P2PNotificationData notification_data; - EXPECT_TRUE(notification_data.IsTargeted("")); + EXPECT_TRUE(notification_data.IsTargeted(std::string())); EXPECT_FALSE(notification_data.IsTargeted("other1")); EXPECT_FALSE(notification_data.IsTargeted("other2")); EXPECT_TRUE(notification_data.GetIdInvalidationMap().empty()); @@ -179,7 +179,8 @@ TEST_F(P2PInvalidatorTest, P2PNotificationDataDefault) { TEST_F(P2PInvalidatorTest, P2PNotificationDataNonDefault) { const ObjectIdInvalidationMap& invalidation_map = ObjectIdSetToInvalidationMap( - ModelTypeSetToObjectIdSet(ModelTypeSet(BOOKMARKS, THEMES)), ""); + ModelTypeSetToObjectIdSet(ModelTypeSet(BOOKMARKS, THEMES)), + std::string()); const P2PNotificationData notification_data( "sender", NOTIFY_ALL, invalidation_map); EXPECT_TRUE(notification_data.IsTargeted("sender")); @@ -247,7 +248,8 @@ TEST_F(P2PInvalidatorTest, NotificationsBasic) { { const ObjectIdInvalidationMap& invalidation_map = ObjectIdSetToInvalidationMap( - ModelTypeSetToObjectIdSet(ModelTypeSet(THEMES, APPS)), ""); + ModelTypeSetToObjectIdSet(ModelTypeSet(THEMES, APPS)), + std::string()); invalidator->SendInvalidation(invalidation_map); } @@ -264,8 +266,8 @@ TEST_F(P2PInvalidatorTest, SendNotificationData) { const ModelTypeSet expected_types(THEMES); const ObjectIdInvalidationMap& invalidation_map = - ObjectIdSetToInvalidationMap( - ModelTypeSetToObjectIdSet(changed_types), ""); + ObjectIdSetToInvalidationMap(ModelTypeSetToObjectIdSet(changed_types), + std::string()); P2PInvalidator* const invalidator = delegate_.GetInvalidator(); notifier::FakePushClient* const push_client = delegate_.GetPushClient(); diff --git a/sync/notifier/push_client_channel_unittest.cc b/sync/notifier/push_client_channel_unittest.cc index ffe90e7..d017e1b 100644 --- a/sync/notifier/push_client_channel_unittest.cc +++ b/sync/notifier/push_client_channel_unittest.cc @@ -73,7 +73,7 @@ TEST_F(PushClientChannelTest, EncodeDecode) { TEST_F(PushClientChannelTest, EncodeDecodeNoContext) { const notifier::Notification& notification = PushClientChannel::EncodeMessageForTest( - kMessage, "", kSchedulingHash); + kMessage, std::string(), kSchedulingHash); std::string message; std::string service_context = kServiceContext; int64 scheduling_hash = kSchedulingHash + 1; diff --git a/sync/notifier/sync_invalidation_listener_unittest.cc b/sync/notifier/sync_invalidation_listener_unittest.cc index 8177327..dba4728 100644 --- a/sync/notifier/sync_invalidation_listener_unittest.cc +++ b/sync/notifier/sync_invalidation_listener_unittest.cc @@ -148,7 +148,7 @@ class FakeDelegate : public SyncInvalidationListener::Delegate { std::string GetPayload(const ObjectId& id) const { ObjectIdInvalidationMap::const_iterator it = invalidations_.find(id); - return (it == invalidations_.end()) ? "" : it->second.payload; + return (it == invalidations_.end()) ? std::string() : it->second.payload; } InvalidatorState GetInvalidatorState() const { diff --git a/sync/notifier/sync_system_resources.cc b/sync/notifier/sync_system_resources.cc index 5328657..3fc31fc 100644 --- a/sync/notifier/sync_system_resources.cc +++ b/sync/notifier/sync_system_resources.cc @@ -181,14 +181,15 @@ void SyncStorage::SetSystemResources( void SyncStorage::RunAndDeleteWriteKeyCallback( invalidation::WriteKeyCallback* callback) { - callback->Run(invalidation::Status(invalidation::Status::SUCCESS, "")); + callback->Run( + invalidation::Status(invalidation::Status::SUCCESS, std::string())); delete callback; } void SyncStorage::RunAndDeleteReadKeyCallback( invalidation::ReadKeyCallback* callback, const std::string& value) { callback->Run(std::make_pair( - invalidation::Status(invalidation::Status::SUCCESS, ""), + invalidation::Status(invalidation::Status::SUCCESS, std::string()), value)); delete callback; } diff --git a/sync/notifier/sync_system_resources_unittest.cc b/sync/notifier/sync_system_resources_unittest.cc index 77423b3..cb406da 100644 --- a/sync/notifier/sync_system_resources_unittest.cc +++ b/sync/notifier/sync_system_resources_unittest.cc @@ -168,9 +168,10 @@ TEST_F(SyncSystemResourcesTest, WriteState) { EXPECT_CALL(mock_storage_callback, Run(_)) .WillOnce(SaveArg<0>(&results)); sync_system_resources_.storage()->WriteKey( - "", "state", mock_storage_callback.CreateCallback()); + std::string(), "state", mock_storage_callback.CreateCallback()); message_loop_.RunUntilIdle(); - EXPECT_EQ(invalidation::Status(invalidation::Status::SUCCESS, ""), results); + EXPECT_EQ(invalidation::Status(invalidation::Status::SUCCESS, std::string()), + results); } } // namespace diff --git a/sync/syncable/directory_backing_store.cc b/sync/syncable/directory_backing_store.cc index f0b87be..6d11e7f 100644 --- a/sync/syncable/directory_backing_store.cc +++ b/sync/syncable/directory_backing_store.cc @@ -1269,7 +1269,7 @@ bool DirectoryBackingStore::CreateTables() { "?);")); // bag_of_chips s.BindString(0, dir_name_); // id s.BindString(1, dir_name_); // name - s.BindString(2, ""); // store_birthday + s.BindString(2, std::string()); // store_birthday // TODO(akalin): Remove this unused db_create_version field. (Or // actually use it for something.) http://crbug.com/118356 s.BindString(3, "Unknown"); // db_create_version diff --git a/sync/syncable/model_type.cc b/sync/syncable/model_type.cc index 2657ebc..eb28f37 100644 --- a/sync/syncable/model_type.cc +++ b/sync/syncable/model_type.cc @@ -523,7 +523,7 @@ base::StringValue* ModelTypeToValue(ModelType model_type) { return new base::StringValue("Unspecified"); } NOTREACHED(); - return new base::StringValue(""); + return new base::StringValue(std::string()); } ModelType ModelTypeFromValue(const base::Value& value) { diff --git a/sync/syncable/syncable_unittest.cc b/sync/syncable/syncable_unittest.cc index f99ad23..affaeb4 100644 --- a/sync/syncable/syncable_unittest.cc +++ b/sync/syncable/syncable_unittest.cc @@ -2253,7 +2253,7 @@ TEST_F(SyncableClientTagTest, TestClientTagClear) { WriteTransaction trans(FROM_HERE, UNITTEST, dir_.get()); MutableEntry me(&trans, GET_BY_CLIENT_TAG, test_tag_); EXPECT_TRUE(me.good()); - me.Put(UNIQUE_CLIENT_TAG, ""); + me.Put(UNIQUE_CLIENT_TAG, std::string()); } { ReadTransaction trans(FROM_HERE, dir_.get()); diff --git a/sync/syncable/syncable_write_transaction.cc b/sync/syncable/syncable_write_transaction.cc index 788d922..5b884e7 100644 --- a/sync/syncable/syncable_write_transaction.cc +++ b/sync/syncable/syncable_write_transaction.cc @@ -175,7 +175,7 @@ std::string WriterTagToString(WriterTag writer_tag) { ENUM_CASE(SYNCAPI); }; NOTREACHED(); - return ""; + return std::string(); } #undef ENUM_CASE diff --git a/sync/test/engine/mock_connection_manager.cc b/sync/test/engine/mock_connection_manager.cc index e5fd452..6ddd866 100644 --- a/sync/test/engine/mock_connection_manager.cc +++ b/sync/test/engine/mock_connection_manager.cc @@ -43,7 +43,6 @@ MockConnectionManager::MockConnectionManager(syncable::Directory* directory) store_birthday_("Store BDay!"), store_birthday_sent_(false), client_stuck_(false), - commit_time_rename_prepended_string_(""), countdown_to_postbuffer_fail_(0), directory_(directory), mid_commit_observer_(NULL), diff --git a/sync/util/cryptographer.cc b/sync/util/cryptographer.cc index 61b5e63..0fed51e 100644 --- a/sync/util/cryptographer.cc +++ b/sync/util/cryptographer.cc @@ -110,12 +110,12 @@ std::string Cryptographer::DecryptToString( NigoriMap::const_iterator it = nigoris_.find(encrypted.key_name()); if (nigoris_.end() == it) { NOTREACHED() << "Cannot decrypt message"; - return std::string(""); // Caller should have called CanDecrypt(encrypt). + return std::string(); // Caller should have called CanDecrypt(encrypt). } std::string plaintext; if (!it->second->Decrypt(encrypted.blob(), &plaintext)) { - return std::string(""); + return std::string(); } return plaintext; @@ -271,18 +271,18 @@ bool Cryptographer::GetBootstrapToken(std::string* token) const { std::string Cryptographer::UnpackBootstrapToken( const std::string& token) const { if (token.empty()) - return ""; + return std::string(); std::string encrypted_data; if (!base::Base64Decode(token, &encrypted_data)) { DLOG(WARNING) << "Could not decode token."; - return ""; + return std::string(); } std::string unencrypted_token; if (!encryptor_->DecryptString(encrypted_data, &unencrypted_token)) { DLOG(WARNING) << "Decryption of bootstrap token failed."; - return ""; + return std::string(); } return unencrypted_token; } @@ -328,15 +328,15 @@ bool Cryptographer::KeybagIsStale( std::string Cryptographer::GetDefaultNigoriKey() const { if (!is_initialized()) - return ""; + return std::string(); NigoriMap::const_iterator iter = nigoris_.find(default_nigori_name_); if (iter == nigoris_.end()) - return ""; + return std::string(); sync_pb::NigoriKey key; if (!iter->second->ExportKeys(key.mutable_user_key(), key.mutable_encryption_key(), key.mutable_mac_key())) - return ""; + return std::string(); return key.SerializeAsString(); } diff --git a/ui/base/gtk/menu_label_accelerator_util.cc b/ui/base/gtk/menu_label_accelerator_util.cc index f8192c5..507bf99 100644 --- a/ui/base/gtk/menu_label_accelerator_util.cc +++ b/ui/base/gtk/menu_label_accelerator_util.cc @@ -46,7 +46,7 @@ std::string ConvertAcceleratorsFromWindowsStyle(const std::string& label) { } std::string RemoveWindowsStyleAccelerators(const std::string& label) { - return ConvertAmpersandsTo(label, ""); + return ConvertAmpersandsTo(label, std::string()); } // Replaces all ampersands in |label| with two ampersands. This effectively diff --git a/ui/base/l10n/l10n_util_unittest.cc b/ui/base/l10n/l10n_util_unittest.cc index 085f2d6..1fce2e2 100644 --- a/ui/base/l10n/l10n_util_unittest.cc +++ b/ui/base/l10n/l10n_util_unittest.cc @@ -124,59 +124,59 @@ TEST_F(L10nUtilTest, GetAppLocale) { // Test the support of LANGUAGE environment variable. base::i18n::SetICUDefaultLocale("en-US"); env->SetVar("LANGUAGE", "xx:fr_CA"); - EXPECT_EQ("fr", l10n_util::GetApplicationLocale("")); + EXPECT_EQ("fr", l10n_util::GetApplicationLocale(std::string())); env->SetVar("LANGUAGE", "xx:yy:en_gb.utf-8@quot"); - EXPECT_EQ("en-GB", l10n_util::GetApplicationLocale("")); + EXPECT_EQ("en-GB", l10n_util::GetApplicationLocale(std::string())); env->SetVar("LANGUAGE", "xx:zh-hk"); - EXPECT_EQ("zh-TW", l10n_util::GetApplicationLocale("")); + EXPECT_EQ("zh-TW", l10n_util::GetApplicationLocale(std::string())); // We emulate gettext's behavior here, which ignores LANG/LC_MESSAGES/LC_ALL // when LANGUAGE is specified. If no language specified in LANGUAGE is valid, // then just fallback to the default language, which is en-US for us. base::i18n::SetICUDefaultLocale("fr-FR"); env->SetVar("LANGUAGE", "xx:yy"); - EXPECT_EQ("en-US", l10n_util::GetApplicationLocale("")); + EXPECT_EQ("en-US", l10n_util::GetApplicationLocale(std::string())); env->SetVar("LANGUAGE", "/fr:zh_CN"); - EXPECT_EQ("zh-CN", l10n_util::GetApplicationLocale("")); + EXPECT_EQ("zh-CN", l10n_util::GetApplicationLocale(std::string())); // Test prioritization of the different environment variables. env->SetVar("LANGUAGE", "fr"); env->SetVar("LC_ALL", "es"); env->SetVar("LC_MESSAGES", "he"); env->SetVar("LANG", "nb"); - EXPECT_EQ("fr", l10n_util::GetApplicationLocale("")); + EXPECT_EQ("fr", l10n_util::GetApplicationLocale(std::string())); env->UnSetVar("LANGUAGE"); - EXPECT_EQ("es", l10n_util::GetApplicationLocale("")); + EXPECT_EQ("es", l10n_util::GetApplicationLocale(std::string())); env->UnSetVar("LC_ALL"); - EXPECT_EQ("he", l10n_util::GetApplicationLocale("")); + EXPECT_EQ("he", l10n_util::GetApplicationLocale(std::string())); env->UnSetVar("LC_MESSAGES"); - EXPECT_EQ("nb", l10n_util::GetApplicationLocale("")); + EXPECT_EQ("nb", l10n_util::GetApplicationLocale(std::string())); env->UnSetVar("LANG"); SetDefaultLocaleForTest("ca", env.get()); - EXPECT_EQ("ca", l10n_util::GetApplicationLocale("")); + EXPECT_EQ("ca", l10n_util::GetApplicationLocale(std::string())); SetDefaultLocaleForTest("ca-ES", env.get()); - EXPECT_EQ("ca", l10n_util::GetApplicationLocale("")); + EXPECT_EQ("ca", l10n_util::GetApplicationLocale(std::string())); SetDefaultLocaleForTest("ca@valencia", env.get()); - EXPECT_EQ("ca@valencia", l10n_util::GetApplicationLocale("")); + EXPECT_EQ("ca@valencia", l10n_util::GetApplicationLocale(std::string())); SetDefaultLocaleForTest("ca_ES@valencia", env.get()); - EXPECT_EQ("ca@valencia", l10n_util::GetApplicationLocale("")); + EXPECT_EQ("ca@valencia", l10n_util::GetApplicationLocale(std::string())); SetDefaultLocaleForTest("ca_ES.UTF8@valencia", env.get()); - EXPECT_EQ("ca@valencia", l10n_util::GetApplicationLocale("")); + EXPECT_EQ("ca@valencia", l10n_util::GetApplicationLocale(std::string())); #endif // defined(OS_POSIX) && !defined(OS_CHROMEOS) SetDefaultLocaleForTest("en-US", env.get()); - EXPECT_EQ("en-US", l10n_util::GetApplicationLocale("")); + EXPECT_EQ("en-US", l10n_util::GetApplicationLocale(std::string())); SetDefaultLocaleForTest("xx", env.get()); - EXPECT_EQ("en-US", l10n_util::GetApplicationLocale("")); + EXPECT_EQ("en-US", l10n_util::GetApplicationLocale(std::string())); #if defined(OS_CHROMEOS) // ChromeOS honors preferred locale first in GetApplicationLocale(), @@ -200,43 +200,43 @@ TEST_F(L10nUtilTest, GetAppLocale) { EXPECT_EQ("en-GB", l10n_util::GetApplicationLocale("en-ZA")); #else // !defined(OS_CHROMEOS) SetDefaultLocaleForTest("en-GB", env.get()); - EXPECT_EQ("en-GB", l10n_util::GetApplicationLocale("")); + EXPECT_EQ("en-GB", l10n_util::GetApplicationLocale(std::string())); SetDefaultLocaleForTest("fr-CA", env.get()); - EXPECT_EQ("fr", l10n_util::GetApplicationLocale("")); + EXPECT_EQ("fr", l10n_util::GetApplicationLocale(std::string())); SetDefaultLocaleForTest("es-MX", env.get()); - EXPECT_EQ("es-419", l10n_util::GetApplicationLocale("")); + EXPECT_EQ("es-419", l10n_util::GetApplicationLocale(std::string())); SetDefaultLocaleForTest("es-AR", env.get()); - EXPECT_EQ("es-419", l10n_util::GetApplicationLocale("")); + EXPECT_EQ("es-419", l10n_util::GetApplicationLocale(std::string())); SetDefaultLocaleForTest("es-ES", env.get()); - EXPECT_EQ("es", l10n_util::GetApplicationLocale("")); + EXPECT_EQ("es", l10n_util::GetApplicationLocale(std::string())); SetDefaultLocaleForTest("es", env.get()); - EXPECT_EQ("es", l10n_util::GetApplicationLocale("")); + EXPECT_EQ("es", l10n_util::GetApplicationLocale(std::string())); SetDefaultLocaleForTest("zh-HK", env.get()); - EXPECT_EQ("zh-TW", l10n_util::GetApplicationLocale("")); + EXPECT_EQ("zh-TW", l10n_util::GetApplicationLocale(std::string())); SetDefaultLocaleForTest("zh-MO", env.get()); - EXPECT_EQ("zh-TW", l10n_util::GetApplicationLocale("")); + EXPECT_EQ("zh-TW", l10n_util::GetApplicationLocale(std::string())); SetDefaultLocaleForTest("zh-SG", env.get()); - EXPECT_EQ("zh-CN", l10n_util::GetApplicationLocale("")); + EXPECT_EQ("zh-CN", l10n_util::GetApplicationLocale(std::string())); SetDefaultLocaleForTest("en-CA", env.get()); - EXPECT_EQ("en-GB", l10n_util::GetApplicationLocale("")); + EXPECT_EQ("en-GB", l10n_util::GetApplicationLocale(std::string())); SetDefaultLocaleForTest("en-AU", env.get()); - EXPECT_EQ("en-GB", l10n_util::GetApplicationLocale("")); + EXPECT_EQ("en-GB", l10n_util::GetApplicationLocale(std::string())); SetDefaultLocaleForTest("en-NZ", env.get()); - EXPECT_EQ("en-GB", l10n_util::GetApplicationLocale("")); + EXPECT_EQ("en-GB", l10n_util::GetApplicationLocale(std::string())); SetDefaultLocaleForTest("en-ZA", env.get()); - EXPECT_EQ("en-GB", l10n_util::GetApplicationLocale("")); + EXPECT_EQ("en-GB", l10n_util::GetApplicationLocale(std::string())); #endif // defined(OS_CHROMEOS) #if defined(OS_WIN) @@ -437,7 +437,7 @@ TEST_F(L10nUtilTest, IsValidLocaleSyntax) { "sr_Latn_RS_REVISED@currency=USD")); // Test invalid locales. - EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("")); + EXPECT_FALSE(l10n_util::IsValidLocaleSyntax(std::string())); EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("x")); EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("12")); EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("456")); diff --git a/ui/gl/gl_surface.cc b/ui/gl/gl_surface.cc index 2e945ed..0feeb34 100644 --- a/ui/gl/gl_surface.cc +++ b/ui/gl/gl_surface.cc @@ -89,7 +89,7 @@ bool GLSurface::DeferDraws() { } std::string GLSurface::GetExtensions() { - return std::string(""); + return std::string(); } bool GLSurface::HasExtension(const char* name) { diff --git a/webkit/appcache/appcache_update_job_unittest.cc b/webkit/appcache/appcache_update_job_unittest.cc index 86b3df6..b90e783 100644 --- a/webkit/appcache/appcache_update_job_unittest.cc +++ b/webkit/appcache/appcache_update_job_unittest.cc @@ -2649,7 +2649,7 @@ class AppCacheUpdateJobTest : public testing::Test, // First test against a cache attempt. Will start manifest fetch // synchronously. - HttpHeadersRequestTestJob::Initialize("", ""); + HttpHeadersRequestTestJob::Initialize(std::string(), std::string()); MockFrontend mock_frontend; AppCacheHost host(1, &mock_frontend, service_.get()); update->StartUpdate(&host, GURL()); @@ -2666,7 +2666,7 @@ class AppCacheUpdateJobTest : public testing::Test, net::HttpResponseInfo* response_info = new net::HttpResponseInfo(); response_info->headers = headers; // adds ref to headers - HttpHeadersRequestTestJob::Initialize("", ""); + HttpHeadersRequestTestJob::Initialize(std::string(), std::string()); update = new AppCacheUpdateJob(service_.get(), group_); group_->update_job_ = update; group_->update_status_ = AppCacheGroup::DOWNLOADING; @@ -2687,7 +2687,8 @@ class AppCacheUpdateJobTest : public testing::Test, response_info = new net::HttpResponseInfo(); response_info->headers = headers2; - HttpHeadersRequestTestJob::Initialize("Sat, 29 Oct 1994 19:43:31 GMT", ""); + HttpHeadersRequestTestJob::Initialize("Sat, 29 Oct 1994 19:43:31 GMT", + std::string()); update = new AppCacheUpdateJob(service_.get(), group_); group_->update_job_ = update; group_->update_status_ = AppCacheGroup::DOWNLOADING; @@ -2703,7 +2704,8 @@ class AppCacheUpdateJobTest : public testing::Test, void IfModifiedSinceUpgradeTest() { ASSERT_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type()); - HttpHeadersRequestTestJob::Initialize("Sat, 29 Oct 1994 19:43:31 GMT", ""); + HttpHeadersRequestTestJob::Initialize("Sat, 29 Oct 1994 19:43:31 GMT", + std::string()); net::URLRequestJobFactoryImpl* new_factory( new net::URLRequestJobFactoryImpl); new_factory->SetProtocolHandler("http", new IfModifiedSinceJobFactory); @@ -2765,7 +2767,7 @@ class AppCacheUpdateJobTest : public testing::Test, void IfNoneMatchUpgradeTest() { ASSERT_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type()); - HttpHeadersRequestTestJob::Initialize("", "\"LadeDade\""); + HttpHeadersRequestTestJob::Initialize(std::string(), "\"LadeDade\""); net::URLRequestJobFactoryImpl* new_factory( new net::URLRequestJobFactoryImpl); new_factory->SetProtocolHandler("http", new IfModifiedSinceJobFactory); @@ -2827,7 +2829,7 @@ class AppCacheUpdateJobTest : public testing::Test, void IfNoneMatchRefetchTest() { ASSERT_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type()); - HttpHeadersRequestTestJob::Initialize("", "\"LadeDade\""); + HttpHeadersRequestTestJob::Initialize(std::string(), "\"LadeDade\""); net::URLRequestJobFactoryImpl* new_factory( new net::URLRequestJobFactoryImpl); new_factory->SetProtocolHandler("http", new IfModifiedSinceJobFactory); diff --git a/webkit/fileapi/copy_or_move_file_validator_unittest.cc b/webkit/fileapi/copy_or_move_file_validator_unittest.cc index 7abc628..6aafa88 100644 --- a/webkit/fileapi/copy_or_move_file_validator_unittest.cc +++ b/webkit/fileapi/copy_or_move_file_validator_unittest.cc @@ -58,8 +58,7 @@ class CopyOrMoveFileValidatorTestHelper { FileSystemMountPointProvider* mount_point_provider = file_system_context_->GetMountPointProvider(src_type_); mount_point_provider->GetFileSystemRootPathOnFileThread( - SourceURL(""), - true /* create */); + SourceURL(std::string()), true /* create */); } DCHECK_EQ(kFileSystemTypeNativeMedia, dest_type_); base::FilePath dest_path = base_dir.Append(FILE_PATH_LITERAL("dest_media")); diff --git a/webkit/fileapi/external_mount_points_unittest.cc b/webkit/fileapi/external_mount_points_unittest.cc index 4b2ce6cb..8c012fa 100644 --- a/webkit/fileapi/external_mount_points_unittest.cc +++ b/webkit/fileapi/external_mount_points_unittest.cc @@ -154,7 +154,7 @@ TEST(ExternalMountPointsTest, GetVirtualPath) { // A mount point with an empty path. mount_points->RegisterFileSystem("empty_path", fileapi::kFileSystemTypeNativeLocal, - base::FilePath(FPL(""))); + base::FilePath(FPL(std::string()))); struct TestCase { const base::FilePath::CharType* const local_path; @@ -271,7 +271,7 @@ TEST(ExternalMountPointsTest, CreateCrackedFileSystemURL) { base::FilePath(DRIVE FPL("/a/b/c(1)"))); mount_points->RegisterFileSystem("empty_path", fileapi::kFileSystemTypeSyncable, - base::FilePath(FPL(""))); + base::FilePath(FPL(std::string()))); mount_points->RegisterFileSystem("mount", fileapi::kFileSystemTypeDrive, base::FilePath(DRIVE FPL("/root"))); @@ -382,7 +382,7 @@ TEST(ExternalMountPointsTest, CrackVirtualPath) { base::FilePath(DRIVE FPL("/a/b/c(1)"))); mount_points->RegisterFileSystem("empty_path", fileapi::kFileSystemTypeSyncable, - base::FilePath(FPL(""))); + base::FilePath(FPL(std::string()))); mount_points->RegisterFileSystem("mount", fileapi::kFileSystemTypeDrive, base::FilePath(DRIVE FPL("/root"))); diff --git a/webkit/fileapi/file_system_directory_database_unittest.cc b/webkit/fileapi/file_system_directory_database_unittest.cc index b612669..5a4b889 100644 --- a/webkit/fileapi/file_system_directory_database_unittest.cc +++ b/webkit/fileapi/file_system_directory_database_unittest.cc @@ -569,7 +569,7 @@ TEST_F(FileSystemDirectoryDatabaseTest, TestConsistencyCheck_OrphanFile) { TEST_F(FileSystemDirectoryDatabaseTest, TestConsistencyCheck_RootLoop) { EXPECT_TRUE(db()->IsFileSystemConsistent()); - MakeHierarchyLink(0, 0, FPL("")); + MakeHierarchyLink(0, 0, FPL(std::string())); EXPECT_FALSE(db()->IsFileSystemConsistent()); } diff --git a/webkit/fileapi/file_system_origin_database.cc b/webkit/fileapi/file_system_origin_database.cc index 1026418..a7405d9 100644 --- a/webkit/fileapi/file_system_origin_database.cc +++ b/webkit/fileapi/file_system_origin_database.cc @@ -265,7 +265,7 @@ bool FileSystemOriginDatabase::ListAllOrigins( return false; DCHECK(origins); scoped_ptr<leveldb::Iterator> iter(db_->NewIterator(leveldb::ReadOptions())); - std::string origin_key_prefix = OriginToOriginKey(""); + std::string origin_key_prefix = OriginToOriginKey(std::string()); iter->Seek(origin_key_prefix); origins->clear(); while (iter->Valid() && diff --git a/webkit/fileapi/file_system_util_unittest.cc b/webkit/fileapi/file_system_util_unittest.cc index 7c946cc..74fc764 100644 --- a/webkit/fileapi/file_system_util_unittest.cc +++ b/webkit/fileapi/file_system_util_unittest.cc @@ -115,7 +115,7 @@ TEST_F(FileSystemUtilTest, GetNormalizedFilePath) { TEST_F(FileSystemUtilTest, IsAbsolutePath) { EXPECT_TRUE(VirtualPath::IsAbsolute(FILE_PATH_LITERAL("/"))); EXPECT_TRUE(VirtualPath::IsAbsolute(FILE_PATH_LITERAL("/foo/bar"))); - EXPECT_FALSE(VirtualPath::IsAbsolute(FILE_PATH_LITERAL(""))); + EXPECT_FALSE(VirtualPath::IsAbsolute(FILE_PATH_LITERAL(std::string()))); EXPECT_FALSE(VirtualPath::IsAbsolute(FILE_PATH_LITERAL("foo/bar"))); } diff --git a/webkit/fileapi/local_file_stream_writer_unittest.cc b/webkit/fileapi/local_file_stream_writer_unittest.cc index d67a7da..41c547e 100644 --- a/webkit/fileapi/local_file_stream_writer_unittest.cc +++ b/webkit/fileapi/local_file_stream_writer_unittest.cc @@ -77,7 +77,7 @@ void NeverCalled(int unused) { } // namespace TEST_F(LocalFileStreamWriterTest, Write) { - base::FilePath path = CreateFileWithContent("file_a", ""); + base::FilePath path = CreateFileWithContent("file_a", std::string()); scoped_ptr<LocalFileStreamWriter> writer(new LocalFileStreamWriter(path, 0)); EXPECT_EQ(net::OK, WriteStringToWriter(writer.get(), "foo")); EXPECT_EQ(net::OK, WriteStringToWriter(writer.get(), "bar")); @@ -126,7 +126,7 @@ TEST_F(LocalFileStreamWriterTest, CancelBeforeOperation) { } TEST_F(LocalFileStreamWriterTest, CancelAfterFinishedOperation) { - base::FilePath path = CreateFileWithContent("file_a", ""); + base::FilePath path = CreateFileWithContent("file_a", std::string()); scoped_ptr<LocalFileStreamWriter> writer(new LocalFileStreamWriter(path, 0)); EXPECT_EQ(net::OK, WriteStringToWriter(writer.get(), "foo")); diff --git a/webkit/fileapi/local_file_system_cross_operation_unittest.cc b/webkit/fileapi/local_file_system_cross_operation_unittest.cc index 2929b93..5466069 100644 --- a/webkit/fileapi/local_file_system_cross_operation_unittest.cc +++ b/webkit/fileapi/local_file_system_cross_operation_unittest.cc @@ -71,13 +71,11 @@ class CrossOperationTestHelper { FileSystemMountPointProvider* mount_point_provider = file_system_context_->GetMountPointProvider(src_type_); mount_point_provider->GetFileSystemRootPathOnFileThread( - SourceURL(""), - true /* create */); + SourceURL(std::string()), true /* create */); mount_point_provider = file_system_context_->GetMountPointProvider(dest_type_); mount_point_provider->GetFileSystemRootPathOnFileThread( - DestURL(""), - true /* create */); + DestURL(std::string()), true /* create */); // Grant relatively big quota initially. quota_manager_->SetQuota(origin_, diff --git a/webkit/fileapi/obfuscated_file_util_unittest.cc b/webkit/fileapi/obfuscated_file_util_unittest.cc index 387f28e..6a6d4a6 100644 --- a/webkit/fileapi/obfuscated_file_util_unittest.cc +++ b/webkit/fileapi/obfuscated_file_util_unittest.cc @@ -941,7 +941,7 @@ TEST_F(ObfuscatedFileUtilTest, TestDirectoryOps) { EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, ofu()->DeleteDirectory(context.get(), url)); - FileSystemURL root = CreateURLFromUTF8(""); + FileSystemURL root = CreateURLFromUTF8(std::string()); EXPECT_FALSE(DirectoryExists(url)); EXPECT_FALSE(PathExists(url)); context.reset(NewContext(NULL)); @@ -1081,7 +1081,7 @@ TEST_F(ObfuscatedFileUtilTest, TestReadDirectory) { } TEST_F(ObfuscatedFileUtilTest, TestReadRootWithSlash) { - TestReadDirectoryHelper(CreateURLFromUTF8("")); + TestReadDirectoryHelper(CreateURLFromUTF8(std::string())); } TEST_F(ObfuscatedFileUtilTest, TestReadRootWithEmptyString) { diff --git a/webkit/fileapi/syncable/canned_syncable_file_system.cc b/webkit/fileapi/syncable/canned_syncable_file_system.cc index 954d6a5..f323a1a 100644 --- a/webkit/fileapi/syncable/canned_syncable_file_system.cc +++ b/webkit/fileapi/syncable/canned_syncable_file_system.cc @@ -445,7 +445,8 @@ void CannedSyncableFileSystem::ClearChangeForURLInTracker( } FileSystemOperation* CannedSyncableFileSystem::NewOperation() { - return file_system_context_->CreateFileSystemOperation(URL(""), NULL); + return file_system_context_->CreateFileSystemOperation(URL(std::string()), + NULL); } void CannedSyncableFileSystem::OnSyncEnabled(const FileSystemURL& url) { diff --git a/webkit/glue/webclipboard_impl.cc b/webkit/glue/webclipboard_impl.cc index 3cbe45c..302c81e 100644 --- a/webkit/glue/webclipboard_impl.cc +++ b/webkit/glue/webclipboard_impl.cc @@ -201,7 +201,7 @@ void WebClipboardImpl::writeURL(const WebURL& url, const WebString& title) { ScopedClipboardWriterGlue scw(client_); scw.WriteBookmark(title, url.spec()); - scw.WriteHTML(UTF8ToUTF16(URLToMarkup(url, title)), ""); + scw.WriteHTML(UTF8ToUTF16(URLToMarkup(url, title)), std::string()); scw.WriteText(UTF8ToUTF16(std::string(url.spec()))); } @@ -225,7 +225,7 @@ void WebClipboardImpl::writeImage( // We also don't want to write HTML on a Mac, since Mail.app prefers to use // the image markup over attaching the actual image. See // http://crbug.com/33016 for details. - scw.WriteHTML(UTF8ToUTF16(URLToImageMarkup(url, title)), ""); + scw.WriteHTML(UTF8ToUTF16(URLToImageMarkup(url, title)), std::string()); #endif } } @@ -238,7 +238,7 @@ void WebClipboardImpl::writeDataObject(const WebDragData& data) { if (!data_object.text.is_null()) scw.WriteText(data_object.text.string()); if (!data_object.html.is_null()) - scw.WriteHTML(data_object.html.string(), ""); + scw.WriteHTML(data_object.html.string(), std::string()); // If there is no custom data, avoid calling WritePickledData. This ensures // that ScopedClipboardWriterGlue's dtor remains a no-op if the page didn't // modify the DataTransfer object, which is important to avoid stomping on diff --git a/webkit/media/crypto/key_systems.cc b/webkit/media/crypto/key_systems.cc index b9c79d0..0ffe951 100644 --- a/webkit/media/crypto/key_systems.cc +++ b/webkit/media/crypto/key_systems.cc @@ -66,7 +66,7 @@ KeySystems::KeySystems() { for (size_t j = 0; j < mime_type_codecs.size(); ++j) codecs.insert(mime_type_codecs[j]); // Support the MIME type string alone, without codec(s) specified. - codecs.insert(""); + codecs.insert(std::string()); // Key systems can be repeated, so there may already be an entry. KeySystemMappings::iterator key_system_iter = @@ -113,7 +113,8 @@ bool KeySystems::IsSupportedKeySystemWithMediaMimeType( const std::vector<std::string>& codecs, const std::string& key_system) { if (codecs.empty()) - return IsSupportedKeySystemWithContainerAndCodec(mime_type, "", key_system); + return IsSupportedKeySystemWithContainerAndCodec( + mime_type, std::string(), key_system); for (size_t i = 0; i < codecs.size(); ++i) { if (!IsSupportedKeySystemWithContainerAndCodec( diff --git a/webkit/media/crypto/key_systems_unittest.cc b/webkit/media/crypto/key_systems_unittest.cc index 0c25196..4b28ec9 100644 --- a/webkit/media/crypto/key_systems_unittest.cc +++ b/webkit/media/crypto/key_systems_unittest.cc @@ -233,14 +233,14 @@ TEST_F(KeySystemsTest, ClearKey_IsSupportedKeySystem_InvalidVariants) { TEST_F(KeySystemsTest, IsSupportedKeySystemWithMediaMimeType_ClearKey_NoType) { // These two should be true. See http://crbug.com/164303. EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( - "", no_codecs(), kClearKey)); + std::string(), no_codecs(), kClearKey)); EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( - "", no_codecs(), "webkit-org.w3")); + std::string(), no_codecs(), "webkit-org.w3")); EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( - "", no_codecs(), "webkit-org.w3.foo")); + std::string(), no_codecs(), "webkit-org.w3.foo")); EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( - "", no_codecs(), "webkit-org.w3.clearkey.foo")); + std::string(), no_codecs(), "webkit-org.w3.clearkey.foo")); } TEST_F(KeySystemsTest, IsSupportedKeySystemWithMediaMimeType_ClearKey_WebM) { @@ -419,14 +419,14 @@ TEST_F(KeySystemsTest, IsSupportedKeySystemWithMediaMimeType_ExternalClearKey_NoType) { // These two should be true. See http://crbug.com/164303. EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( - "", no_codecs(), kExternalClearKey)); + std::string(), no_codecs(), kExternalClearKey)); EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( - "", no_codecs(), "org.chromium")); + std::string(), no_codecs(), "org.chromium")); EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( - "", no_codecs(), "org.chromium.foo")); + std::string(), no_codecs(), "org.chromium.foo")); EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( - "", no_codecs(), "org.chromium.externalclearkey.foo")); + std::string(), no_codecs(), "org.chromium.externalclearkey.foo")); } TEST_F(KeySystemsTest, @@ -606,14 +606,14 @@ TEST_F(KeySystemsTest, Widevine_IsSupportedKeySystem_InvalidVariants) { TEST_F(KeySystemsTest, IsSupportedKeySystemWithMediaMimeType_Widevine_NoType) { // These two should be true. See http://crbug.com/164303. EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( - "", no_codecs(), kWidevineAlpha)); + std::string(), no_codecs(), kWidevineAlpha)); EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( - "", no_codecs(), kWidevine)); + std::string(), no_codecs(), kWidevine)); EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( - "", no_codecs(), "com.widevine.foo")); + std::string(), no_codecs(), "com.widevine.foo")); EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( - "", no_codecs(), "com.widevine.alpha.foo")); + std::string(), no_codecs(), "com.widevine.alpha.foo")); } TEST_F(KeySystemsTest, IsSupportedKeySystemWithMediaMimeType_Widevine_WebM) { diff --git a/webkit/media/crypto/ppapi/cdm_wrapper.cc b/webkit/media/crypto/ppapi/cdm_wrapper.cc index 25eadb0..cd5b917 100644 --- a/webkit/media/crypto/ppapi/cdm_wrapper.cc +++ b/webkit/media/crypto/ppapi/cdm_wrapper.cc @@ -652,7 +652,7 @@ void CdmWrapper::GenerateKeyRequest(const std::string& key_system, if (!cdm_) { if (!CreateCdmInstance(key_system)) { - SendUnknownKeyError(key_system, ""); + SendUnknownKeyError(key_system, std::string()); return; } } diff --git a/webkit/media/crypto/ppapi/clear_key_cdm.cc b/webkit/media/crypto/ppapi/clear_key_cdm.cc index 4c0e2d5..faa6635 100644 --- a/webkit/media/crypto/ppapi/clear_key_cdm.cc +++ b/webkit/media/crypto/ppapi/clear_key_cdm.cc @@ -249,7 +249,11 @@ cdm::Status ClearKeyCdm::AddKey(const char* session_id, DVLOG(1) << "AddKey()"; base::AutoLock auto_lock(client_lock_); ScopedResetter<Client> auto_resetter(&client_); - decryptor_.AddKey("", key, key_size, key_id, key_id_size, + decryptor_.AddKey(std::string(), + key, + key_size, + key_id, + key_id_size, std::string(session_id, session_id_size)); if (client_.status() != Client::kKeyAdded) @@ -268,7 +272,8 @@ cdm::Status ClearKeyCdm::CancelKeyRequest(const char* session_id, DVLOG(1) << "CancelKeyRequest()"; base::AutoLock auto_lock(client_lock_); ScopedResetter<Client> auto_resetter(&client_); - decryptor_.CancelKeyRequest("", std::string(session_id, session_id_size)); + decryptor_.CancelKeyRequest(std::string(), + std::string(session_id, session_id_size)); return cdm::kSuccess; } diff --git a/webkit/media/crypto/ppapi_decryptor.cc b/webkit/media/crypto/ppapi_decryptor.cc index 580c5a3..7b9c334 100644 --- a/webkit/media/crypto/ppapi_decryptor.cc +++ b/webkit/media/crypto/ppapi_decryptor.cc @@ -68,7 +68,7 @@ bool PpapiDecryptor::GenerateKeyRequest(const std::string& key_system, if (!plugin_cdm_delegate_->GenerateKeyRequest( key_system, type, init_data, init_data_length)) { - ReportFailureToCallPlugin(key_system, ""); + ReportFailureToCallPlugin(key_system, std::string()); return false; } diff --git a/webkit/media/crypto/proxy_decryptor.cc b/webkit/media/crypto/proxy_decryptor.cc index bd0328a..dafc955 100644 --- a/webkit/media/crypto/proxy_decryptor.cc +++ b/webkit/media/crypto/proxy_decryptor.cc @@ -117,7 +117,8 @@ bool ProxyDecryptor::GenerateKeyRequest(const std::string& key_system, if (!decryptor_) { decryptor_ = CreateDecryptor(key_system); if (!decryptor_) { - key_error_cb_.Run(key_system, "", media::Decryptor::kClientError, 0); + key_error_cb_.Run( + key_system, std::string(), media::Decryptor::kClientError, 0); return false; } } diff --git a/webkit/plugins/ppapi/content_decryptor_delegate.cc b/webkit/plugins/ppapi/content_decryptor_delegate.cc index 8515531..5e3a649 100644 --- a/webkit/plugins/ppapi/content_decryptor_delegate.cc +++ b/webkit/plugins/ppapi/content_decryptor_delegate.cc @@ -627,7 +627,8 @@ void ContentDecryptorDelegate::KeyAdded(PP_Var key_system_var, StringVar* key_system_string = StringVar::FromPPVar(key_system_var); StringVar* session_id_string = StringVar::FromPPVar(session_id_var); if (!key_system_string || !session_id_string) { - key_error_cb_.Run("", "", media::Decryptor::kUnknownError, 0); + key_error_cb_.Run( + std::string(), std::string(), media::Decryptor::kUnknownError, 0); return; } @@ -656,7 +657,8 @@ void ContentDecryptorDelegate::KeyMessage(PP_Var key_system_var, StringVar* default_url_string = StringVar::FromPPVar(default_url_var); if (!key_system_string || !session_id_string || !default_url_string) { - key_error_cb_.Run("", "", media::Decryptor::kUnknownError, 0); + key_error_cb_.Run( + std::string(), std::string(), media::Decryptor::kUnknownError, 0); return; } @@ -676,7 +678,8 @@ void ContentDecryptorDelegate::KeyError(PP_Var key_system_var, StringVar* key_system_string = StringVar::FromPPVar(key_system_var); StringVar* session_id_string = StringVar::FromPPVar(session_id_var); if (!key_system_string || !session_id_string) { - key_error_cb_.Run("", "", media::Decryptor::kUnknownError, 0); + key_error_cb_.Run( + std::string(), std::string(), media::Decryptor::kUnknownError, 0); return; } diff --git a/webkit/quota/quota_manager_unittest.cc b/webkit/quota/quota_manager_unittest.cc index ccbc826..c814dbc 100644 --- a/webkit/quota/quota_manager_unittest.cc +++ b/webkit/quota/quota_manager_unittest.cc @@ -1368,7 +1368,7 @@ TEST_F(QuotaManagerTest, DeleteHostDataSimple) { MessageLoop::current()->RunUntilIdle(); int64 predelete_host_pers = usage(); - DeleteHostData("", kTemp, kAllClients); + DeleteHostData(std::string(), kTemp, kAllClients); MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kQuotaStatusOk, status()); diff --git a/webkit/tools/test_shell/test_shell.h b/webkit/tools/test_shell/test_shell.h index 5b85305..2640224 100644 --- a/webkit/tools/test_shell/test_shell.h +++ b/webkit/tools/test_shell/test_shell.h @@ -243,7 +243,8 @@ public: // Get the JavaScript flags for a specific load static std::string GetJSFlagsForLoad(size_t load) { - if (load >= js_flags_.size()) return ""; + if (load >= js_flags_.size()) + return std::string(); return js_flags_[load]; } |