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

Unified Diff: chrome/browser/renderer_host/chrome_render_widget_host_view_mac_history_swiper_browsertest.mm

Issue 2007083002: Validate that ui::Event::time_stamp comes from the same clock as TimeTicks::Now (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@453559-use-timeticks-ui-event
Patch Set: Address feedback 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 | « no previous file | content/browser/renderer_host/render_widget_host_view_mac_unittest.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/renderer_host/chrome_render_widget_host_view_mac_history_swiper_browsertest.mm
diff --git a/chrome/browser/renderer_host/chrome_render_widget_host_view_mac_history_swiper_browsertest.mm b/chrome/browser/renderer_host/chrome_render_widget_host_view_mac_history_swiper_browsertest.mm
index 2e445ec9d46634d2d05e342494d6527c23c9387b..99752bbdfe9663b9489bc3c731679b85bc49e4eb 100644
--- a/chrome/browser/renderer_host/chrome_render_widget_host_view_mac_history_swiper_browsertest.mm
+++ b/chrome/browser/renderer_host/chrome_render_widget_host_view_mac_history_swiper_browsertest.mm
@@ -10,6 +10,7 @@
#import "base/mac/sdk_forward_declarations.h"
#include "base/macros.h"
#include "base/run_loop.h"
+#include "base/test/simple_test_tick_clock.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/test/base/in_process_browser_test.h"
@@ -21,6 +22,7 @@
#include "content/public/test/browser_test_utils.h"
#import "third_party/ocmock/OCMock/OCMock.h"
#import "third_party/ocmock/ocmock_extensions.h"
+#include "ui/events/base_event_utils.h"
#include "url/gurl.h"
namespace {
@@ -93,6 +95,11 @@ class ChromeRenderWidgetHostViewMacHistorySwiperTest
ASSERT_EQ(url1_, GetWebContents()->GetURL());
ui_test_utils::NavigateToURL(browser(), url2_);
ASSERT_EQ(url2_, GetWebContents()->GetURL());
+
+ std::unique_ptr<base::SimpleTestTickClock> mock_clock(
+ new base::SimpleTestTickClock());
+ mock_clock->Advance(base::TimeDelta::FromMilliseconds(100));
+ ui::SetEventTickClockForTesting(std::move(mock_clock));
}
void TearDownOnMainThread() override { event_queue_.reset(); }
@@ -160,6 +167,9 @@ class ChromeRenderWidgetHostViewMacHistorySwiperTest
id mock_event = [OCMockObject partialMockForObject:event];
[[[mock_event stub] andReturnBool:NO] isDirectionInvertedFromDevice];
+ NSTimeInterval timestamp = 0;
+ [(NSEvent*)[[mock_event stub]
+ andReturnValue:OCMOCK_VALUE(timestamp)] timestamp];
[(NSEvent*)[[mock_event stub] andReturnValue:OCMOCK_VALUE(type)] type];
return mock_event;
@@ -182,6 +192,9 @@ class ChromeRenderWidgetHostViewMacHistorySwiperTest
NSUInteger modifierFlags = 0;
[(NSEvent*)[[event stub]
andReturnValue:OCMOCK_VALUE(modifierFlags)] modifierFlags];
+ NSTimeInterval timestamp = 0;
+ [(NSEvent*)[[event stub] andReturnValue:OCMOCK_VALUE(timestamp)] timestamp];
+
NSView* view = GetWebContents()
->GetRenderViewHost()
->GetWidget()
@@ -241,6 +254,9 @@ class ChromeRenderWidgetHostViewMacHistorySwiperTest
[[[event stub] andReturn:touches] touchesMatchingPhase:NSTouchPhaseAny
inView:[OCMArg any]];
[[[event stub] andReturnBool:NO] isDirectionInvertedFromDevice];
+ NSTimeInterval timestamp = 0;
+ [(NSEvent*)[[event stub] andReturnValue:OCMOCK_VALUE(timestamp)] timestamp];
+
QueueEvent(event, deployment, run_message_loop);
}
« no previous file with comments | « no previous file | content/browser/renderer_host/render_widget_host_view_mac_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698