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/browser/bookmarks | |
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/browser/bookmarks')
-rw-r--r-- | chrome/browser/bookmarks/bookmark_model_test_utils.cc | 4 | ||||
-rw-r--r-- | chrome/browser/bookmarks/bookmark_model_unittest.cc | 52 |
2 files changed, 28 insertions, 28 deletions
diff --git a/chrome/browser/bookmarks/bookmark_model_test_utils.cc b/chrome/browser/bookmarks/bookmark_model_test_utils.cc index e563a3f..263e42f 100644 --- a/chrome/browser/bookmarks/bookmark_model_test_utils.cc +++ b/chrome/browser/bookmarks/bookmark_model_test_utils.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -15,7 +15,7 @@ void BookmarkModelTestUtils::AssertNodesEqual(const BookmarkNode* expected, ASSERT_TRUE(actual); if (check_ids) EXPECT_EQ(expected->id(), actual->id()); - EXPECT_EQ(expected->GetTitle(), actual->GetTitle()); + EXPECT_EQ(expected->GetTitleAsString16(), actual->GetTitleAsString16()); EXPECT_EQ(expected->type(), actual->type()); EXPECT_TRUE(expected->date_added() == actual->date_added()); if (expected->type() == BookmarkNode::URL) { diff --git a/chrome/browser/bookmarks/bookmark_model_unittest.cc b/chrome/browser/bookmarks/bookmark_model_unittest.cc index 21e8bb2..5c788e2 100644 --- a/chrome/browser/bookmarks/bookmark_model_unittest.cc +++ b/chrome/browser/bookmarks/bookmark_model_unittest.cc @@ -315,11 +315,11 @@ TEST_F(BookmarkModelTest, Move) { TEST_F(BookmarkModelTest, Copy) { const BookmarkNode* root = model.GetBookmarkBarNode(); - static const std::wstring model_string(L"a 1:[ b c ] d 2:[ e f g ] h "); + static const std::string model_string("a 1:[ b c ] d 2:[ e f g ] h "); model_test_utils::AddNodesFromModelString(model, root, model_string); // Validate initial model. - std::wstring actualModelString = model_test_utils::ModelStringFromNode(root); + std::string actualModelString = model_test_utils::ModelStringFromNode(root); EXPECT_EQ(model_string, actualModelString); // Copy 'd' to be after '1:b': URL item from bar to folder. @@ -327,43 +327,43 @@ TEST_F(BookmarkModelTest, Copy) { const BookmarkNode* destination = root->GetChild(1); model.Copy(nodeToCopy, destination, 1); actualModelString = model_test_utils::ModelStringFromNode(root); - EXPECT_EQ(L"a 1:[ b d c ] d 2:[ e f g ] h ", actualModelString); + EXPECT_EQ("a 1:[ b d c ] d 2:[ e f g ] h ", actualModelString); // Copy '1:d' to be after 'a': URL item from folder to bar. const BookmarkNode* group = root->GetChild(1); nodeToCopy = group->GetChild(1); model.Copy(nodeToCopy, root, 1); actualModelString = model_test_utils::ModelStringFromNode(root); - EXPECT_EQ(L"a d 1:[ b d c ] d 2:[ e f g ] h ", actualModelString); + EXPECT_EQ("a d 1:[ b d c ] d 2:[ e f g ] h ", actualModelString); // Copy '1' to be after '2:e': Folder from bar to folder. nodeToCopy = root->GetChild(2); destination = root->GetChild(4); model.Copy(nodeToCopy, destination, 1); actualModelString = model_test_utils::ModelStringFromNode(root); - EXPECT_EQ(L"a d 1:[ b d c ] d 2:[ e 1:[ b d c ] f g ] h ", actualModelString); + EXPECT_EQ("a d 1:[ b d c ] d 2:[ e 1:[ b d c ] f g ] h ", actualModelString); // Copy '2:1' to be after '2:f': Folder within same folder. group = root->GetChild(4); nodeToCopy = group->GetChild(1); model.Copy(nodeToCopy, group, 3); actualModelString = model_test_utils::ModelStringFromNode(root); - EXPECT_EQ(L"a d 1:[ b d c ] d 2:[ e 1:[ b d c ] f 1:[ b d c ] g ] h ", + EXPECT_EQ("a d 1:[ b d c ] d 2:[ e 1:[ b d c ] f 1:[ b d c ] g ] h ", actualModelString); // Copy first 'd' to be after 'h': URL item within the bar. nodeToCopy = root->GetChild(1); model.Copy(nodeToCopy, root, 6); actualModelString = model_test_utils::ModelStringFromNode(root); - EXPECT_EQ(L"a d 1:[ b d c ] d 2:[ e 1:[ b d c ] f 1:[ b d c ] g ] h d ", + EXPECT_EQ("a d 1:[ b d c ] d 2:[ e 1:[ b d c ] f 1:[ b d c ] g ] h d ", actualModelString); // Copy '2' to be after 'a': Folder within the bar. nodeToCopy = root->GetChild(4); model.Copy(nodeToCopy, root, 1); actualModelString = model_test_utils::ModelStringFromNode(root); - EXPECT_EQ(L"a 2:[ e 1:[ b d c ] f 1:[ b d c ] g ] d 1:[ b d c ] " - L"d 2:[ e 1:[ b d c ] f 1:[ b d c ] g ] h d ", + EXPECT_EQ("a 2:[ e 1:[ b d c ] f 1:[ b d c ] g ] d 1:[ b d c ] " + "d 2:[ e 1:[ b d c ] f 1:[ b d c ] g ] h d ", actualModelString); } @@ -560,24 +560,24 @@ typedef TreeNodeWithValue<BookmarkNode::Type> TestNode; // Does the work of PopulateNodeFromString. index gives the index of the current // element in description to process. -static void PopulateNodeImpl(const std::vector<std::wstring>& description, +static void PopulateNodeImpl(const std::vector<std::string>& description, size_t* index, TestNode* parent) { while (*index < description.size()) { - const std::wstring& element = description[*index]; + const std::string& element = description[*index]; (*index)++; - if (element == L"[") { + if (element == "[") { // Create a new group and recurse to add all the children. // Groups are given a unique named by way of an ever increasing integer // value. The groups need not have a name, but one is assigned to help // in debugging. static int next_group_id = 1; TestNode* new_node = - new TestNode(UTF8ToWide(base::IntToString(next_group_id++)), + new TestNode(UTF16ToWideHack(base::IntToString16(next_group_id++)), BookmarkNode::FOLDER); parent->Add(parent->GetChildCount(), new_node); PopulateNodeImpl(description, index, new_node); - } else if (element == L"]") { + } else if (element == "]") { // End the current group. return; } else { @@ -588,7 +588,7 @@ static void PopulateNodeImpl(const std::vector<std::wstring>& description, DCHECK(element.find('[') == std::string::npos); DCHECK(element.find(']') == std::string::npos); parent->Add(parent->GetChildCount(), - new TestNode(element, BookmarkNode::URL)); + new TestNode(UTF8ToWide(element), BookmarkNode::URL)); } } } @@ -610,9 +610,9 @@ static void PopulateNodeImpl(const std::vector<std::wstring>& description, // // NOTE: each name must be unique, and groups are assigned a unique title by way // of an increasing integer. -static void PopulateNodeFromString(const std::wstring& description, +static void PopulateNodeFromString(const std::string& description, TestNode* parent) { - std::vector<std::wstring> elements; + std::vector<std::string> elements; size_t index = 0; SplitStringAlongWhitespace(description, &elements); PopulateNodeImpl(elements, &index, parent); @@ -746,17 +746,17 @@ class BookmarkModelTestWithProfile : public testing::Test, TEST_F(BookmarkModelTestWithProfile, CreateAndRestore) { struct TestData { // Structure of the children of the bookmark bar model node. - const std::wstring bbn_contents; + const std::string bbn_contents; // Structure of the children of the other node. - const std::wstring other_contents; + const std::string other_contents; } data[] = { // See PopulateNodeFromString for a description of these strings. - { L"", L"" }, - { L"a", L"b" }, - { L"a [ b ]", L"" }, - { L"", L"[ b ] a [ c [ d e [ f ] ] ]" }, - { L"a [ b ]", L"" }, - { L"a b c [ d e [ f ] ]", L"g h i [ j k [ l ] ]"}, + { "", "" }, + { "a", "b" }, + { "a [ b ]", "" }, + { "", "[ b ] a [ c [ d e [ f ] ] ]" }, + { "a [ b ]", "" }, + { "a b c [ d e [ f ] ]", "g h i [ j k [ l ] ]"}, }; for (size_t i = 0; i < ARRAYSIZE_UNSAFE(data); ++i) { // Recreate the profile. We need to reset with NULL first so that the last @@ -959,7 +959,7 @@ TEST_F(BookmarkModelTest, Sort) { // Populate the bookmark bar node with nodes for 'B', 'a', 'd' and 'C'. // 'C' and 'a' are folders. TestNode bbn; - PopulateNodeFromString(L"B [ a ] d [ a ]", &bbn); + PopulateNodeFromString("B [ a ] d [ a ]", &bbn); const BookmarkNode* parent = model.GetBookmarkBarNode(); PopulateBookmarkNode(&bbn, &model, parent); |