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

Side by Side Diff: content/browser/web_contents/web_contents_view_aura_browsertest.cc

Issue 1975533002: Change ui::Event::time_stamp from TimeDelta to TimeTicks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "content/browser/web_contents/web_contents_view_aura.h" 5 #include "content/browser/web_contents/web_contents_view_aura.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 EXPECT_EQ(1, GetCurrentIndex()); 492 EXPECT_EQ(1, GetCurrentIndex());
493 ExecuteSyncJSFunction(main_frame, "navigate_next()"); 493 ExecuteSyncJSFunction(main_frame, "navigate_next()");
494 EXPECT_EQ(2, GetCurrentIndex()); 494 EXPECT_EQ(2, GetCurrentIndex());
495 web_contents->GetController().GoBack(); 495 web_contents->GetController().GoBack();
496 EXPECT_EQ(1, GetCurrentIndex()); 496 EXPECT_EQ(1, GetCurrentIndex());
497 497
498 aura::Window* content = web_contents->GetContentNativeView(); 498 aura::Window* content = web_contents->GetContentNativeView();
499 ui::EventProcessor* dispatcher = content->GetHost()->event_processor(); 499 ui::EventProcessor* dispatcher = content->GetHost()->event_processor();
500 gfx::Rect bounds = content->GetBoundsInRootWindow(); 500 gfx::Rect bounds = content->GetBoundsInRootWindow();
501 501
502 base::TimeDelta timestamp = ui::EventTimeForNow(); 502 base::TimeTicks timestamp = ui::EventTimeForNow();
503 ui::TouchEvent press( 503 ui::TouchEvent press(
504 ui::ET_TOUCH_PRESSED, 504 ui::ET_TOUCH_PRESSED,
505 gfx::Point(bounds.x() + bounds.width() / 2, bounds.y() + 5), 0, 505 gfx::Point(bounds.x() + bounds.width() / 2, bounds.y() + 5), 0,
506 timestamp); 506 timestamp);
507 ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&press); 507 ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&press);
508 ASSERT_FALSE(details.dispatcher_destroyed); 508 ASSERT_FALSE(details.dispatcher_destroyed);
509 EXPECT_EQ(1, GetCurrentIndex()); 509 EXPECT_EQ(1, GetCurrentIndex());
510 510
511 timestamp += base::TimeDelta::FromMilliseconds(10); 511 timestamp += base::TimeDelta::FromMilliseconds(10);
512 ui::TouchEvent move1(ui::ET_TOUCH_MOVED, 512 ui::TouchEvent move1(ui::ET_TOUCH_MOVED,
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after
1025 ui::ScopedAnimationDurationScaleMode::FAST_DURATION); 1025 ui::ScopedAnimationDurationScaleMode::FAST_DURATION);
1026 1026
1027 aura::Window* content = web_contents->GetContentNativeView(); 1027 aura::Window* content = web_contents->GetContentNativeView();
1028 ui::EventProcessor* dispatcher = content->GetHost()->event_processor(); 1028 ui::EventProcessor* dispatcher = content->GetHost()->event_processor();
1029 gfx::Rect bounds = content->GetBoundsInRootWindow(); 1029 gfx::Rect bounds = content->GetBoundsInRootWindow();
1030 1030
1031 // Overscroll horizontally. 1031 // Overscroll horizontally.
1032 { 1032 {
1033 int kXStep = bounds.width() / 10; 1033 int kXStep = bounds.width() / 10;
1034 gfx::Point location(bounds.right() - kXStep, bounds.y() + 5); 1034 gfx::Point location(bounds.right() - kXStep, bounds.y() + 5);
1035 base::TimeDelta timestamp = ui::EventTimeForNow(); 1035 base::TimeTicks timestamp = ui::EventTimeForNow();
1036 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, location, 0, timestamp); 1036 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, location, 0, timestamp);
1037 ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&press); 1037 ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&press);
1038 ASSERT_FALSE(details.dispatcher_destroyed); 1038 ASSERT_FALSE(details.dispatcher_destroyed);
1039 WaitAFrame(); 1039 WaitAFrame();
1040 location -= gfx::Vector2d(kXStep, 0); 1040 location -= gfx::Vector2d(kXStep, 0);
1041 timestamp += base::TimeDelta::FromMilliseconds(10); 1041 timestamp += base::TimeDelta::FromMilliseconds(10);
1042 1042
1043 while (location.x() > bounds.x() + kXStep) { 1043 while (location.x() > bounds.x() + kXStep) {
1044 ui::TouchEvent inc(ui::ET_TOUCH_MOVED, location, 0, timestamp); 1044 ui::TouchEvent inc(ui::ET_TOUCH_MOVED, location, 0, timestamp);
1045 details = dispatcher->OnEventFromSource(&inc); 1045 details = dispatcher->OnEventFromSource(&inc);
(...skipping 11 matching lines...) Expand all
1057 EXPECT_EQ(0, tracker.num_overscroll_updates()); 1057 EXPECT_EQ(0, tracker.num_overscroll_updates());
1058 EXPECT_FALSE(tracker.overscroll_completed()); 1058 EXPECT_FALSE(tracker.overscroll_completed());
1059 } 1059 }
1060 1060
1061 // Overscroll vertically. 1061 // Overscroll vertically.
1062 { 1062 {
1063 tracker.Reset(); 1063 tracker.Reset();
1064 1064
1065 int kYStep = bounds.height() / 10; 1065 int kYStep = bounds.height() / 10;
1066 gfx::Point location(bounds.x() + 10, bounds.y() + kYStep); 1066 gfx::Point location(bounds.x() + 10, bounds.y() + kYStep);
1067 base::TimeDelta timestamp = ui::EventTimeForNow(); 1067 base::TimeTicks timestamp = ui::EventTimeForNow();
1068 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, location, 0, timestamp); 1068 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, location, 0, timestamp);
1069 ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&press); 1069 ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&press);
1070 ASSERT_FALSE(details.dispatcher_destroyed); 1070 ASSERT_FALSE(details.dispatcher_destroyed);
1071 WaitAFrame(); 1071 WaitAFrame();
1072 location += gfx::Vector2d(0, kYStep); 1072 location += gfx::Vector2d(0, kYStep);
1073 timestamp += base::TimeDelta::FromMilliseconds(10); 1073 timestamp += base::TimeDelta::FromMilliseconds(10);
1074 1074
1075 while (location.y() < bounds.bottom() - kYStep) { 1075 while (location.y() < bounds.bottom() - kYStep) {
1076 ui::TouchEvent inc(ui::ET_TOUCH_MOVED, location, 0, timestamp); 1076 ui::TouchEvent inc(ui::ET_TOUCH_MOVED, location, 0, timestamp);
1077 details = dispatcher->OnEventFromSource(&inc); 1077 details = dispatcher->OnEventFromSource(&inc);
(...skipping 13 matching lines...) Expand all
1091 } 1091 }
1092 1092
1093 // Start out overscrolling vertically, then switch directions and finish 1093 // Start out overscrolling vertically, then switch directions and finish
1094 // overscrolling horizontally. 1094 // overscrolling horizontally.
1095 { 1095 {
1096 tracker.Reset(); 1096 tracker.Reset();
1097 1097
1098 int kXStep = bounds.width() / 10; 1098 int kXStep = bounds.width() / 10;
1099 int kYStep = bounds.height() / 10; 1099 int kYStep = bounds.height() / 10;
1100 gfx::Point location = bounds.origin() + gfx::Vector2d(0, kYStep); 1100 gfx::Point location = bounds.origin() + gfx::Vector2d(0, kYStep);
1101 base::TimeDelta timestamp = ui::EventTimeForNow(); 1101 base::TimeTicks timestamp = ui::EventTimeForNow();
1102 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, location, 0, timestamp); 1102 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, location, 0, timestamp);
1103 ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&press); 1103 ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&press);
1104 ASSERT_FALSE(details.dispatcher_destroyed); 1104 ASSERT_FALSE(details.dispatcher_destroyed);
1105 WaitAFrame(); 1105 WaitAFrame();
1106 location += gfx::Vector2d(0, kYStep); 1106 location += gfx::Vector2d(0, kYStep);
1107 timestamp += base::TimeDelta::FromMilliseconds(10); 1107 timestamp += base::TimeDelta::FromMilliseconds(10);
1108 1108
1109 for (size_t i = 0; i < 3; ++i) { 1109 for (size_t i = 0; i < 3; ++i) {
1110 ui::TouchEvent inc(ui::ET_TOUCH_MOVED, location, 0, timestamp); 1110 ui::TouchEvent inc(ui::ET_TOUCH_MOVED, location, 0, timestamp);
1111 details = dispatcher->OnEventFromSource(&inc); 1111 details = dispatcher->OnEventFromSource(&inc);
(...skipping 16 matching lines...) Expand all
1128 details = dispatcher->OnEventFromSource(&release); 1128 details = dispatcher->OnEventFromSource(&release);
1129 ASSERT_FALSE(details.dispatcher_destroyed); 1129 ASSERT_FALSE(details.dispatcher_destroyed);
1130 WaitAFrame(); 1130 WaitAFrame();
1131 1131
1132 EXPECT_LT(0, tracker.num_overscroll_updates()); 1132 EXPECT_LT(0, tracker.num_overscroll_updates());
1133 EXPECT_FALSE(tracker.overscroll_completed()); 1133 EXPECT_FALSE(tracker.overscroll_completed());
1134 } 1134 }
1135 } 1135 }
1136 1136
1137 } // namespace content 1137 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698