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"
10 using base::ASCIIToUTF16
;
14 TEST(BookmarkEditorTest
, ApplyEditsWithNoFolderChange
) {
15 BookmarkModel
model(NULL
);
16 const BookmarkNode
* bookmarkbar
= model
.bookmark_bar_node();
17 model
.AddURL(bookmarkbar
, 0, ASCIIToUTF16("url0"), GURL("chrome://newtab"));
18 model
.AddURL(bookmarkbar
, 1, ASCIIToUTF16("url1"), GURL("chrome://newtab"));
21 BookmarkEditor::EditDetails
detail(
22 BookmarkEditor::EditDetails::AddFolder(bookmarkbar
, 1));
23 BookmarkEditor::ApplyEditsWithNoFolderChange(&model
,
26 ASCIIToUTF16("folder0"),
28 EXPECT_EQ(ASCIIToUTF16("folder0"), bookmarkbar
->GetChild(1)->GetTitle());
31 BookmarkEditor::EditDetails
detail(
32 BookmarkEditor::EditDetails::AddFolder(bookmarkbar
, -1));
33 BookmarkEditor::ApplyEditsWithNoFolderChange(&model
,
36 ASCIIToUTF16("folder1"),
38 EXPECT_EQ(ASCIIToUTF16("folder1"), bookmarkbar
->GetChild(3)->GetTitle());
41 BookmarkEditor::EditDetails
detail(
42 BookmarkEditor::EditDetails::AddFolder(bookmarkbar
, 10));
43 BookmarkEditor::ApplyEditsWithNoFolderChange(&model
,
46 ASCIIToUTF16("folder2"),
48 EXPECT_EQ(ASCIIToUTF16("folder2"), bookmarkbar
->GetChild(4)->GetTitle());