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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/strings/utf_string_conversions.h" | 6 #include "base/strings/utf_string_conversions.h" |
7 #include "base/timer/timer.h" | 7 #include "base/timer/timer.h" |
8 #include "chrome/app/chrome_command_ids.h" | 8 #include "chrome/app/chrome_command_ids.h" |
9 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 9 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 #if defined(THREAD_SANITIZER) | 88 #if defined(THREAD_SANITIZER) |
89 // BookmarkBrowsertest.Persist fails under ThreadSanitizer on Linux, see | 89 // BookmarkBrowsertest.Persist fails under ThreadSanitizer on Linux, see |
90 // http://crbug.com/340223. | 90 // http://crbug.com/340223. |
91 #define MAYBE_Persist DISABLED_Persist | 91 #define MAYBE_Persist DISABLED_Persist |
92 #else | 92 #else |
93 #define MAYBE_Persist Persist | 93 #define MAYBE_Persist Persist |
94 #endif | 94 #endif |
95 IN_PROC_BROWSER_TEST_F(BookmarkBrowsertest, MAYBE_Persist) { | 95 IN_PROC_BROWSER_TEST_F(BookmarkBrowsertest, MAYBE_Persist) { |
96 BookmarkModel* bookmark_model = WaitForBookmarkModel(browser()->profile()); | 96 BookmarkModel* bookmark_model = WaitForBookmarkModel(browser()->profile()); |
97 | 97 |
98 std::vector<BookmarkService::URLAndTitle> urls; | 98 std::vector<BookmarkModel::URLAndTitle> urls; |
99 bookmark_model->GetBookmarks(&urls); | 99 bookmark_model->GetBookmarks(&urls); |
100 | 100 |
101 ASSERT_EQ(1u, urls.size()); | 101 ASSERT_EQ(1u, urls.size()); |
102 ASSERT_EQ(GURL(kPersistBookmarkURL), urls[0].url); | 102 ASSERT_EQ(GURL(kPersistBookmarkURL), urls[0].url); |
103 ASSERT_EQ(base::ASCIIToUTF16(kPersistBookmarkTitle), urls[0].title); | 103 ASSERT_EQ(base::ASCIIToUTF16(kPersistBookmarkTitle), urls[0].title); |
104 } | 104 } |
105 | 105 |
106 #if !defined(OS_CHROMEOS) // No multi-profile on ChromeOS. | 106 #if !defined(OS_CHROMEOS) // No multi-profile on ChromeOS. |
107 | 107 |
108 // Sanity check that bookmarks from different profiles are separate. | 108 // Sanity check that bookmarks from different profiles are separate. |
109 // DISABLED_ because it regularly times out: http://crbug.com/159002. | 109 // DISABLED_ because it regularly times out: http://crbug.com/159002. |
110 IN_PROC_BROWSER_TEST_F(BookmarkBrowsertest, DISABLED_MultiProfile) { | 110 IN_PROC_BROWSER_TEST_F(BookmarkBrowsertest, DISABLED_MultiProfile) { |
111 base::ScopedTempDir temp_dir; | 111 base::ScopedTempDir temp_dir; |
112 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); | 112 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); |
113 | 113 |
114 BookmarkModel* bookmark_model1 = WaitForBookmarkModel(browser()->profile()); | 114 BookmarkModel* bookmark_model1 = WaitForBookmarkModel(browser()->profile()); |
115 | 115 |
116 ui_test_utils::BrowserAddedObserver observer; | 116 ui_test_utils::BrowserAddedObserver observer; |
117 g_browser_process->profile_manager()->CreateMultiProfileAsync( | 117 g_browser_process->profile_manager()->CreateMultiProfileAsync( |
118 base::string16(), base::string16(), ProfileManager::CreateCallback(), | 118 base::string16(), base::string16(), ProfileManager::CreateCallback(), |
119 std::string()); | 119 std::string()); |
120 Browser* browser2 = observer.WaitForSingleNewBrowser(); | 120 Browser* browser2 = observer.WaitForSingleNewBrowser(); |
121 BookmarkModel* bookmark_model2 = WaitForBookmarkModel(browser2->profile()); | 121 BookmarkModel* bookmark_model2 = WaitForBookmarkModel(browser2->profile()); |
122 | 122 |
123 bookmark_utils::AddIfNotBookmarked( | 123 bookmark_utils::AddIfNotBookmarked( |
124 bookmark_model1, GURL(kPersistBookmarkURL), | 124 bookmark_model1, GURL(kPersistBookmarkURL), |
125 base::ASCIIToUTF16(kPersistBookmarkTitle)); | 125 base::ASCIIToUTF16(kPersistBookmarkTitle)); |
126 std::vector<BookmarkService::URLAndTitle> urls1, urls2; | 126 std::vector<BookmarkModel::URLAndTitle> urls1, urls2; |
127 bookmark_model1->GetBookmarks(&urls1); | 127 bookmark_model1->GetBookmarks(&urls1); |
128 bookmark_model2->GetBookmarks(&urls2); | 128 bookmark_model2->GetBookmarks(&urls2); |
129 ASSERT_EQ(1u, urls1.size()); | 129 ASSERT_EQ(1u, urls1.size()); |
130 ASSERT_TRUE(urls2.empty()); | 130 ASSERT_TRUE(urls2.empty()); |
131 } | 131 } |
132 | 132 |
133 #endif | 133 #endif |
OLD | NEW |