OLD | NEW |
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/browser/bookmarks/bookmark_model.h" | 8 #include "chrome/browser/bookmarks/bookmark_model.h" |
9 #include "chrome/test/base/testing_profile.h" | 9 #include "chrome/test/base/testing_profile.h" |
| 10 #include "content/public/test/test_browser_thread_bundle.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
11 | 12 |
12 #if !defined(OS_ANDROID) && !defined(OS_IOS) | 13 #if !defined(OS_ANDROID) && !defined(OS_IOS) |
13 | 14 |
14 namespace { | 15 namespace { |
15 | 16 |
16 TEST(BookmarkUIUtilsTest, HasBookmarkURLs) { | 17 TEST(BookmarkUIUtilsTest, HasBookmarkURLs) { |
17 BookmarkModel model(NULL); | 18 BookmarkModel model(NULL); |
18 | 19 |
19 std::vector<const BookmarkNode*> nodes; | 20 std::vector<const BookmarkNode*> nodes; |
(...skipping 28 matching lines...) Expand all Loading... |
48 const BookmarkNode* subfolder1 = model.AddFolder(folder1, 0, | 49 const BookmarkNode* subfolder1 = model.AddFolder(folder1, 0, |
49 ASCIIToUTF16("Subfolder1")); | 50 ASCIIToUTF16("Subfolder1")); |
50 | 51 |
51 // Now add the URL to that |subfolder1|. | 52 // Now add the URL to that |subfolder1|. |
52 model.AddURL(subfolder1, 0, ASCIIToUTF16("BAR"), GURL("http://bar-foo.com")); | 53 model.AddURL(subfolder1, 0, ASCIIToUTF16("BAR"), GURL("http://bar-foo.com")); |
53 EXPECT_FALSE(chrome::HasBookmarkURLs(nodes)); | 54 EXPECT_FALSE(chrome::HasBookmarkURLs(nodes)); |
54 } | 55 } |
55 | 56 |
56 TEST(BookmarkUIUtilsTest, HasBookmarkURLsAllowedInIncognitoMode) { | 57 TEST(BookmarkUIUtilsTest, HasBookmarkURLsAllowedInIncognitoMode) { |
57 BookmarkModel model(NULL); | 58 BookmarkModel model(NULL); |
| 59 content::TestBrowserThreadBundle thread_bundle; |
58 TestingProfile profile; | 60 TestingProfile profile; |
59 | 61 |
60 std::vector<const BookmarkNode*> nodes; | 62 std::vector<const BookmarkNode*> nodes; |
61 | 63 |
62 // This tests that |nodes| contains an disabled-in-incognito URL. | 64 // This tests that |nodes| contains an disabled-in-incognito URL. |
63 const BookmarkNode* page1 = model.AddURL(model.bookmark_bar_node(), 0, | 65 const BookmarkNode* page1 = model.AddURL(model.bookmark_bar_node(), 0, |
64 ASCIIToUTF16("BookmarkManager"), | 66 ASCIIToUTF16("BookmarkManager"), |
65 GURL("chrome://bookmarks")); | 67 GURL("chrome://bookmarks")); |
66 nodes.push_back(page1); | 68 nodes.push_back(page1); |
67 EXPECT_FALSE(chrome::HasBookmarkURLsAllowedInIncognitoMode(nodes, &profile)); | 69 EXPECT_FALSE(chrome::HasBookmarkURLsAllowedInIncognitoMode(nodes, &profile)); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 const BookmarkNode* subfolder1 = model.AddFolder(folder1, 0, | 106 const BookmarkNode* subfolder1 = model.AddFolder(folder1, 0, |
105 ASCIIToUTF16("Subfolder1")); | 107 ASCIIToUTF16("Subfolder1")); |
106 | 108 |
107 // Now add the URL to that |subfolder1|. | 109 // Now add the URL to that |subfolder1|. |
108 model.AddURL(subfolder1, 0, ASCIIToUTF16("BAR"), GURL("http://bar-foo.com")); | 110 model.AddURL(subfolder1, 0, ASCIIToUTF16("BAR"), GURL("http://bar-foo.com")); |
109 EXPECT_FALSE(chrome::HasBookmarkURLsAllowedInIncognitoMode(nodes, &profile)); | 111 EXPECT_FALSE(chrome::HasBookmarkURLsAllowedInIncognitoMode(nodes, &profile)); |
110 } | 112 } |
111 | 113 |
112 } // namespace | 114 } // namespace |
113 #endif | 115 #endif |
OLD | NEW |