1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/ui/bookmarks/bookmark_editor.h"
7 #include "base/strings/utf_string_conversions.h"
8 #include "testing/gtest/include/gtest/gtest.h"
12 TEST(BookmarkEditorTest
, ApplyEditsWithNoFolderChange
) {
13 BookmarkModel
model(NULL
);
14 const BookmarkNode
* bookmarkbar
= model
.bookmark_bar_node();
15 model
.AddURL(bookmarkbar
, 0, ASCIIToUTF16("url0"), GURL("chrome://newtab"));
16 model
.AddURL(bookmarkbar
, 1, ASCIIToUTF16("url1"), GURL("chrome://newtab"));
19 BookmarkEditor::EditDetails
detail(
20 BookmarkEditor::EditDetails::AddFolder(bookmarkbar
, 1));
21 BookmarkEditor::ApplyEditsWithNoFolderChange(&model
,
24 ASCIIToUTF16("folder0"),
26 EXPECT_EQ(ASCIIToUTF16("folder0"), bookmarkbar
->GetChild(1)->GetTitle());
29 BookmarkEditor::EditDetails
detail(
30 BookmarkEditor::EditDetails::AddFolder(bookmarkbar
, -1));
31 BookmarkEditor::ApplyEditsWithNoFolderChange(&model
,
34 ASCIIToUTF16("folder1"),
36 EXPECT_EQ(ASCIIToUTF16("folder1"), bookmarkbar
->GetChild(3)->GetTitle());
39 BookmarkEditor::EditDetails
detail(
40 BookmarkEditor::EditDetails::AddFolder(bookmarkbar
, 10));
41 BookmarkEditor::ApplyEditsWithNoFolderChange(&model
,
44 ASCIIToUTF16("folder2"),
46 EXPECT_EQ(ASCIIToUTF16("folder2"), bookmarkbar
->GetChild(4)->GetTitle());