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

Side by Side Diff: chrome/browser/views/bookmark_editor_view_unittest.cc

Issue 165031: When we create a new folder in the BookmarkEditor, it is useful to be able to... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 4 months 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 | « chrome/browser/views/bookmark_editor_view.cc ('k') | no next file » | 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "base/string_util.h" 5 #include "base/string_util.h"
6 #include "chrome/browser/bookmarks/bookmark_model.h" 6 #include "chrome/browser/bookmarks/bookmark_model.h"
7 #include "chrome/browser/profile.h" 7 #include "chrome/browser/profile.h"
8 #include "chrome/browser/views/bookmark_editor_view.h" 8 #include "chrome/browser/views/bookmark_editor_view.h"
9 #include "chrome/common/pref_names.h" 9 #include "chrome/common/pref_names.h"
10 #include "chrome/common/pref_service.h" 10 #include "chrome/common/pref_service.h"
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 254
255 editor.ApplyEdits(NULL); 255 editor.ApplyEdits(NULL);
256 256
257 const BookmarkNode* other_node = profile_->GetBookmarkModel()->other_node(); 257 const BookmarkNode* other_node = profile_->GetBookmarkModel()->other_node();
258 ASSERT_EQ(2, other_node->GetChildCount()); 258 ASSERT_EQ(2, other_node->GetChildCount());
259 259
260 const BookmarkNode* new_node = other_node->GetChild(0); 260 const BookmarkNode* new_node = other_node->GetChild(0);
261 261
262 EXPECT_EQ(L"new_a", new_node->GetTitle()); 262 EXPECT_EQ(L"new_a", new_node->GetTitle());
263 } 263 }
264
265 // Creates a new group in the tree model and deletes its node from the model.
266 // Deletion applies to the tree model and is only used to remove newly created
267 // groups.
268 TEST_F(BookmarkEditorViewTest, ApplyDeleteNewNode) {
269 BookmarkEditorView editor(profile_.get(), NULL, GetNode("a"),
270 BookmarkEditorView::SHOW_TREE, NULL);
271
272 // Create node "F21" as a child of "F2"
273 BookmarkEditorView::EditorNode* f2 =
274 editor.tree_model_->GetRoot()->GetChild(0)->GetChild(1);
275
276 ASSERT_EQ(0, f2->GetChildCount());
277
278 BookmarkEditorView::EditorNode* f21 = editor.AddNewGroup(f2);
279 f21->SetTitle(L"F21");
280 f21->value = 1000;
281
282 BookmarkEditorView::EditorNode* find_node =
283 editor.FindNodeWithID(editor.tree_model_->GetRoot(), 1000);
284
285 EXPECT_EQ(L"F21", find_node->GetTitle());
286 ASSERT_EQ(f2->GetChildCount(), 1);
287
288 editor.ApplyDelete(reinterpret_cast<TreeModelNode*>(f21));
289
290 find_node = editor.FindNodeWithID(editor.tree_model_->GetRoot(), 1000);
291
292 ASSERT_EQ(0, f2->GetChildCount());
293 ASSERT_EQ(NULL, find_node);
294 }
295
OLDNEW
« no previous file with comments | « chrome/browser/views/bookmark_editor_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698