Add ICU message format support
[chromium-blink-merge.git] / chrome / browser / ui / bookmarks / bookmark_editor_unittest.cc
blob1f51ee7f947d2960427777febb96aba8cc5a9b27
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 "components/bookmarks/browser/bookmark_model.h"
9 #include "components/bookmarks/test/test_bookmark_client.h"
10 #include "testing/gtest/include/gtest/gtest.h"
12 using base::ASCIIToUTF16;
13 using bookmarks::BookmarkModel;
14 using bookmarks::BookmarkNode;
16 namespace {
18 TEST(BookmarkEditorTest, ApplyEditsWithNoFolderChange) {
19 bookmarks::TestBookmarkClient client;
20 scoped_ptr<BookmarkModel> model(client.CreateModel());
21 const BookmarkNode* bookmarkbar = model->bookmark_bar_node();
22 model->AddURL(bookmarkbar, 0, ASCIIToUTF16("url0"), GURL("chrome://newtab"));
23 model->AddURL(bookmarkbar, 1, ASCIIToUTF16("url1"), GURL("chrome://newtab"));
26 BookmarkEditor::EditDetails detail(
27 BookmarkEditor::EditDetails::AddFolder(bookmarkbar, 1));
28 BookmarkEditor::ApplyEditsWithNoFolderChange(model.get(),
29 bookmarkbar,
30 detail,
31 ASCIIToUTF16("folder0"),
32 GURL(std::string()));
33 EXPECT_EQ(ASCIIToUTF16("folder0"), bookmarkbar->GetChild(1)->GetTitle());
36 BookmarkEditor::EditDetails detail(
37 BookmarkEditor::EditDetails::AddFolder(bookmarkbar, -1));
38 BookmarkEditor::ApplyEditsWithNoFolderChange(model.get(),
39 bookmarkbar,
40 detail,
41 ASCIIToUTF16("folder1"),
42 GURL(std::string()));
43 EXPECT_EQ(ASCIIToUTF16("folder1"), bookmarkbar->GetChild(3)->GetTitle());
46 BookmarkEditor::EditDetails detail(
47 BookmarkEditor::EditDetails::AddFolder(bookmarkbar, 10));
48 BookmarkEditor::ApplyEditsWithNoFolderChange(model.get(),
49 bookmarkbar,
50 detail,
51 ASCIIToUTF16("folder2"),
52 GURL(std::string()));
53 EXPECT_EQ(ASCIIToUTF16("folder2"), bookmarkbar->GetChild(4)->GetTitle());
57 } // namespace