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

Unified Diff: chrome/browser/ui/webui/browsing_history_handler.h

Issue 2464323004: Fix grouped history query range for months. (Closed)
Patch Set: give a valid time to all tests Created 4 years, 1 month 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 | « no previous file | chrome/browser/ui/webui/browsing_history_handler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/browsing_history_handler.h
diff --git a/chrome/browser/ui/webui/browsing_history_handler.h b/chrome/browser/ui/webui/browsing_history_handler.h
index 62d4b75e8b5d02ff4212be4c60b01f01ea217d67..38dc34f3900d173a7d37dcc8d607e53add6db6f8 100644
--- a/chrome/browser/ui/webui/browsing_history_handler.h
+++ b/chrome/browser/ui/webui/browsing_history_handler.h
@@ -17,6 +17,7 @@
#include "base/scoped_observer.h"
#include "base/strings/string16.h"
#include "base/task/cancelable_task_tracker.h"
+#include "base/time/clock.h"
#include "base/timer/timer.h"
#include "base/values.h"
#include "components/history/core/browser/history_service_observer.h"
@@ -66,10 +67,15 @@ class BrowsingHistoryHandler : public content::WebUIMessageHandler,
COMBINED_ENTRY
};
- HistoryEntry(EntryType type, const GURL& url, const base::string16& title,
- base::Time time, const std::string& client_id,
- bool is_search_result, const base::string16& snippet,
- bool blocked_visit);
+ HistoryEntry(EntryType type,
+ const GURL& url,
+ const base::string16& title,
+ base::Time time,
+ const std::string& client_id,
+ bool is_search_result,
+ const base::string16& snippet,
+ bool blocked_visit,
+ base::Clock* clock);
HistoryEntry();
HistoryEntry(const HistoryEntry& other);
virtual ~HistoryEntry();
@@ -113,6 +119,8 @@ class BrowsingHistoryHandler : public content::WebUIMessageHandler,
// Whether this entry was blocked when it was attempted.
bool blocked_visit;
+
+ base::Clock* clock; // Weak reference.
};
BrowsingHistoryHandler();
@@ -149,9 +157,16 @@ class BrowsingHistoryHandler : public content::WebUIMessageHandler,
const history::QueryOptions& options,
history::QueryResults* results);
+ // For tests.
+ void set_clock(std::unique_ptr<base::Clock> clock) {
+ clock_ = std::move(clock);
+ }
+
private:
FRIEND_TEST_ALL_PREFIXES(BrowsingHistoryHandlerTest,
ObservingWebHistoryDeletions);
+ FRIEND_TEST_ALL_PREFIXES(BrowsingHistoryHandlerTest, SetQueryTimeInWeeks);
+ FRIEND_TEST_ALL_PREFIXES(BrowsingHistoryHandlerTest, SetQueryTimeInMonths);
// The range for which to return results:
// - ALLTIME: allows access to all the results in a paginated way.
@@ -261,6 +276,9 @@ class BrowsingHistoryHandler : public content::WebUIMessageHandler,
// Whether there are other forms of browsing history on the history server.
bool has_other_forms_of_browsing_history_;
+ // The clock used to vend times.
+ std::unique_ptr<base::Clock> clock_;
+
base::WeakPtrFactory<BrowsingHistoryHandler> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(BrowsingHistoryHandler);
« no previous file with comments | « no previous file | chrome/browser/ui/webui/browsing_history_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698