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

Unified Diff: ui/events/base_event_utils.cc

Issue 2094193002: Deflake Mac views_unittest's MenuRunnerCocoaTest.RunMenuAndCancel (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/events/base_event_utils.h ('k') | ui/views/controls/menu/menu_runner_cocoa_unittest.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/base_event_utils.cc
diff --git a/ui/events/base_event_utils.cc b/ui/events/base_event_utils.cc
index d4545bc45c4560dddc39c2c217a5e0045dd39914..e5500d7f7367cb43e69940acb4fcfeebb374f2d6 100644
--- a/ui/events/base_event_utils.cc
+++ b/ui/events/base_event_utils.cc
@@ -13,6 +13,8 @@
#include "ui/events/event_constants.h"
#include "ui/events/event_switches.h"
+bool g_no_mock_time = false;
+
namespace ui {
namespace {
@@ -48,11 +50,14 @@ base::LazyInstance<std::unique_ptr<base::TickClock>>::Leaky g_tick_clock =
LAZY_INSTANCE_INITIALIZER;
base::TimeTicks EventTimeForNow() {
+ if (g_no_mock_time)
+ DCHECK(!g_tick_clock.Get());
tapted 2016/06/30 07:02:49 So I got this to fail at [ RUN ] MenuRunnerCo
return g_tick_clock.Get() ? g_tick_clock.Get()->NowTicks()
: base::TimeTicks::Now();
}
void SetEventTickClockForTesting(std::unique_ptr<base::TickClock> tick_clock) {
+ DCHECK(!g_no_mock_time);
g_tick_clock.Get() = std::move(tick_clock);
}
« no previous file with comments | « ui/events/base_event_utils.h ('k') | ui/views/controls/menu/menu_runner_cocoa_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698