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

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

Issue 7327007: Moving notification types which are chrome specific to a new header file chrome_notification_type... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <string> 5 #include <string>
6 #include <utility> 6 #include <utility>
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/file_path.h" 10 #include "base/file_path.h"
11 #include "base/file_util.h" 11 #include "base/file_util.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/path_service.h" 13 #include "base/path_service.h"
14 #include "base/scoped_temp_dir.h" 14 #include "base/scoped_temp_dir.h"
15 #include "base/string16.h" 15 #include "base/string16.h"
16 #include "base/utf_string_conversions.h" 16 #include "base/utf_string_conversions.h"
17 #include "chrome/browser/bookmarks/bookmark_model.h" 17 #include "chrome/browser/bookmarks/bookmark_model.h"
18 #include "chrome/browser/history/archived_database.h" 18 #include "chrome/browser/history/archived_database.h"
19 #include "chrome/browser/history/expire_history_backend.h" 19 #include "chrome/browser/history/expire_history_backend.h"
20 #include "chrome/browser/history/history_database.h" 20 #include "chrome/browser/history/history_database.h"
21 #include "chrome/browser/history/history_notifications.h" 21 #include "chrome/browser/history/history_notifications.h"
22 #include "chrome/browser/history/text_database_manager.h" 22 #include "chrome/browser/history/text_database_manager.h"
23 #include "chrome/browser/history/thumbnail_database.h" 23 #include "chrome/browser/history/thumbnail_database.h"
24 #include "chrome/browser/history/top_sites.h" 24 #include "chrome/browser/history/top_sites.h"
25 #include "chrome/common/chrome_notification_types.h"
25 #include "chrome/common/thumbnail_score.h" 26 #include "chrome/common/thumbnail_score.h"
26 #include "chrome/test/testing_profile.h" 27 #include "chrome/test/testing_profile.h"
27 #include "chrome/tools/profiles/thumbnail-inl.h" 28 #include "chrome/tools/profiles/thumbnail-inl.h"
28 #include "content/browser/browser_thread.h" 29 #include "content/browser/browser_thread.h"
29 #include "testing/gtest/include/gtest/gtest.h" 30 #include "testing/gtest/include/gtest/gtest.h"
30 #include "third_party/skia/include/core/SkBitmap.h" 31 #include "third_party/skia/include/core/SkBitmap.h"
31 #include "ui/gfx/codec/jpeg_codec.h" 32 #include "ui/gfx/codec/jpeg_codec.h"
32 33
33 using base::Time; 34 using base::Time;
34 using base::TimeDelta; 35 using base::TimeDelta;
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 VisitVector visits; 370 VisitVector visits;
370 main_db_->GetVisitsForURL(row.id(), &visits); 371 main_db_->GetVisitsForURL(row.id(), &visits);
371 EXPECT_EQ(0U, visits.size()); 372 EXPECT_EQ(0U, visits.size());
372 373
373 // Thumbnail should be gone. 374 // Thumbnail should be gone.
374 // TODO(sky): fix this, see comment in HasThumbnail. 375 // TODO(sky): fix this, see comment in HasThumbnail.
375 // EXPECT_FALSE(HasThumbnail(row.id())); 376 // EXPECT_FALSE(HasThumbnail(row.id()));
376 377
377 bool found_delete_notification = false; 378 bool found_delete_notification = false;
378 for (size_t i = 0; i < notifications_.size(); i++) { 379 for (size_t i = 0; i < notifications_.size(); i++) {
379 if (notifications_[i].first == NotificationType::HISTORY_URLS_DELETED) { 380 if (notifications_[i].first == chrome::HISTORY_URLS_DELETED) {
380 const URLsDeletedDetails* deleted_details = 381 const URLsDeletedDetails* deleted_details =
381 reinterpret_cast<URLsDeletedDetails*>(notifications_[i].second); 382 reinterpret_cast<URLsDeletedDetails*>(notifications_[i].second);
382 if (deleted_details->urls.find(row.url()) != 383 if (deleted_details->urls.find(row.url()) !=
383 deleted_details->urls.end()) { 384 deleted_details->urls.end()) {
384 found_delete_notification = true; 385 found_delete_notification = true;
385 } 386 }
386 } else { 387 } else {
387 EXPECT_NE(notifications_[i].first, NotificationType::HISTORY_URL_VISITED); 388 EXPECT_NE(notifications_[i].first, chrome::HISTORY_URL_VISITED);
388 EXPECT_NE(notifications_[i].first, 389 EXPECT_NE(notifications_[i].first,
389 NotificationType::HISTORY_TYPED_URLS_MODIFIED); 390 chrome::HISTORY_TYPED_URLS_MODIFIED);
390 } 391 }
391 } 392 }
392 EXPECT_TRUE(found_delete_notification); 393 EXPECT_TRUE(found_delete_notification);
393 } 394 }
394 395
395 TEST_F(ExpireHistoryTest, DeleteFaviconsIfPossible) { 396 TEST_F(ExpireHistoryTest, DeleteFaviconsIfPossible) {
396 // Add a favicon record. 397 // Add a favicon record.
397 const GURL favicon_url("http://www.google.com/favicon.ico"); 398 const GURL favicon_url("http://www.google.com/favicon.ico");
398 FaviconID icon_id = thumb_db_->AddFavicon(favicon_url, FAVICON); 399 FaviconID icon_id = thumb_db_->AddFavicon(favicon_url, FAVICON);
399 EXPECT_TRUE(icon_id); 400 EXPECT_TRUE(icon_id);
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
910 main_db_->GetVisitsForURL(url_id, &archived_visits); 911 main_db_->GetVisitsForURL(url_id, &archived_visits);
911 EXPECT_EQ(0U, archived_visits.size()); 912 EXPECT_EQ(0U, archived_visits.size());
912 } 913 }
913 914
914 // TODO(brettw) add some visits with no URL to make sure everything is updated 915 // TODO(brettw) add some visits with no URL to make sure everything is updated
915 // properly. Have the visits also refer to nonexistent FTS rows. 916 // properly. Have the visits also refer to nonexistent FTS rows.
916 // 917 //
917 // Maybe also refer to invalid favicons. 918 // Maybe also refer to invalid favicons.
918 919
919 } // namespace history 920 } // namespace history
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698