Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Side by Side Diff: chrome/browser/bookmarks/bookmark_model_unittest.cc

Issue 5004002: base: Move StringSplitAlongWhitespace to string_split.h (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: unittests Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/string_util_unittest.cc ('k') | chrome/browser/history/top_sites_database.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <set> 5 #include <set>
6 6
7 #include "app/tree_node_iterator.h" 7 #include "app/tree_node_iterator.h"
8 #include "app/tree_node_model.h" 8 #include "app/tree_node_model.h"
9 #include "base/base_paths.h" 9 #include "base/base_paths.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
11 #include "base/hash_tables.h" 11 #include "base/hash_tables.h"
12 #include "base/path_service.h" 12 #include "base/path_service.h"
13 #include "base/string16.h" 13 #include "base/string16.h"
14 #include "base/string_number_conversions.h" 14 #include "base/string_number_conversions.h"
15 #include "base/string_split.h"
15 #include "base/string_util.h" 16 #include "base/string_util.h"
16 #include "base/utf_string_conversions.h" 17 #include "base/utf_string_conversions.h"
17 #include "chrome/browser/bookmarks/bookmark_codec.h" 18 #include "chrome/browser/bookmarks/bookmark_codec.h"
18 #include "chrome/browser/bookmarks/bookmark_model.h" 19 #include "chrome/browser/bookmarks/bookmark_model.h"
19 #include "chrome/browser/bookmarks/bookmark_utils.h" 20 #include "chrome/browser/bookmarks/bookmark_utils.h"
20 #include "chrome/browser/browser_thread.h" 21 #include "chrome/browser/browser_thread.h"
21 #include "chrome/browser/history/history_notifications.h" 22 #include "chrome/browser/history/history_notifications.h"
22 #include "chrome/common/chrome_constants.h" 23 #include "chrome/common/chrome_constants.h"
23 #include "chrome/common/chrome_paths.h" 24 #include "chrome/common/chrome_paths.h"
24 #include "chrome/common/notification_registrar.h" 25 #include "chrome/common/notification_registrar.h"
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 // In words: a node of type URL with the title a, followed by a group node with 615 // In words: a node of type URL with the title a, followed by a group node with
615 // the title 1 having the single child of type url with name b, followed by 616 // the title 1 having the single child of type url with name b, followed by
616 // the url node with the title c. 617 // the url node with the title c.
617 // 618 //
618 // NOTE: each name must be unique, and groups are assigned a unique title by way 619 // NOTE: each name must be unique, and groups are assigned a unique title by way
619 // of an increasing integer. 620 // of an increasing integer.
620 static void PopulateNodeFromString(const std::string& description, 621 static void PopulateNodeFromString(const std::string& description,
621 TestNode* parent) { 622 TestNode* parent) {
622 std::vector<std::string> elements; 623 std::vector<std::string> elements;
623 size_t index = 0; 624 size_t index = 0;
624 SplitStringAlongWhitespace(description, &elements); 625 base::SplitStringAlongWhitespace(description, &elements);
625 PopulateNodeImpl(elements, &index, parent); 626 PopulateNodeImpl(elements, &index, parent);
626 } 627 }
627 628
628 // Populates the BookmarkNode with the children of parent. 629 // Populates the BookmarkNode with the children of parent.
629 static void PopulateBookmarkNode(TestNode* parent, 630 static void PopulateBookmarkNode(TestNode* parent,
630 BookmarkModel* model, 631 BookmarkModel* model,
631 const BookmarkNode* bb_node) { 632 const BookmarkNode* bb_node) {
632 for (int i = 0; i < parent->GetChildCount(); ++i) { 633 for (int i = 0; i < parent->GetChildCount(); ++i) {
633 TestNode* child = parent->GetChild(i); 634 TestNode* child = parent->GetChild(i);
634 if (child->value == BookmarkNode::FOLDER) { 635 if (child->value == BookmarkNode::FOLDER) {
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
983 // Make sure we were notified. 984 // Make sure we were notified.
984 AssertObserverCount(0, 0, 0, 0, 1); 985 AssertObserverCount(0, 0, 0, 0, 1);
985 986
986 // Make sure the order matches (remember, 'a' and 'C' are folders and 987 // Make sure the order matches (remember, 'a' and 'C' are folders and
987 // come first). 988 // come first).
988 EXPECT_EQ(parent->GetChild(0)->GetTitle(), ASCIIToUTF16("a")); 989 EXPECT_EQ(parent->GetChild(0)->GetTitle(), ASCIIToUTF16("a"));
989 EXPECT_EQ(parent->GetChild(1)->GetTitle(), ASCIIToUTF16("C")); 990 EXPECT_EQ(parent->GetChild(1)->GetTitle(), ASCIIToUTF16("C"));
990 EXPECT_EQ(parent->GetChild(2)->GetTitle(), ASCIIToUTF16("B")); 991 EXPECT_EQ(parent->GetChild(2)->GetTitle(), ASCIIToUTF16("B"));
991 EXPECT_EQ(parent->GetChild(3)->GetTitle(), ASCIIToUTF16("d")); 992 EXPECT_EQ(parent->GetChild(3)->GetTitle(), ASCIIToUTF16("d"));
992 } 993 }
OLDNEW
« no previous file with comments | « base/string_util_unittest.cc ('k') | chrome/browser/history/top_sites_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698