Bug 1246056 - Ensure that the MockContentController's timestamp is always >= GetStartupTime(). r=botond
authorKartikaya Gupta <kgupta@mozilla.com>
Tue, 16 Feb 2016 17:25:54 -0500
changeset 284465 96f7777635f8de6439ca42ae94a30e1d6bf4227a
parent 284464 1b3ab4045d79f6a136f1b2b7707d59fe82f85fa3
child 284466 9f1df78b4831a7310e3299ea8830d8b5735f17e1
push id30003
push usercbook@mozilla.com
push dateWed, 17 Feb 2016 10:52:09 +0000
treeherdermozilla-central@15621f98b53b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbotond
bugs1246056
milestone47.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1246056 - Ensure that the MockContentController's timestamp is always >= GetStartupTime(). r=botond MozReview-Commit-ID: KfkX1ixpKaI
gfx/layers/apz/test/gtest/APZTestCommon.h
--- a/gfx/layers/apz/test/gtest/APZTestCommon.h
+++ b/gfx/layers/apz/test/gtest/APZTestCommon.h
@@ -63,33 +63,38 @@ private:
 };
 
 #define SCOPED_GFX_PREF(prefBase, prefType, prefValue) \
   ScopedGfxPref<prefType> pref_##prefBase( \
     &(gfxPrefs::prefBase), \
     &(gfxPrefs::Set##prefBase), \
     prefValue)
 
+static TimeStamp GetStartupTime() {
+  static TimeStamp sStartupTime = TimeStamp::Now();
+  return sStartupTime;
+}
+
 class MockContentController : public GeckoContentController {
 public:
   MOCK_METHOD1(RequestContentRepaint, void(const FrameMetrics&));
   MOCK_METHOD2(RequestFlingSnap, void(const FrameMetrics::ViewID& aScrollId, const mozilla::CSSPoint& aDestination));
   MOCK_METHOD2(AcknowledgeScrollUpdate, void(const FrameMetrics::ViewID&, const uint32_t& aScrollGeneration));
   MOCK_METHOD3(HandleDoubleTap, void(const CSSPoint&, Modifiers, const ScrollableLayerGuid&));
   MOCK_METHOD3(HandleSingleTap, void(const CSSPoint&, Modifiers, const ScrollableLayerGuid&));
   MOCK_METHOD4(HandleLongTap, void(const CSSPoint&, Modifiers, const ScrollableLayerGuid&, uint64_t));
   MOCK_METHOD2(PostDelayedTask, void(Task* aTask, int aDelayMs));
   MOCK_METHOD3(NotifyAPZStateChange, void(const ScrollableLayerGuid& aGuid, APZStateChange aChange, int aArg));
   MOCK_METHOD0(NotifyFlushComplete, void());
 };
 
 class MockContentControllerDelayed : public MockContentController {
 public:
   MockContentControllerDelayed()
-    : mTime(TimeStamp::Now())
+    : mTime(GetStartupTime())
   {
   }
 
   const TimeStamp& Time() {
     return mTime;
   }
 
   void AdvanceByMillis(int aMillis) {
@@ -251,21 +256,16 @@ public:
       aOutTransform, aScrollOffset);
     return ret;
   }
 
   void SetWaitForMainThread() {
     mWaitForMainThread = true;
   }
 
-  static TimeStamp GetStartupTime() {
-    static TimeStamp sStartupTime = TimeStamp::Now();
-    return sStartupTime;
-  }
-
 private:
   bool mWaitForMainThread;
   MockContentControllerDelayed* mcc;
 };
 
 AsyncPanZoomController*
 TestAPZCTreeManager::NewAPZCInstance(uint64_t aLayersId,
                                      GeckoContentController* aController)
@@ -286,12 +286,12 @@ TestFrameMetrics()
   fm.SetScrollableRect(CSSRect(0, 0, 100, 100));
 
   return fm;
 }
 
 uint32_t
 MillisecondsSinceStartup(TimeStamp aTime)
 {
-  return (aTime - TestAsyncPanZoomController::GetStartupTime()).ToMilliseconds();
+  return (aTime - GetStartupTime()).ToMilliseconds();
 }
 
 #endif // mozilla_layers_APZTestCommon_h