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 gfx::Image google_bitmap( | 349 scoped_ptr<SkBitmap> 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 |
352 Time time; | 354 Time time; |
353 GURL gurl; | 355 GURL gurl; |
354 backend_->thumbnail_db_->SetPageThumbnail(gurl, row1_id, &google_bitmap, | 356 backend_->thumbnail_db_->SetPageThumbnail(gurl, row1_id, &google_image, |
355 score, time); | 357 score, time); |
356 gfx::Image weewar_bitmap( | 358 scoped_ptr<SkBitmap> weewar_bitmap( |
357 gfx::JPEGCodec::Decode(kWeewarThumbnail, sizeof(kWeewarThumbnail))); | 359 gfx::JPEGCodec::Decode(kWeewarThumbnail, sizeof(kWeewarThumbnail))); |
358 backend_->thumbnail_db_->SetPageThumbnail(gurl, row2_id, &weewar_bitmap, | 360 gfx::Image weewar_image(*weewar_bitmap); |
| 361 backend_->thumbnail_db_->SetPageThumbnail(gurl, row2_id, &weewar_image, |
359 score, time); | 362 score, time); |
360 | 363 |
361 // Star row1. | 364 // Star row1. |
362 bookmark_model_.AddURL( | 365 bookmark_model_.AddURL( |
363 bookmark_model_.bookmark_bar_node(), 0, string16(), row1.url()); | 366 bookmark_model_.bookmark_bar_node(), 0, string16(), row1.url()); |
364 | 367 |
365 // Set full text index for each one. | 368 // Set full text index for each one. |
366 backend_->text_database_->AddPageData(row1.url(), row1_id, visit1_id, | 369 backend_->text_database_->AddPageData(row1.url(), row1_id, visit1_id, |
367 row1.last_visit(), | 370 row1.last_visit(), |
368 UTF8ToUTF16("Title 1"), | 371 UTF8ToUTF16("Title 1"), |
(...skipping 1138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1507 EXPECT_EQ(cur_version, file_version); | 1510 EXPECT_EQ(cur_version, file_version); |
1508 | 1511 |
1509 // Check visit_duration column in visits table is created and set to 0. | 1512 // Check visit_duration column in visits table is created and set to 0. |
1510 s1.Assign(archived_db.GetUniqueStatement( | 1513 s1.Assign(archived_db.GetUniqueStatement( |
1511 "SELECT visit_duration FROM visits LIMIT 1")); | 1514 "SELECT visit_duration FROM visits LIMIT 1")); |
1512 ASSERT_TRUE(s1.Step()); | 1515 ASSERT_TRUE(s1.Step()); |
1513 EXPECT_EQ(0, s1.ColumnInt(0)); | 1516 EXPECT_EQ(0, s1.ColumnInt(0)); |
1514 } | 1517 } |
1515 | 1518 |
1516 } // namespace history | 1519 } // namespace history |
OLD | NEW |