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 "testing/gtest/include/gtest/gtest.h" | 5 #include "testing/gtest/include/gtest/gtest.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/i18n/time_formatting.h" | 8 #include "base/i18n/time_formatting.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" |
11 #include "base/scoped_temp_dir.h" | 11 #include "base/scoped_temp_dir.h" |
12 #include "base/string16.h" | 12 #include "base/string16.h" |
13 #include "base/string_util.h" | 13 #include "base/string_util.h" |
14 #include "base/time.h" | 14 #include "base/time.h" |
15 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
16 #include "chrome/browser/bookmarks/bookmark_html_writer.h" | 16 #include "chrome/browser/bookmarks/bookmark_html_writer.h" |
17 #include "chrome/browser/bookmarks/bookmark_model.h" | 17 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 18 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
18 #include "chrome/browser/history/history_service_factory.h" | 19 #include "chrome/browser/history/history_service_factory.h" |
19 #include "chrome/browser/importer/firefox2_importer.h" | 20 #include "chrome/browser/importer/firefox2_importer.h" |
20 #include "chrome/test/base/testing_profile.h" | 21 #include "chrome/test/base/testing_profile.h" |
21 #include "content/public/test/test_browser_thread.h" | 22 #include "content/public/test/test_browser_thread.h" |
22 #include "grit/generated_resources.h" | 23 #include "grit/generated_resources.h" |
23 #include "third_party/skia/include/core/SkBitmap.h" | 24 #include "third_party/skia/include/core/SkBitmap.h" |
24 #include "ui/base/l10n/l10n_util.h" | 25 #include "ui/base/l10n/l10n_util.h" |
25 #include "ui/gfx/codec/png_codec.h" | 26 #include "ui/gfx/codec/png_codec.h" |
26 | 27 |
27 using content::BrowserThread; | 28 using content::BrowserThread; |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 content::TestBrowserThread fake_ui_thread(BrowserThread::UI, &message_loop); | 142 content::TestBrowserThread fake_ui_thread(BrowserThread::UI, &message_loop); |
142 content::TestBrowserThread fake_file_thread(BrowserThread::FILE, | 143 content::TestBrowserThread fake_file_thread(BrowserThread::FILE, |
143 &message_loop); | 144 &message_loop); |
144 | 145 |
145 TestingProfile profile; | 146 TestingProfile profile; |
146 profile.CreateHistoryService(true, false); | 147 profile.CreateHistoryService(true, false); |
147 profile.BlockUntilHistoryProcessesPendingRequests(); | 148 profile.BlockUntilHistoryProcessesPendingRequests(); |
148 profile.CreateFaviconService(); | 149 profile.CreateFaviconService(); |
149 profile.CreateBookmarkModel(true); | 150 profile.CreateBookmarkModel(true); |
150 profile.BlockUntilBookmarkModelLoaded(); | 151 profile.BlockUntilBookmarkModelLoaded(); |
151 BookmarkModel* model = profile.GetBookmarkModel(); | 152 BookmarkModel* model = BookmarkModelFactory::GetForProfile(&profile); |
152 | 153 |
153 // Create test PNG representing favicon for url1. | 154 // Create test PNG representing favicon for url1. |
154 SkBitmap bitmap; | 155 SkBitmap bitmap; |
155 MakeTestSkBitmap(kIconWidth, kIconHeight, &bitmap); | 156 MakeTestSkBitmap(kIconWidth, kIconHeight, &bitmap); |
156 std::vector<unsigned char> icon_data; | 157 std::vector<unsigned char> icon_data; |
157 gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, false, &icon_data); | 158 gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, false, &icon_data); |
158 | 159 |
159 // Populate the BookmarkModel. This creates the following bookmark structure: | 160 // Populate the BookmarkModel. This creates the following bookmark structure: |
160 // Bookmarks bar | 161 // Bookmarks bar |
161 // F1 | 162 // F1 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 bookmark_folder_name, string16(), string16()); | 260 bookmark_folder_name, string16(), string16()); |
260 AssertBookmarkEntryEquals(parsed_bookmarks[4], false, url1, url1_title, t1, | 261 AssertBookmarkEntryEquals(parsed_bookmarks[4], false, url1, url1_title, t1, |
261 string16(), string16(), string16()); | 262 string16(), string16(), string16()); |
262 AssertBookmarkEntryEquals(parsed_bookmarks[5], false, url2, url2_title, t2, | 263 AssertBookmarkEntryEquals(parsed_bookmarks[5], false, url2, url2_title, t2, |
263 string16(), string16(), string16()); | 264 string16(), string16(), string16()); |
264 AssertBookmarkEntryEquals(parsed_bookmarks[6], false, url1, url1_title, t1, | 265 AssertBookmarkEntryEquals(parsed_bookmarks[6], false, url1, url1_title, t1, |
265 f3_title, f4_title, string16()); | 266 f3_title, f4_title, string16()); |
266 AssertBookmarkEntryEquals(parsed_bookmarks[7], false, url1, url1_title, t1, | 267 AssertBookmarkEntryEquals(parsed_bookmarks[7], false, url1, url1_title, t1, |
267 string16(), string16(), string16()); | 268 string16(), string16(), string16()); |
268 } | 269 } |
OLD | NEW |