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 <set> | 5 #include <set> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 | 339 |
340 // The in-memory backend should have been set and it should have gotten the | 340 // The in-memory backend should have been set and it should have gotten the |
341 // typed URL. | 341 // typed URL. |
342 ASSERT_TRUE(mem_backend_.get()); | 342 ASSERT_TRUE(mem_backend_.get()); |
343 URLRow outrow1; | 343 URLRow outrow1; |
344 EXPECT_TRUE(mem_backend_->db_->GetRowForURL(row1.url(), NULL)); | 344 EXPECT_TRUE(mem_backend_->db_->GetRowForURL(row1.url(), NULL)); |
345 | 345 |
346 // Add thumbnails for each page. The |Images| take ownership of SkBitmap | 346 // Add thumbnails for each page. The |Images| take ownership of SkBitmap |
347 // created from decoding the images. | 347 // created from decoding the images. |
348 ThumbnailScore score(0.25, true, true); | 348 ThumbnailScore score(0.25, true, true); |
349 scoped_ptr<SkBitmap> google_bitmap( | 349 gfx::Image google_bitmap( |
350 gfx::JPEGCodec::Decode(kGoogleThumbnail, sizeof(kGoogleThumbnail))); | 350 gfx::JPEGCodec::Decode(kGoogleThumbnail, sizeof(kGoogleThumbnail))); |
351 | 351 |
352 gfx::Image google_image(*google_bitmap); | |
353 | |
354 Time time; | 352 Time time; |
355 GURL gurl; | 353 GURL gurl; |
356 backend_->thumbnail_db_->SetPageThumbnail(gurl, row1_id, &google_image, | 354 backend_->thumbnail_db_->SetPageThumbnail(gurl, row1_id, &google_bitmap, |
357 score, time); | 355 score, time); |
358 scoped_ptr<SkBitmap> weewar_bitmap( | 356 gfx::Image weewar_bitmap( |
359 gfx::JPEGCodec::Decode(kWeewarThumbnail, sizeof(kWeewarThumbnail))); | 357 gfx::JPEGCodec::Decode(kWeewarThumbnail, sizeof(kWeewarThumbnail))); |
360 gfx::Image weewar_image(*weewar_bitmap); | 358 backend_->thumbnail_db_->SetPageThumbnail(gurl, row2_id, &weewar_bitmap, |
361 backend_->thumbnail_db_->SetPageThumbnail(gurl, row2_id, &weewar_image, | |
362 score, time); | 359 score, time); |
363 | 360 |
364 // Star row1. | 361 // Star row1. |
365 bookmark_model_.AddURL( | 362 bookmark_model_.AddURL( |
366 bookmark_model_.bookmark_bar_node(), 0, string16(), row1.url()); | 363 bookmark_model_.bookmark_bar_node(), 0, string16(), row1.url()); |
367 | 364 |
368 // Set full text index for each one. | 365 // Set full text index for each one. |
369 backend_->text_database_->AddPageData(row1.url(), row1_id, visit1_id, | 366 backend_->text_database_->AddPageData(row1.url(), row1_id, visit1_id, |
370 row1.last_visit(), | 367 row1.last_visit(), |
371 UTF8ToUTF16("Title 1"), | 368 UTF8ToUTF16("Title 1"), |
(...skipping 1138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1510 EXPECT_EQ(cur_version, file_version); | 1507 EXPECT_EQ(cur_version, file_version); |
1511 | 1508 |
1512 // Check visit_duration column in visits table is created and set to 0. | 1509 // Check visit_duration column in visits table is created and set to 0. |
1513 s1.Assign(archived_db.GetUniqueStatement( | 1510 s1.Assign(archived_db.GetUniqueStatement( |
1514 "SELECT visit_duration FROM visits LIMIT 1")); | 1511 "SELECT visit_duration FROM visits LIMIT 1")); |
1515 ASSERT_TRUE(s1.Step()); | 1512 ASSERT_TRUE(s1.Step()); |
1516 EXPECT_EQ(0, s1.ColumnInt(0)); | 1513 EXPECT_EQ(0, s1.ColumnInt(0)); |
1517 } | 1514 } |
1518 | 1515 |
1519 } // namespace history | 1516 } // namespace history |
OLD | NEW |