diff options
author | viettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-25 04:54:09 +0000 |
---|---|---|
committer | viettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-25 04:54:09 +0000 |
commit | 0b0a7d7b536d44cb51a892009368f8ec14c9ab95 (patch) | |
tree | 2f2eb903e33f9033ac340a2e58075db054dea5b6 /chrome/test/model_test_utils.cc | |
parent | ada18ef6563816ea3ebcae904187a3bdcc17da0f (diff) | |
download | chromium_src-0b0a7d7b536d44cb51a892009368f8ec14c9ab95.zip chromium_src-0b0a7d7b536d44cb51a892009368f8ec14c9ab95.tar.gz chromium_src-0b0a7d7b536d44cb51a892009368f8ec14c9ab95.tar.bz2 |
Remove wstrings from bookmarks, part 13.
This eliminates wstrings from bookmark_model_unittest.cc, which entails removing
them from model_test_utils.*.
BUG=23581
TEST=builds and passes tests
Review URL: http://codereview.chromium.org/3141033
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57292 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/model_test_utils.cc')
-rw-r--r-- | chrome/test/model_test_utils.cc | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/chrome/test/model_test_utils.cc b/chrome/test/model_test_utils.cc index 8522622..d430c7e 100644 --- a/chrome/test/model_test_utils.cc +++ b/chrome/test/model_test_utils.cc @@ -10,18 +10,18 @@ namespace model_test_utils { -std::wstring ModelStringFromNode(const BookmarkNode* node) { +std::string ModelStringFromNode(const BookmarkNode* node) { // Since the children of the node are not available as a vector, // we'll just have to do it the hard way. int child_count = node->GetChildCount(); - std::wstring child_string; + std::string child_string; for (int i = 0; i < child_count; ++i) { const BookmarkNode* child = node->GetChild(i); if (child->is_folder()) { - child_string += child->GetTitle() + L":[ " + ModelStringFromNode(child) - + L"] "; + child_string += UTF16ToUTF8(child->GetTitleAsString16()) + ":[ " + + ModelStringFromNode(child) + "] "; } else { - child_string += child->GetTitle() + L" "; + child_string += UTF16ToUTF8(child->GetTitleAsString16()) + " "; } } return child_string; @@ -29,34 +29,34 @@ std::wstring ModelStringFromNode(const BookmarkNode* node) { // Helper function which does the actual work of creating the nodes for // a particular level in the hierarchy. -std::wstring::size_type AddNodesFromString(BookmarkModel& model, - const BookmarkNode* node, - const std::wstring& model_string, - std::wstring::size_type start_pos) { +std::string::size_type AddNodesFromString(BookmarkModel& model, + const BookmarkNode* node, + const std::string& model_string, + std::string::size_type start_pos) { DCHECK(node); int index = node->GetChildCount(); - static const std::wstring folder_tell(L":["); - std::wstring::size_type end_pos = model_string.find(' ', start_pos); - while (end_pos != std::wstring::npos) { - std::wstring::size_type part_length = end_pos - start_pos; - std::wstring node_name = model_string.substr(start_pos, part_length); + static const std::string folder_tell(":["); + std::string::size_type end_pos = model_string.find(' ', start_pos); + while (end_pos != std::string::npos) { + std::string::size_type part_length = end_pos - start_pos; + std::string node_name = model_string.substr(start_pos, part_length); // Are we at the end of a folder group? - if (node_name != L"]") { + if (node_name != "]") { // No, is it a folder? - std::wstring tell; + std::string tell; if (part_length > 2) tell = node_name.substr(part_length - 2, 2); if (tell == folder_tell) { node_name = node_name.substr(0, part_length - 2); const BookmarkNode* new_node = - model.AddGroup(node, index, WideToUTF16Hack(node_name)); + model.AddGroup(node, index, UTF8ToUTF16(node_name)); end_pos = AddNodesFromString(model, new_node, model_string, end_pos + 1); } else { std::string url_string("http://"); url_string += std::string(node_name.begin(), node_name.end()); url_string += ".com"; - model.AddURL(node, index, WideToUTF16Hack(node_name), GURL(url_string)); + model.AddURL(node, index, UTF8ToUTF16(node_name), GURL(url_string)); ++end_pos; } ++index; @@ -72,13 +72,13 @@ std::wstring::size_type AddNodesFromString(BookmarkModel& model, void AddNodesFromModelString(BookmarkModel& model, const BookmarkNode* node, - const std::wstring& model_string) { + const std::string& model_string) { DCHECK(node); - const std::wstring folder_tell(L":["); - std::wstring::size_type start_pos = 0; - std::wstring::size_type end_pos = + const std::string folder_tell(":["); + std::string::size_type start_pos = 0; + std::string::size_type end_pos = AddNodesFromString(model, node, model_string, start_pos); - DCHECK(end_pos == std::wstring::npos); + DCHECK(end_pos == std::string::npos); } } // namespace model_test_utils |