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

Unified Diff: chrome/browser/history/in_memory_url_index_unittest.cc

Issue 10096015: Single URL Expires Were Not Being Deleted. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/history/history_types.h ('k') | chrome/browser/history/shortcuts_backend.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/history/in_memory_url_index_unittest.cc
===================================================================
--- chrome/browser/history/in_memory_url_index_unittest.cc (revision 132411)
+++ chrome/browser/history/in_memory_url_index_unittest.cc (working copy)
@@ -17,10 +17,14 @@
#include "chrome/browser/history/history.h"
#include "chrome/browser/history/history_backend.h"
#include "chrome/browser/history/history_database.h"
+#include "chrome/browser/history/history_notifications.h"
#include "chrome/browser/history/in_memory_url_index_types.h"
#include "chrome/browser/history/in_memory_url_index.h"
#include "chrome/browser/history/url_index_private_data.h"
+#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/chrome_paths.h"
+#include "content/public/browser/notification_details.h"
+#include "content/public/browser/notification_source.h"
#include "chrome/test/base/testing_profile.h"
#include "content/test/test_browser_thread.h"
#include "sql/transaction.h"
@@ -129,6 +133,9 @@
bool GetCacheFilePath(FilePath* file_path) const;
void PostRestoreFromCacheFileTask();
void PostSaveToCacheFileTask();
+ void Observe(int notification_type,
+ const content::NotificationSource& source,
+ const content::NotificationDetails& details);
const std::set<std::string>& scheme_whitelist();
@@ -186,6 +193,13 @@
url_index_->PostSaveToCacheFileTask();
}
+void InMemoryURLIndexTest::Observe(
+ int notification_type,
+ const content::NotificationSource& source,
+ const content::NotificationDetails& details) {
+ url_index_->Observe(notification_type, source, details);
+}
+
const std::set<std::string>& InMemoryURLIndexTest::scheme_whitelist() {
return url_index_->scheme_whitelist();
}
@@ -831,7 +845,7 @@
url_index_->HistoryItemsForTerms(ASCIIToUTF16("DrudgeReport"));
ASSERT_EQ(1U, matches.size());
- // Determine the row id for that result, delete that id, then search again.
+ // Delete the URL then search again.
EXPECT_TRUE(DeleteURL(matches[0].url_info.url()));
EXPECT_TRUE(url_index_->HistoryItemsForTerms(
ASCIIToUTF16("DrudgeReport")).empty());
@@ -841,6 +855,23 @@
EXPECT_FALSE(DeleteURL(url));
}
+TEST_F(InMemoryURLIndexTest, ExpireRow) {
+ ScoredHistoryMatches matches =
+ url_index_->HistoryItemsForTerms(ASCIIToUTF16("DrudgeReport"));
+ ASSERT_EQ(1U, matches.size());
+
+ // Determine the row id for the result, remember that id, broadcast a
+ // delete notification, then ensure that the row has been deleted.
+ URLsDeletedDetails deleted_details;
+ deleted_details.all_history = false;
+ deleted_details.rows.push_back(matches[0].url_info);
+ Observe(chrome::NOTIFICATION_HISTORY_URLS_DELETED,
+ content::Source<InMemoryURLIndexTest>(this),
+ content::Details<history::HistoryDetails>(&deleted_details));
+ EXPECT_TRUE(url_index_->HistoryItemsForTerms(
+ ASCIIToUTF16("DrudgeReport")).empty());
+}
+
TEST_F(InMemoryURLIndexTest, WhitelistedURLs) {
struct TestData {
const std::string url_spec;
« no previous file with comments | « chrome/browser/history/history_types.h ('k') | chrome/browser/history/shortcuts_backend.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698