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

Unified Diff: chrome/browser/prerender/prerender_manager.h

Issue 2304953002: NoState Prefetch: nostate prefetch browser tests. (Closed)
Patch Set: Remove final_status.cc as it had only formatting changes. Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/prerender/prerender_contents.cc ('k') | chrome/browser/prerender/prerender_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/prerender/prerender_manager.h
diff --git a/chrome/browser/prerender/prerender_manager.h b/chrome/browser/prerender/prerender_manager.h
index 8f335719c06c6326398d5fdc61287bfc8d1d3936..0d4407770d36e8cb2d26bc977d55f3d0e9abd934 100644
--- a/chrome/browser/prerender/prerender_manager.h
+++ b/chrome/browser/prerender/prerender_manager.h
@@ -99,6 +99,13 @@ class PrerenderManager : public content::NotificationObserver,
CLEAR_MAX = 0x1 << 2
};
+ // Used to manipulate time for testing.
+ class TimeOverride {
+ public:
+ virtual base::Time GetCurrentTime() const = 0;
+ virtual base::TimeTicks GetCurrentTimeTicks() const = 0;
+ };
+
// Owned by a Profile object for the lifetime of the profile.
explicit PrerenderManager(Profile* profile);
~PrerenderManager() override;
@@ -312,11 +319,13 @@ class PrerenderManager : public content::NotificationObserver,
Profile* profile() const { return profile_; }
- // Classes which will be tested in prerender unit browser tests should use
- // these methods to get times for comparison, so that the test framework can
- // mock advancing/retarding time.
- virtual base::Time GetCurrentTime() const;
- virtual base::TimeTicks GetCurrentTimeTicks() const;
+ base::Time GetCurrentTime() const;
+ base::TimeTicks GetCurrentTimeTicks() const;
+
+ // For testing.
+ // TODO(mattcary): unify time testing by using base::SimpleTestClock and
+ // SimpleTestTickClock.
+ void SetTimeOverride(std::unique_ptr<TimeOverride> override);
// Notification that a prerender has completed and its bytes should be
// recorded.
@@ -596,6 +605,8 @@ class PrerenderManager : public content::NotificationObserver,
using PrerenderProcessSet = std::set<content::RenderProcessHost*>;
PrerenderProcessSet prerender_process_hosts_;
+ std::unique_ptr<TimeOverride> time_override_;
+
base::WeakPtrFactory<PrerenderManager> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(PrerenderManager);
« no previous file with comments | « chrome/browser/prerender/prerender_contents.cc ('k') | chrome/browser/prerender/prerender_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698