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

Unified Diff: cc/test/test_now_source.h

Issue 1531403002: Revert "Delete CC." (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years 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 | « cc/test/test_in_process_context_provider.cc ('k') | cc/test/test_now_source.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/test/test_now_source.h
diff --git a/cc/test/test_now_source.h b/cc/test/test_now_source.h
new file mode 100644
index 0000000000000000000000000000000000000000..9b46bbe70f1d42ef7be6a7bd3a30ca4093216056
--- /dev/null
+++ b/cc/test/test_now_source.h
@@ -0,0 +1,63 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CC_TEST_TEST_NOW_SOURCE_H_
+#define CC_TEST_TEST_NOW_SOURCE_H_
+
+#include <string>
+
+#include "base/basictypes.h"
+#include "base/logging.h"
+#include "base/trace_event/trace_event.h"
+#include "base/trace_event/trace_event_argument.h"
+
+namespace cc {
+
+class TestNowSource : public base::RefCounted<TestNowSource> {
+ public:
+ static scoped_refptr<TestNowSource> Create();
+ static scoped_refptr<TestNowSource> Create(int64_t initial);
+ static scoped_refptr<TestNowSource> Create(base::TimeTicks initial);
+
+ virtual void Reset();
+ virtual base::TimeTicks Now() const;
+ virtual void SetNow(base::TimeTicks time);
+ virtual void AdvanceNow(base::TimeDelta period);
+
+ // Convenience functions to make it the now source easier to use in unit
+ // tests.
+ void AdvanceNowMicroseconds(int64_t period_in_microseconds);
+ void SetNowMicroseconds(int64_t time_in_microseconds);
+
+ static const base::TimeTicks kAbsoluteMaxNow;
+
+ // Tracing functions
+ scoped_refptr<base::trace_event::ConvertableToTraceFormat> AsValue() const;
+ void AsValueInto(base::trace_event::TracedValue* state) const;
+ std::string ToString() const;
+
+ int NumNowCalls() const { return num_now_calls_; }
+
+ protected:
+ TestNowSource();
+ explicit TestNowSource(int64_t initial);
+ explicit TestNowSource(base::TimeTicks initial);
+
+ base::TimeTicks initial_;
+ base::TimeTicks now_;
+ mutable int num_now_calls_;
+
+ private:
+ friend class base::RefCounted<TestNowSource>;
+ virtual ~TestNowSource();
+};
+
+// gtest pretty printing functions
+void PrintTo(const scoped_refptr<TestNowSource>& src, ::std::ostream* os);
+::std::ostream& operator<<(::std::ostream& os,
+ const scoped_refptr<TestNowSource>& src);
+
+} // namespace cc
+
+#endif // CC_TEST_TEST_NOW_SOURCE_H_
« no previous file with comments | « cc/test/test_in_process_context_provider.cc ('k') | cc/test/test_now_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698