OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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 "chrome/browser/ui/bookmarks/bookmark_editor.h" | 5 #include "chrome/browser/ui/bookmarks/bookmark_editor.h" |
6 | 6 |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "components/bookmarks/browser/bookmark_model.h" | 8 #include "components/bookmarks/browser/bookmark_model.h" |
9 #include "components/bookmarks/test/test_bookmark_client.h" | 9 #include "components/bookmarks/test/test_bookmark_client.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
11 | 11 |
12 using base::ASCIIToUTF16; | 12 using base::ASCIIToUTF16; |
13 using bookmarks::BookmarkModel; | 13 using bookmarks::BookmarkModel; |
14 using bookmarks::BookmarkNode; | 14 using bookmarks::BookmarkNode; |
15 | 15 |
16 namespace { | 16 namespace { |
17 | 17 |
18 TEST(BookmarkEditorTest, ApplyEditsWithNoFolderChange) { | 18 TEST(BookmarkEditorTest, ApplyEditsWithNoFolderChange) { |
19 bookmarks::TestBookmarkClient client; | 19 scoped_ptr<BookmarkModel> model(bookmarks::TestBookmarkClient::CreateModel()); |
20 scoped_ptr<BookmarkModel> model(client.CreateModel()); | |
21 const BookmarkNode* bookmarkbar = model->bookmark_bar_node(); | 20 const BookmarkNode* bookmarkbar = model->bookmark_bar_node(); |
22 model->AddURL(bookmarkbar, 0, ASCIIToUTF16("url0"), GURL("chrome://newtab")); | 21 model->AddURL(bookmarkbar, 0, ASCIIToUTF16("url0"), GURL("chrome://newtab")); |
23 model->AddURL(bookmarkbar, 1, ASCIIToUTF16("url1"), GURL("chrome://newtab")); | 22 model->AddURL(bookmarkbar, 1, ASCIIToUTF16("url1"), GURL("chrome://newtab")); |
24 | 23 |
25 { | 24 { |
26 BookmarkEditor::EditDetails detail( | 25 BookmarkEditor::EditDetails detail( |
27 BookmarkEditor::EditDetails::AddFolder(bookmarkbar, 1)); | 26 BookmarkEditor::EditDetails::AddFolder(bookmarkbar, 1)); |
28 BookmarkEditor::ApplyEditsWithNoFolderChange(model.get(), | 27 BookmarkEditor::ApplyEditsWithNoFolderChange(model.get(), |
29 bookmarkbar, | 28 bookmarkbar, |
30 detail, | 29 detail, |
(...skipping 17 matching lines...) Expand all Loading... |
48 BookmarkEditor::ApplyEditsWithNoFolderChange(model.get(), | 47 BookmarkEditor::ApplyEditsWithNoFolderChange(model.get(), |
49 bookmarkbar, | 48 bookmarkbar, |
50 detail, | 49 detail, |
51 ASCIIToUTF16("folder2"), | 50 ASCIIToUTF16("folder2"), |
52 GURL(std::string())); | 51 GURL(std::string())); |
53 EXPECT_EQ(ASCIIToUTF16("folder2"), bookmarkbar->GetChild(4)->GetTitle()); | 52 EXPECT_EQ(ASCIIToUTF16("folder2"), bookmarkbar->GetChild(4)->GetTitle()); |
54 } | 53 } |
55 } | 54 } |
56 | 55 |
57 } // namespace | 56 } // namespace |
OLD | NEW |