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

Unified Diff: base/test/test_mock_time_task_runner.h

Issue 2494943005: [ash-md] Added a delay between system menu default/detailed view transitions. (Closed)
Patch Set: Addressed review comments. 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
Index: base/test/test_mock_time_task_runner.h
diff --git a/base/test/test_mock_time_task_runner.h b/base/test/test_mock_time_task_runner.h
index 624f739cfa55604089e39858919ccaf117bb5701..b0ddb1c0fe4d8d9562d2e93accf24926f4b72e34 100644
--- a/base/test/test_mock_time_task_runner.h
+++ b/base/test/test_mock_time_task_runner.h
@@ -7,6 +7,7 @@
#include <stddef.h>
+#include <deque>
#include <memory>
#include <queue>
#include <vector>
@@ -83,6 +84,7 @@ class TestMockTimeTaskRunner : public SingleThreadTaskRunner {
// source. The returned TickClock will hold a reference to |this|.
std::unique_ptr<TickClock> GetMockTickClock() const;
+ std::deque<TestPendingTask> TakePendingTasks();
bool HasPendingTask() const;
size_t GetPendingTaskCount() const;
TimeDelta NextPendingTaskDelay() const;
@@ -165,6 +167,23 @@ class TestMockTimeTaskRunner : public SingleThreadTaskRunner {
DISALLOW_COPY_AND_ASSIGN(TestMockTimeTaskRunner);
};
+// A scoped wrapper around TestMockTimeTaskRunner that replaces message loop's
+// task runner with a TestMockTimeTaskRunner and resets it back at the end of
+// the scope.
+class ScopedMockTaskRunnerWrapper {
danakj 2016/11/15 21:56:37 This moved to another file right? Why's it here to
bruthig 2016/11/15 22:00:52 Just to make sure my reviewers are on the ball. Ku
+ public:
+ ScopedMockTaskRunnerWrapper();
+ virtual ~ScopedMockTaskRunnerWrapper();
+
+ base::TestMockTimeTaskRunner* task_runner() { return task_runner_.get(); }
+
+ private:
+ scoped_refptr<base::TestMockTimeTaskRunner> task_runner_;
+ scoped_refptr<base::SingleThreadTaskRunner> previous_task_runner_;
+
+ DISALLOW_COPY_AND_ASSIGN(ScopedMockTaskRunnerWrapper);
+};
+
} // namespace base
#endif // BASE_TEST_TEST_MOCK_TIME_TASK_RUNNER_H_

Powered by Google App Engine
This is Rietveld 408576698