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

Side by Side Diff: base/test/mock_time_provider.h

Issue 18119002: Use a direct include of time headers in base/, part 2. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: win fix Created 7 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/task_runner.h ('k') | base/test/sequenced_task_runner_test_template.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // TODO(akalin): Change all users of this class to use SimpleTestClock 5 // TODO(akalin): Change all users of this class to use SimpleTestClock
6 // or SimpleTestTickClock and remove this class. 6 // or SimpleTestTickClock and remove this class.
7 7
8 // A helper class used to mock out calls to the static method base::Time::Now. 8 // A helper class used to mock out calls to the static method base::Time::Now.
9 // 9 //
10 // Example usage: 10 // Example usage:
(...skipping 27 matching lines...) Expand all
38 // 38 //
39 // StopWatch sw(&MockTimeProvider::StaticNow); 39 // StopWatch sw(&MockTimeProvider::StaticNow);
40 // sw.Start(); // First call to Now. 40 // sw.Start(); // First call to Now.
41 // TimeDelta elapsed = sw.stop(); // Second call to Now. 41 // TimeDelta elapsed = sw.stop(); // Second call to Now.
42 // ASSERT_EQ(elapsed, TimeDelta::FromSeconds(6)); 42 // ASSERT_EQ(elapsed, TimeDelta::FromSeconds(6));
43 // } 43 // }
44 44
45 #ifndef BASE_TEST_MOCK_TIME_PROVIDER_H_ 45 #ifndef BASE_TEST_MOCK_TIME_PROVIDER_H_
46 #define BASE_TEST_MOCK_TIME_PROVIDER_H_ 46 #define BASE_TEST_MOCK_TIME_PROVIDER_H_
47 47
48 #include "base/time.h" 48 #include "base/time/time.h"
49 #include "testing/gmock/include/gmock/gmock.h" 49 #include "testing/gmock/include/gmock/gmock.h"
50 50
51 namespace base { 51 namespace base {
52 52
53 class MockTimeProvider { 53 class MockTimeProvider {
54 public: 54 public:
55 MockTimeProvider(); 55 MockTimeProvider();
56 ~MockTimeProvider(); 56 ~MockTimeProvider();
57 57
58 MOCK_METHOD0(Now, Time()); 58 MOCK_METHOD0(Now, Time());
59 59
60 static Time StaticNow(); 60 static Time StaticNow();
61 61
62 private: 62 private:
63 static MockTimeProvider* instance_; 63 static MockTimeProvider* instance_;
64 DISALLOW_COPY_AND_ASSIGN(MockTimeProvider); 64 DISALLOW_COPY_AND_ASSIGN(MockTimeProvider);
65 }; 65 };
66 66
67 } // namespace base 67 } // namespace base
68 68
69 #endif // BASE_TEST_MOCK_TIME_PROVIDER_H_ 69 #endif // BASE_TEST_MOCK_TIME_PROVIDER_H_
OLDNEW
« no previous file with comments | « base/task_runner.h ('k') | base/test/sequenced_task_runner_test_template.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698