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

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: . 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_
Mark Mentovai 2011/08/31 18:02:51 #pragma once? (I asked before but I don’t think y
Nico 2011/08/31 18:09:53 Done as well.
44
42 #include "base/time.h" 45 #include "base/time.h"
43 #include "testing/gmock/include/gmock/gmock.h" 46 #include "testing/gmock/include/gmock/gmock.h"
44 47
45 #ifndef BASE_TEST_MOCK_TIME_PROVIDER_H_
46 #define BASE_TEST_MOCK_TIME_PROVIDER_H_
47
48 namespace base { 48 namespace base {
49 49
50 class MockTimeProvider { 50 class MockTimeProvider {
51 public: 51 public:
52 MockTimeProvider(); 52 MockTimeProvider();
53 ~MockTimeProvider(); 53 ~MockTimeProvider();
54 54
55 MOCK_METHOD0(Now, Time()); 55 MOCK_METHOD0(Now, Time());
56 56
57 static Time StaticNow(); 57 static Time StaticNow();
58 58
59 private: 59 private:
60 static MockTimeProvider* instance_; 60 static MockTimeProvider* instance_;
61 DISALLOW_COPY_AND_ASSIGN(MockTimeProvider); 61 DISALLOW_COPY_AND_ASSIGN(MockTimeProvider);
62 }; 62 };
63 63
64 } // namespace base 64 } // namespace base
65 65
66 #endif // BASE_TEST_MOCK_TIME_PROVIDER_H_ 66 #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