Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Side by Side Diff: chrome/browser/ui/bookmarks/bookmark_ui_utils_desktop_unittest.cc

Issue 1865213004: Convert //chrome/browser/ui from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "base/strings/utf_string_conversions.h" 5 #include "base/strings/utf_string_conversions.h"
6 #include "chrome/browser/ui/bookmarks/bookmark_utils.h" 6 #include "chrome/browser/ui/bookmarks/bookmark_utils.h"
7 #include "chrome/browser/ui/bookmarks/bookmark_utils_desktop.h" 7 #include "chrome/browser/ui/bookmarks/bookmark_utils_desktop.h"
8 #include "chrome/test/base/testing_profile.h" 8 #include "chrome/test/base/testing_profile.h"
9 #include "components/bookmarks/browser/bookmark_model.h" 9 #include "components/bookmarks/browser/bookmark_model.h"
10 #include "components/bookmarks/test/test_bookmark_client.h" 10 #include "components/bookmarks/test/test_bookmark_client.h"
11 #include "content/public/test/test_browser_thread_bundle.h" 11 #include "content/public/test/test_browser_thread_bundle.h"
12 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
13 13
14 using base::ASCIIToUTF16; 14 using base::ASCIIToUTF16;
15 using bookmarks::BookmarkModel; 15 using bookmarks::BookmarkModel;
16 using bookmarks::BookmarkNode; 16 using bookmarks::BookmarkNode;
17 17
18 namespace { 18 namespace {
19 19
20 class BookmarkUIUtilsTest : public testing::Test { 20 class BookmarkUIUtilsTest : public testing::Test {
21 content::TestBrowserThreadBundle thread_bundle_; 21 content::TestBrowserThreadBundle thread_bundle_;
22 }; 22 };
23 23
24 TEST_F(BookmarkUIUtilsTest, HasBookmarkURLs) { 24 TEST_F(BookmarkUIUtilsTest, HasBookmarkURLs) {
25 scoped_ptr<BookmarkModel> model(bookmarks::TestBookmarkClient::CreateModel()); 25 std::unique_ptr<BookmarkModel> model(
26 bookmarks::TestBookmarkClient::CreateModel());
26 27
27 std::vector<const BookmarkNode*> nodes; 28 std::vector<const BookmarkNode*> nodes;
28 29
29 // This tests that |nodes| contains an URL. 30 // This tests that |nodes| contains an URL.
30 const BookmarkNode* page1 = model->AddURL(model->bookmark_bar_node(), 31 const BookmarkNode* page1 = model->AddURL(model->bookmark_bar_node(),
31 0, 32 0,
32 ASCIIToUTF16("Google"), 33 ASCIIToUTF16("Google"),
33 GURL("http://google.com")); 34 GURL("http://google.com"));
34 nodes.push_back(page1); 35 nodes.push_back(page1);
35 EXPECT_TRUE(chrome::HasBookmarkURLs(nodes)); 36 EXPECT_TRUE(chrome::HasBookmarkURLs(nodes));
(...skipping 20 matching lines...) Expand all
56 57
57 const BookmarkNode* subfolder1 = 58 const BookmarkNode* subfolder1 =
58 model->AddFolder(folder1, 0, ASCIIToUTF16("Subfolder1")); 59 model->AddFolder(folder1, 0, ASCIIToUTF16("Subfolder1"));
59 60
60 // Now add the URL to that |subfolder1|. 61 // Now add the URL to that |subfolder1|.
61 model->AddURL(subfolder1, 0, ASCIIToUTF16("BAR"), GURL("http://bar-foo.com")); 62 model->AddURL(subfolder1, 0, ASCIIToUTF16("BAR"), GURL("http://bar-foo.com"));
62 EXPECT_FALSE(chrome::HasBookmarkURLs(nodes)); 63 EXPECT_FALSE(chrome::HasBookmarkURLs(nodes));
63 } 64 }
64 65
65 TEST_F(BookmarkUIUtilsTest, HasBookmarkURLsAllowedInIncognitoMode) { 66 TEST_F(BookmarkUIUtilsTest, HasBookmarkURLsAllowedInIncognitoMode) {
66 scoped_ptr<BookmarkModel> model(bookmarks::TestBookmarkClient::CreateModel()); 67 std::unique_ptr<BookmarkModel> model(
68 bookmarks::TestBookmarkClient::CreateModel());
67 TestingProfile profile; 69 TestingProfile profile;
68 70
69 std::vector<const BookmarkNode*> nodes; 71 std::vector<const BookmarkNode*> nodes;
70 72
71 // This tests that |nodes| contains an disabled-in-incognito URL. 73 // This tests that |nodes| contains an disabled-in-incognito URL.
72 const BookmarkNode* page1 = model->AddURL(model->bookmark_bar_node(), 74 const BookmarkNode* page1 = model->AddURL(model->bookmark_bar_node(),
73 0, 75 0,
74 ASCIIToUTF16("BookmarkManager"), 76 ASCIIToUTF16("BookmarkManager"),
75 GURL("chrome://bookmarks")); 77 GURL("chrome://bookmarks"));
76 nodes.push_back(page1); 78 nodes.push_back(page1);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 116
115 const BookmarkNode* subfolder1 = 117 const BookmarkNode* subfolder1 =
116 model->AddFolder(folder1, 0, ASCIIToUTF16("Subfolder1")); 118 model->AddFolder(folder1, 0, ASCIIToUTF16("Subfolder1"));
117 119
118 // Now add the URL to that |subfolder1|. 120 // Now add the URL to that |subfolder1|.
119 model->AddURL(subfolder1, 0, ASCIIToUTF16("BAR"), GURL("http://bar-foo.com")); 121 model->AddURL(subfolder1, 0, ASCIIToUTF16("BAR"), GURL("http://bar-foo.com"));
120 EXPECT_FALSE(chrome::HasBookmarkURLsAllowedInIncognitoMode(nodes, &profile)); 122 EXPECT_FALSE(chrome::HasBookmarkURLsAllowedInIncognitoMode(nodes, &profile));
121 } 123 }
122 124
123 } // namespace 125 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/ui/bookmarks/bookmark_editor_unittest.cc ('k') | chrome/browser/ui/bookmarks/bookmark_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698