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 10735044: Remove #pragma once. Just from base/ for now. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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/test/mock_chrome_application_mac.h ('k') | base/test/multiprocess_test.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 // 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 23 matching lines...) Expand all
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_ 42 #ifndef BASE_TEST_MOCK_TIME_PROVIDER_H_
43 #define BASE_TEST_MOCK_TIME_PROVIDER_H_ 43 #define BASE_TEST_MOCK_TIME_PROVIDER_H_
44 #pragma once
45 44
46 #include "base/time.h" 45 #include "base/time.h"
47 #include "testing/gmock/include/gmock/gmock.h" 46 #include "testing/gmock/include/gmock/gmock.h"
48 47
49 namespace base { 48 namespace base {
50 49
51 class MockTimeProvider { 50 class MockTimeProvider {
52 public: 51 public:
53 MockTimeProvider(); 52 MockTimeProvider();
54 ~MockTimeProvider(); 53 ~MockTimeProvider();
55 54
56 MOCK_METHOD0(Now, Time()); 55 MOCK_METHOD0(Now, Time());
57 56
58 static Time StaticNow(); 57 static Time StaticNow();
59 58
60 private: 59 private:
61 static MockTimeProvider* instance_; 60 static MockTimeProvider* instance_;
62 DISALLOW_COPY_AND_ASSIGN(MockTimeProvider); 61 DISALLOW_COPY_AND_ASSIGN(MockTimeProvider);
63 }; 62 };
64 63
65 } // namespace base 64 } // namespace base
66 65
67 #endif // BASE_TEST_MOCK_TIME_PROVIDER_H_ 66 #endif // BASE_TEST_MOCK_TIME_PROVIDER_H_
OLDNEW
« no previous file with comments | « base/test/mock_chrome_application_mac.h ('k') | base/test/multiprocess_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698