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

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

Issue 7693019: Enable smooth scrolling on mac (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 9 years, 3 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 | « no previous file | build/common.gypi » ('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 // A helper class used to mock out calls to the static method base::Time::Now. 5 // A helper class used to mock out calls to the static method base::Time::Now.
6 // 6 //
7 // Example usage: 7 // Example usage:
8 // 8 //
9 // typedef base::Time(TimeProvider)(); 9 // typedef base::Time(TimeProvider)();
10 // class StopWatch { 10 // class StopWatch {
(...skipping 21 matching lines...) Expand all
32 // .WillOnce(Return(Time::FromDoubleT(4))); 32 // .WillOnce(Return(Time::FromDoubleT(4)));
33 // EXPECT_CALL(mock_time, Now()) 33 // EXPECT_CALL(mock_time, Now())
34 // .WillOnce(Return(Time::FromDoubleT(10))); 34 // .WillOnce(Return(Time::FromDoubleT(10)));
35 // 35 //
36 // StopWatch sw(&MockTimeProvider::StaticNow); 36 // StopWatch sw(&MockTimeProvider::StaticNow);
37 // sw.Start(); // First call to Now. 37 // sw.Start(); // First call to Now.
38 // TimeDelta elapsed = sw.stop(); // Second call to Now. 38 // TimeDelta elapsed = sw.stop(); // Second call to Now.
39 // ASSERT_EQ(elapsed, TimeDelta::FromSeconds(6)); 39 // ASSERT_EQ(elapsed, TimeDelta::FromSeconds(6));
40 // } 40 // }
41 41
42 #ifndef BASE_TEST_MOCK_TIME_PROVIDER_H_
43 #define BASE_TEST_MOCK_TIME_PROVIDER_H_
44 #pragma once
45
42 #include "base/time.h" 46 #include "base/time.h"
43 #include "testing/gmock/include/gmock/gmock.h" 47 #include "testing/gmock/include/gmock/gmock.h"
44 48
45 #ifndef BASE_TEST_MOCK_TIME_PROVIDER_H_
46 #define BASE_TEST_MOCK_TIME_PROVIDER_H_
47
48 namespace base { 49 namespace base {
49 50
50 class MockTimeProvider { 51 class MockTimeProvider {
51 public: 52 public:
52 MockTimeProvider(); 53 MockTimeProvider();
53 ~MockTimeProvider(); 54 ~MockTimeProvider();
54 55
55 MOCK_METHOD0(Now, Time()); 56 MOCK_METHOD0(Now, Time());
56 57
57 static Time StaticNow(); 58 static Time StaticNow();
58 59
59 private: 60 private:
60 static MockTimeProvider* instance_; 61 static MockTimeProvider* instance_;
61 DISALLOW_COPY_AND_ASSIGN(MockTimeProvider); 62 DISALLOW_COPY_AND_ASSIGN(MockTimeProvider);
62 }; 63 };
63 64
64 } // namespace base 65 } // namespace base
65 66
66 #endif // BASE_TEST_MOCK_TIME_PROVIDER_H_ 67 #endif // BASE_TEST_MOCK_TIME_PROVIDER_H_
OLDNEW
« no previous file with comments | « no previous file | build/common.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698