OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "testing/gtest/include/gtest/gtest.h" | 5 #include "testing/gtest/include/gtest/gtest.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 loop_->Quit(); | 134 loop_->Quit(); |
135 } | 135 } |
136 | 136 |
137 private: | 137 private: |
138 MessageLoop* loop_; | 138 MessageLoop* loop_; |
139 DISALLOW_COPY_AND_ASSIGN(BookmarksObserver); | 139 DISALLOW_COPY_AND_ASSIGN(BookmarksObserver); |
140 }; | 140 }; |
141 | 141 |
142 // Tests bookmark_html_writer by populating a BookmarkModel, writing it out by | 142 // Tests bookmark_html_writer by populating a BookmarkModel, writing it out by |
143 // way of bookmark_html_writer, then using the importer to read it back in. | 143 // way of bookmark_html_writer, then using the importer to read it back in. |
144 TEST_F(BookmarkHTMLWriterTest, DISABLED_Test) { | 144 TEST_F(BookmarkHTMLWriterTest, Test) { |
145 MessageLoop message_loop; | 145 MessageLoop message_loop; |
146 ChromeThread fake_ui_thread(ChromeThread::UI, &message_loop); | 146 ChromeThread fake_ui_thread(ChromeThread::UI, &message_loop); |
147 ChromeThread fake_file_thread(ChromeThread::FILE, &message_loop); | 147 ChromeThread fake_file_thread(ChromeThread::FILE, &message_loop); |
148 | 148 |
149 TestingProfile profile; | 149 TestingProfile profile; |
150 profile.CreateHistoryService(true, false); | 150 profile.CreateHistoryService(true, false); |
151 profile.BlockUntilHistoryProcessesPendingRequests(); | 151 profile.BlockUntilHistoryProcessesPendingRequests(); |
152 profile.CreateFaviconService(); | 152 profile.CreateFaviconService(); |
153 profile.CreateBookmarkModel(true); | 153 profile.CreateBookmarkModel(true); |
154 profile.BlockUntilBookmarkModelLoaded(); | 154 profile.BlockUntilBookmarkModelLoaded(); |
(...skipping 24 matching lines...) Expand all Loading... |
179 string16 f3_title = ASCIIToUTF16("F 3"); | 179 string16 f3_title = ASCIIToUTF16("F 3"); |
180 string16 f4_title = ASCIIToUTF16("F4"); | 180 string16 f4_title = ASCIIToUTF16("F4"); |
181 string16 url1_title = ASCIIToUTF16("url 1"); | 181 string16 url1_title = ASCIIToUTF16("url 1"); |
182 string16 url2_title = ASCIIToUTF16("url&2"); | 182 string16 url2_title = ASCIIToUTF16("url&2"); |
183 string16 url3_title = ASCIIToUTF16("url\"3"); | 183 string16 url3_title = ASCIIToUTF16("url\"3"); |
184 string16 url4_title = ASCIIToUTF16("url\"&;"); | 184 string16 url4_title = ASCIIToUTF16("url\"&;"); |
185 GURL url1("http://url1"); | 185 GURL url1("http://url1"); |
186 GURL url1_favicon("http://url1/icon.ico"); | 186 GURL url1_favicon("http://url1/icon.ico"); |
187 GURL url2("http://url2"); | 187 GURL url2("http://url2"); |
188 GURL url3("http://url3"); | 188 GURL url3("http://url3"); |
189 GURL url4("http://\"&;\""); | 189 GURL url4("javascript:alert(\"Hello!\");"); |
190 base::Time t1(base::Time::Now()); | 190 base::Time t1(base::Time::Now()); |
191 base::Time t2(t1 + base::TimeDelta::FromHours(1)); | 191 base::Time t2(t1 + base::TimeDelta::FromHours(1)); |
192 base::Time t3(t1 + base::TimeDelta::FromHours(1)); | 192 base::Time t3(t1 + base::TimeDelta::FromHours(1)); |
193 base::Time t4(t1 + base::TimeDelta::FromHours(1)); | 193 base::Time t4(t1 + base::TimeDelta::FromHours(1)); |
194 const BookmarkNode* f1 = model->AddGroup( | 194 const BookmarkNode* f1 = model->AddGroup( |
195 model->GetBookmarkBarNode(), 0, f1_title); | 195 model->GetBookmarkBarNode(), 0, f1_title); |
196 model->AddURLWithCreationTime(f1, 0, url1_title, url1, t1); | 196 model->AddURLWithCreationTime(f1, 0, url1_title, url1, t1); |
197 profile.GetHistoryService(Profile::EXPLICIT_ACCESS)->AddPage(url1, | 197 profile.GetHistoryService(Profile::EXPLICIT_ACCESS)->AddPage(url1, |
198 history::SOURCE_BROWSED); | 198 history::SOURCE_BROWSED); |
199 profile.GetFaviconService(Profile::EXPLICIT_ACCESS)->SetFavicon(url1, | 199 profile.GetFaviconService(Profile::EXPLICIT_ACCESS)->SetFavicon(url1, |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 bookmark_folder_name, string16(), string16()); | 257 bookmark_folder_name, string16(), string16()); |
258 AssertBookmarkEntryEquals(parsed_bookmarks[3], false, url4, url4_title, t4, | 258 AssertBookmarkEntryEquals(parsed_bookmarks[3], false, url4, url4_title, t4, |
259 bookmark_folder_name, string16(), string16()); | 259 bookmark_folder_name, string16(), string16()); |
260 AssertBookmarkEntryEquals(parsed_bookmarks[4], false, url1, url1_title, t1, | 260 AssertBookmarkEntryEquals(parsed_bookmarks[4], false, url1, url1_title, t1, |
261 string16(), string16(), string16()); | 261 string16(), string16(), string16()); |
262 AssertBookmarkEntryEquals(parsed_bookmarks[5], false, url2, url2_title, t2, | 262 AssertBookmarkEntryEquals(parsed_bookmarks[5], false, url2, url2_title, t2, |
263 string16(), string16(), string16()); | 263 string16(), string16(), string16()); |
264 AssertBookmarkEntryEquals(parsed_bookmarks[6], false, url1, url1_title, t1, | 264 AssertBookmarkEntryEquals(parsed_bookmarks[6], false, url1, url1_title, t1, |
265 f3_title, f4_title, string16()); | 265 f3_title, f4_title, string16()); |
266 } | 266 } |
OLD | NEW |