NaCl: Update revision in DEPS, r12770 -> r12773
[chromium-blink-merge.git] / chrome / browser / ui / bookmarks / bookmark_editor_unittest.cc
blob7d2d504e21997ce674f454cfebc6e919a6db70f0
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;
12 namespace {
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,
24 bookmarkbar,
25 detail,
26 ASCIIToUTF16("folder0"),
27 GURL(std::string()));
28 EXPECT_EQ(ASCIIToUTF16("folder0"), bookmarkbar->GetChild(1)->GetTitle());
31 BookmarkEditor::EditDetails detail(
32 BookmarkEditor::EditDetails::AddFolder(bookmarkbar, -1));
33 BookmarkEditor::ApplyEditsWithNoFolderChange(&model,
34 bookmarkbar,
35 detail,
36 ASCIIToUTF16("folder1"),
37 GURL(std::string()));
38 EXPECT_EQ(ASCIIToUTF16("folder1"), bookmarkbar->GetChild(3)->GetTitle());
41 BookmarkEditor::EditDetails detail(
42 BookmarkEditor::EditDetails::AddFolder(bookmarkbar, 10));
43 BookmarkEditor::ApplyEditsWithNoFolderChange(&model,
44 bookmarkbar,
45 detail,
46 ASCIIToUTF16("folder2"),
47 GURL(std::string()));
48 EXPECT_EQ(ASCIIToUTF16("folder2"), bookmarkbar->GetChild(4)->GetTitle());
52 } // namespace