Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(321)

Side by Side Diff: chrome/browser/history/history_backend_unittest.cc

Issue 243076: Move the JPEG and PNG codecs from base/gfx to app/gfx/codec. Move the classes... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "app/gfx/codec/jpeg_codec.h"
5 #include "base/file_path.h" 6 #include "base/file_path.h"
6 #include "base/file_util.h" 7 #include "base/file_util.h"
7 #include "base/gfx/jpeg_codec.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "base/scoped_ptr.h" 9 #include "base/scoped_ptr.h"
10 #include "chrome/browser/bookmarks/bookmark_model.h" 10 #include "chrome/browser/bookmarks/bookmark_model.h"
11 #include "chrome/browser/history/history_backend.h" 11 #include "chrome/browser/history/history_backend.h"
12 #include "chrome/browser/history/in_memory_history_backend.h" 12 #include "chrome/browser/history/in_memory_history_backend.h"
13 #include "chrome/browser/history/in_memory_database.h" 13 #include "chrome/browser/history/in_memory_database.h"
14 #include "chrome/common/notification_service.h" 14 #include "chrome/common/notification_service.h"
15 #include "chrome/common/thumbnail_score.h" 15 #include "chrome/common/thumbnail_score.h"
16 #include "chrome/tools/profiles/thumbnail-inl.h" 16 #include "chrome/tools/profiles/thumbnail-inl.h"
17 #include "googleurl/src/gurl.h" 17 #include "googleurl/src/gurl.h"
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 224
225 // The in-memory backend should have been set and it should have gotten the 225 // The in-memory backend should have been set and it should have gotten the
226 // typed URL. 226 // typed URL.
227 ASSERT_TRUE(mem_backend_.get()); 227 ASSERT_TRUE(mem_backend_.get());
228 URLRow outrow1; 228 URLRow outrow1;
229 EXPECT_TRUE(mem_backend_->db_->GetRowForURL(row1.url(), NULL)); 229 EXPECT_TRUE(mem_backend_->db_->GetRowForURL(row1.url(), NULL));
230 230
231 // Add thumbnails for each page. 231 // Add thumbnails for each page.
232 ThumbnailScore score(0.25, true, true); 232 ThumbnailScore score(0.25, true, true);
233 scoped_ptr<SkBitmap> google_bitmap( 233 scoped_ptr<SkBitmap> google_bitmap(
234 JPEGCodec::Decode(kGoogleThumbnail, sizeof(kGoogleThumbnail))); 234 gfx::JPEGCodec::Decode(kGoogleThumbnail, sizeof(kGoogleThumbnail)));
235 235
236 Time time; 236 Time time;
237 GURL gurl; 237 GURL gurl;
238 backend_->thumbnail_db_->SetPageThumbnail(gurl, row1_id, *google_bitmap, 238 backend_->thumbnail_db_->SetPageThumbnail(gurl, row1_id, *google_bitmap,
239 score, time); 239 score, time);
240 scoped_ptr<SkBitmap> weewar_bitmap( 240 scoped_ptr<SkBitmap> weewar_bitmap(
241 JPEGCodec::Decode(kWeewarThumbnail, sizeof(kWeewarThumbnail))); 241 gfx::JPEGCodec::Decode(kWeewarThumbnail, sizeof(kWeewarThumbnail)));
242 backend_->thumbnail_db_->SetPageThumbnail(gurl, row2_id, *weewar_bitmap, 242 backend_->thumbnail_db_->SetPageThumbnail(gurl, row2_id, *weewar_bitmap,
243 score, time); 243 score, time);
244 244
245 // Star row1. 245 // Star row1.
246 bookmark_model_.AddURL( 246 bookmark_model_.AddURL(
247 bookmark_model_.GetBookmarkBarNode(), 0, std::wstring(), row1.url()); 247 bookmark_model_.GetBookmarkBarNode(), 0, std::wstring(), row1.url());
248 248
249 // Set full text index for each one. 249 // Set full text index for each one.
250 backend_->text_database_->AddPageData(row1.url(), row1_id, visit1_id, 250 backend_->text_database_->AddPageData(row1.url(), row1_id, visit1_id,
251 row1.last_visit(), 251 row1.last_visit(),
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 const char* thumbnail_url = "http://mail.google.com"; 398 const char* thumbnail_url = "http://mail.google.com";
399 const char* first_chain[] = { 399 const char* first_chain[] = {
400 base_url, 400 base_url,
401 thumbnail_url, 401 thumbnail_url,
402 NULL 402 NULL
403 }; 403 };
404 AddRedirectChain(first_chain, 0); 404 AddRedirectChain(first_chain, 0);
405 405
406 // Add a thumbnail for the end of that redirect chain. 406 // Add a thumbnail for the end of that redirect chain.
407 scoped_ptr<SkBitmap> thumbnail( 407 scoped_ptr<SkBitmap> thumbnail(
408 JPEGCodec::Decode(kGoogleThumbnail, sizeof(kGoogleThumbnail))); 408 gfx::JPEGCodec::Decode(kGoogleThumbnail, sizeof(kGoogleThumbnail)));
409 backend_->SetPageThumbnail(GURL(thumbnail_url), *thumbnail, 409 backend_->SetPageThumbnail(GURL(thumbnail_url), *thumbnail,
410 ThumbnailScore(0.25, true, true)); 410 ThumbnailScore(0.25, true, true));
411 411
412 // Write a second URL chain so that if you were to simply check what 412 // Write a second URL chain so that if you were to simply check what
413 // "http://mail" redirects to, you wouldn't see the URL that has 413 // "http://mail" redirects to, you wouldn't see the URL that has
414 // contains the thumbnail. 414 // contains the thumbnail.
415 const char* second_chain[] = { 415 const char* second_chain[] = {
416 base_url, 416 base_url,
417 "http://mail.google.com/somewhere/else", 417 "http://mail.google.com/somewhere/else",
418 NULL 418 NULL
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 557
558 // If the URL is bookmarked, it should get added to history with 0 visits. 558 // If the URL is bookmarked, it should get added to history with 0 visits.
559 bookmark_model_.AddURL(bookmark_model_.GetBookmarkBarNode(), 0, 559 bookmark_model_.AddURL(bookmark_model_.GetBookmarkBarNode(), 0,
560 std::wstring(), url3); 560 std::wstring(), url3);
561 backend_->SetImportedFavicons(favicons); 561 backend_->SetImportedFavicons(favicons);
562 EXPECT_FALSE(backend_->db_->GetRowForURL(url3, &url_row3) == 0); 562 EXPECT_FALSE(backend_->db_->GetRowForURL(url3, &url_row3) == 0);
563 EXPECT_TRUE(url_row3.visit_count() == 0); 563 EXPECT_TRUE(url_row3.visit_count() == 0);
564 } 564 }
565 565
566 } // namespace history 566 } // namespace history
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698