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

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

Issue 11453012: Fix black background when locking with fullscreen window: (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rename undo/stop to cancel Created 8 years 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef BASE_TEST_SCOPED_TIME_CONTROLLER_H_
6 #define BASE_TEST_SCOPED_TIME_CONTROLLER_H_
7
8 #include "base/compiler_specific.h"
9 #include "base/time.h"
10
11 namespace base {
12 namespace test {
13
14 // TimeFactory that captures and freeses current time, and let to advance it
15 // manually. Sets itself as a TimeFactory instance on construction, and
16 // restores the previous one on destruction.
17 // Use it with care, as it might break assumed time monotonicity after deletion.
18 // The best way is to set it first in SetUp and remove it last at the
19 // TearDown method.
20 class ScopedTimeController : public base::TimeFactory {
21 public:
22 ScopedTimeController();
23 virtual ~ScopedTimeController();
24
25 // Advances inner time for |delta|. |Delta| have to be non-negative.
26 void Advance(base::TimeDelta delta);
27
28 // TimeFactory overrides
29 virtual base::Time TimeNow() OVERRIDE;
30 virtual base::TimeTicks TimeTicksNow() OVERRIDE;
31 private:
32 base::Time current_time_;
33 base::TimeTicks current_timeticks_;
34
35 base::TimeFactory* replaced_instance_;
36
37 DISALLOW_COPY_AND_ASSIGN(ScopedTimeController);
38 };
39
40 } // namespace test
41 } // namespace base
42
43 #endif // BASE_TEST_SCOPED_TIME_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698