summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-23 22:04:01 +0000
committerwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-23 22:04:01 +0000
commitab34ee59dfe0c75f1d72d8295c1335a6d55d8c8c (patch)
tree52df59c2eb143bb1fcff29e1aa880c347d36a00f /base
parent9a6c8933a3d843a52328c34c44b8d08655a910bc (diff)
downloadchromium_src-ab34ee59dfe0c75f1d72d8295c1335a6d55d8c8c.zip
chromium_src-ab34ee59dfe0c75f1d72d8295c1335a6d55d8c8c.tar.gz
chromium_src-ab34ee59dfe0c75f1d72d8295c1335a6d55d8c8c.tar.bz2
Revert "Reland r42300: "HttpRequestHeaders refactor."""
Broke another layout test. Review URL: http://codereview.chromium.org/1223001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42387 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r--base/string_util.cc48
-rw-r--r--base/string_util.h8
-rw-r--r--base/string_util_unittest.cc50
3 files changed, 1 insertions, 105 deletions
diff --git a/base/string_util.cc b/base/string_util.cc
index 494d09d..19c1735 100644
--- a/base/string_util.cc
+++ b/base/string_util.cc
@@ -1324,54 +1324,6 @@ void SplitStringDontTrim(const std::string& str,
SplitStringT(str, s, false, r);
}
-template <typename STR>
-static void SplitStringUsingSubstrT(const STR& str,
- const STR& s,
- std::vector<STR>* r) {
- typename STR::size_type begin_index = 0;
- while (true) {
- const typename STR::size_type end_index = str.find(s, begin_index);
- if (end_index == STR::npos) {
- const STR term = str.substr(begin_index);
- STR tmp;
- TrimWhitespace(term, TRIM_ALL, &tmp);
- r->push_back(tmp);
- return;
- }
- const STR term = str.substr(begin_index, end_index - begin_index);
- STR tmp;
- TrimWhitespace(term, TRIM_ALL, &tmp);
- r->push_back(tmp);
- begin_index = end_index + s.size();
- }
-}
-
-void SplitStringUsingSubstr(const string16& str,
- const string16& s,
- std::vector<string16>* r) {
- SplitStringUsingSubstrT(str, s, r);
-}
-
-void SplitStringUsingSubstr(const std::string& str,
- const std::string& s,
- std::vector<std::string>* r) {
- SplitStringUsingSubstrT(str, s, r);
-}
-
-std::vector<string16> SplitStringUsingSubstr(const string16& str,
- const string16& s) {
- std::vector<string16> result;
- SplitStringUsingSubstr(str, s, &result);
- return result;
-}
-
-std::vector<std::string> SplitStringUsingSubstr(const std::string& str,
- const std::string& s) {
- std::vector<std::string> result;
- SplitStringUsingSubstr(str, s, &result);
- return result;
-}
-
template<typename STR>
static size_t TokenizeT(const STR& str,
const STR& delimiters,
diff --git a/base/string_util.h b/base/string_util.h
index 28cd26f..586c60c 100644
--- a/base/string_util.h
+++ b/base/string_util.h
@@ -575,14 +575,6 @@ void SplitStringDontTrim(const std::string& str,
char s,
std::vector<std::string>* r);
-// The same as SplitString, but use a substring delimiter instead of a char.
-void SplitStringUsingSubstr(const string16& str,
- const string16& s,
- std::vector<string16>* r);
-void SplitStringUsingSubstr(const std::string& str,
- const std::string& s,
- std::vector<std::string>* r);
-
// Splits a string into its fields delimited by any of the characters in
// |delimiters|. Each field is added to the |tokens| vector. Returns the
// number of tokens found.
diff --git a/base/string_util_unittest.cc b/base/string_util_unittest.cc
index 8fc8f15..78939f5 100644
--- a/base/string_util_unittest.cc
+++ b/base/string_util_unittest.cc
@@ -11,11 +11,8 @@
#include "base/basictypes.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
-#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
-using ::testing::ElementsAre;
-
namespace base {
namespace {
@@ -1495,49 +1492,4 @@ TEST(StringUtilTest, ContainsOnlyChars) {
EXPECT_FALSE(ContainsOnlyChars("123a", "4321"));
}
-TEST(SplitStringUsingSubstrTest, EmptyString) {
- std::vector<std::string> results;
- SplitStringUsingSubstr("", "DELIMITER", &results);
- ASSERT_EQ(1u, results.size());
- EXPECT_THAT(results, ElementsAre(""));
-}
-
-TEST(SplitStringUsingSubstrTest, StringWithNoDelimiter) {
- std::vector<std::string> results;
- SplitStringUsingSubstr("alongwordwithnodelimiter", "DELIMITER", &results);
- ASSERT_EQ(1u, results.size());
- EXPECT_THAT(results, ElementsAre("alongwordwithnodelimiter"));
-}
-
-TEST(SplitStringUsingSubstrTest, LeadingDelimitersSkipped) {
- std::vector<std::string> results;
- SplitStringUsingSubstr(
- "DELIMITERDELIMITERDELIMITERoneDELIMITERtwoDELIMITERthree",
- "DELIMITER",
- &results);
- ASSERT_EQ(6u, results.size());
- EXPECT_THAT(results, ElementsAre("", "", "", "one", "two", "three"));
-}
-
-TEST(SplitStringUsingSubstrTest, ConsecutiveDelimitersSkipped) {
- std::vector<std::string> results;
- SplitStringUsingSubstr(
- "unoDELIMITERDELIMITERDELIMITERdosDELIMITERtresDELIMITERDELIMITERcuatro",
- "DELIMITER",
- &results);
- ASSERT_EQ(7u, results.size());
- EXPECT_THAT(results, ElementsAre("uno", "", "", "dos", "tres", "", "cuatro"));
-}
-
-TEST(SplitStringUsingSubstrTest, TrailingDelimitersSkipped) {
- std::vector<std::string> results;
- SplitStringUsingSubstr(
- "unDELIMITERdeuxDELIMITERtroisDELIMITERquatreDELIMITERDELIMITERDELIMITER",
- "DELIMITER",
- &results);
- ASSERT_EQ(7u, results.size());
- EXPECT_THAT(
- results, ElementsAre("un", "deux", "trois", "quatre", "", "", ""));
-}
-
-} // namespace base
+} // base