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

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

Issue 1086733002: Ensure tests have an active task runner (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 5 years, 7 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 "chrome/browser/ui/bookmarks/bookmark_utils.h" 5 #include "chrome/browser/ui/bookmarks/bookmark_utils.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.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 "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
12 13
13 #if !defined(OS_ANDROID) && !defined(OS_IOS) 14 #if !defined(OS_ANDROID) && !defined(OS_IOS)
14 15
15 using base::ASCIIToUTF16; 16 using base::ASCIIToUTF16;
16 using bookmarks::BookmarkModel; 17 using bookmarks::BookmarkModel;
17 using bookmarks::BookmarkNode; 18 using bookmarks::BookmarkNode;
18 19
19 namespace { 20 namespace {
20 21
21 TEST(BookmarkUIUtilsTest, HasBookmarkURLs) { 22 class BookmarkUIUtilsTest : public testing::Test {
23 content::TestBrowserThreadBundle thread_bundle_;
24 };
25
26 TEST_F(BookmarkUIUtilsTest, HasBookmarkURLs) {
22 bookmarks::TestBookmarkClient client; 27 bookmarks::TestBookmarkClient client;
23 scoped_ptr<BookmarkModel> model(client.CreateModel()); 28 scoped_ptr<BookmarkModel> model(client.CreateModel());
24 29
25 std::vector<const BookmarkNode*> nodes; 30 std::vector<const BookmarkNode*> nodes;
26 31
27 // This tests that |nodes| contains an URL. 32 // This tests that |nodes| contains an URL.
28 const BookmarkNode* page1 = model->AddURL(model->bookmark_bar_node(), 33 const BookmarkNode* page1 = model->AddURL(model->bookmark_bar_node(),
29 0, 34 0,
30 ASCIIToUTF16("Google"), 35 ASCIIToUTF16("Google"),
31 GURL("http://google.com")); 36 GURL("http://google.com"));
(...skipping 21 matching lines...) Expand all
53 model->Remove(folder1, 0); 58 model->Remove(folder1, 0);
54 59
55 const BookmarkNode* subfolder1 = 60 const BookmarkNode* subfolder1 =
56 model->AddFolder(folder1, 0, ASCIIToUTF16("Subfolder1")); 61 model->AddFolder(folder1, 0, ASCIIToUTF16("Subfolder1"));
57 62
58 // Now add the URL to that |subfolder1|. 63 // Now add the URL to that |subfolder1|.
59 model->AddURL(subfolder1, 0, ASCIIToUTF16("BAR"), GURL("http://bar-foo.com")); 64 model->AddURL(subfolder1, 0, ASCIIToUTF16("BAR"), GURL("http://bar-foo.com"));
60 EXPECT_FALSE(chrome::HasBookmarkURLs(nodes)); 65 EXPECT_FALSE(chrome::HasBookmarkURLs(nodes));
61 } 66 }
62 67
63 TEST(BookmarkUIUtilsTest, HasBookmarkURLsAllowedInIncognitoMode) { 68 TEST_F(BookmarkUIUtilsTest, HasBookmarkURLsAllowedInIncognitoMode) {
64 bookmarks::TestBookmarkClient client; 69 bookmarks::TestBookmarkClient client;
65 scoped_ptr<BookmarkModel> model(client.CreateModel()); 70 scoped_ptr<BookmarkModel> model(client.CreateModel());
66 TestingProfile profile; 71 TestingProfile profile;
67 72
68 std::vector<const BookmarkNode*> nodes; 73 std::vector<const BookmarkNode*> nodes;
69 74
70 // This tests that |nodes| contains an disabled-in-incognito URL. 75 // This tests that |nodes| contains an disabled-in-incognito URL.
71 const BookmarkNode* page1 = model->AddURL(model->bookmark_bar_node(), 76 const BookmarkNode* page1 = model->AddURL(model->bookmark_bar_node(),
72 0, 77 0,
73 ASCIIToUTF16("BookmarkManager"), 78 ASCIIToUTF16("BookmarkManager"),
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 const BookmarkNode* subfolder1 = 119 const BookmarkNode* subfolder1 =
115 model->AddFolder(folder1, 0, ASCIIToUTF16("Subfolder1")); 120 model->AddFolder(folder1, 0, ASCIIToUTF16("Subfolder1"));
116 121
117 // Now add the URL to that |subfolder1|. 122 // Now add the URL to that |subfolder1|.
118 model->AddURL(subfolder1, 0, ASCIIToUTF16("BAR"), GURL("http://bar-foo.com")); 123 model->AddURL(subfolder1, 0, ASCIIToUTF16("BAR"), GURL("http://bar-foo.com"));
119 EXPECT_FALSE(chrome::HasBookmarkURLsAllowedInIncognitoMode(nodes, &profile)); 124 EXPECT_FALSE(chrome::HasBookmarkURLsAllowedInIncognitoMode(nodes, &profile));
120 } 125 }
121 126
122 } // namespace 127 } // namespace
123 #endif 128 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698