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

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: Updates Created 4 years, 7 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 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
1024 ui::ScopedAnimationDurationScaleMode::FAST_DURATION); 1024 ui::ScopedAnimationDurationScaleMode::FAST_DURATION);
1025 1025
1026 aura::Window* content = web_contents->GetContentNativeView(); 1026 aura::Window* content = web_contents->GetContentNativeView();
1027 ui::EventProcessor* dispatcher = content->GetHost()->event_processor(); 1027 ui::EventProcessor* dispatcher = content->GetHost()->event_processor();
1028 gfx::Rect bounds = content->GetBoundsInRootWindow(); 1028 gfx::Rect bounds = content->GetBoundsInRootWindow();
1029 1029
1030 // Overscroll horizontally. 1030 // Overscroll horizontally.
1031 { 1031 {
1032 int kXStep = bounds.width() / 10; 1032 int kXStep = bounds.width() / 10;
1033 gfx::Point location(bounds.right() - kXStep, bounds.y() + 5); 1033 gfx::Point location(bounds.right() - kXStep, bounds.y() + 5);
1034 base::TimeDelta timestamp = ui::EventTimeForNow(); 1034 base::TimeTicks timestamp = ui::EventTimeForNow();
1035 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, location, 0, timestamp); 1035 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, location, 0, timestamp);
1036 ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&press); 1036 ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&press);
1037 ASSERT_FALSE(details.dispatcher_destroyed); 1037 ASSERT_FALSE(details.dispatcher_destroyed);
1038 WaitAFrame(); 1038 WaitAFrame();
1039 location -= gfx::Vector2d(kXStep, 0); 1039 location -= gfx::Vector2d(kXStep, 0);
1040 timestamp += base::TimeDelta::FromMilliseconds(10); 1040 timestamp += base::TimeDelta::FromMilliseconds(10);
1041 1041
1042 while (location.x() > bounds.x() + kXStep) { 1042 while (location.x() > bounds.x() + kXStep) {
1043 ui::TouchEvent inc(ui::ET_TOUCH_MOVED, location, 0, timestamp); 1043 ui::TouchEvent inc(ui::ET_TOUCH_MOVED, location, 0, timestamp);
1044 details = dispatcher->OnEventFromSource(&inc); 1044 details = dispatcher->OnEventFromSource(&inc);
(...skipping 11 matching lines...) Expand all
1056 EXPECT_EQ(0, tracker.num_overscroll_updates()); 1056 EXPECT_EQ(0, tracker.num_overscroll_updates());
1057 EXPECT_FALSE(tracker.overscroll_completed()); 1057 EXPECT_FALSE(tracker.overscroll_completed());
1058 } 1058 }
1059 1059
1060 // Overscroll vertically. 1060 // Overscroll vertically.
1061 { 1061 {
1062 tracker.Reset(); 1062 tracker.Reset();
1063 1063
1064 int kYStep = bounds.height() / 10; 1064 int kYStep = bounds.height() / 10;
1065 gfx::Point location(bounds.x() + 10, bounds.y() + kYStep); 1065 gfx::Point location(bounds.x() + 10, bounds.y() + kYStep);
1066 base::TimeDelta timestamp = ui::EventTimeForNow(); 1066 base::TimeTicks timestamp = ui::EventTimeForNow();
1067 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, location, 0, timestamp); 1067 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, location, 0, timestamp);
1068 ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&press); 1068 ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&press);
1069 ASSERT_FALSE(details.dispatcher_destroyed); 1069 ASSERT_FALSE(details.dispatcher_destroyed);
1070 WaitAFrame(); 1070 WaitAFrame();
1071 location += gfx::Vector2d(0, kYStep); 1071 location += gfx::Vector2d(0, kYStep);
1072 timestamp += base::TimeDelta::FromMilliseconds(10); 1072 timestamp += base::TimeDelta::FromMilliseconds(10);
1073 1073
1074 while (location.y() < bounds.bottom() - kYStep) { 1074 while (location.y() < bounds.bottom() - kYStep) {
1075 ui::TouchEvent inc(ui::ET_TOUCH_MOVED, location, 0, timestamp); 1075 ui::TouchEvent inc(ui::ET_TOUCH_MOVED, location, 0, timestamp);
1076 details = dispatcher->OnEventFromSource(&inc); 1076 details = dispatcher->OnEventFromSource(&inc);
(...skipping 13 matching lines...) Expand all
1090 } 1090 }
1091 1091
1092 // Start out overscrolling vertically, then switch directions and finish 1092 // Start out overscrolling vertically, then switch directions and finish
1093 // overscrolling horizontally. 1093 // overscrolling horizontally.
1094 { 1094 {
1095 tracker.Reset(); 1095 tracker.Reset();
1096 1096
1097 int kXStep = bounds.width() / 10; 1097 int kXStep = bounds.width() / 10;
1098 int kYStep = bounds.height() / 10; 1098 int kYStep = bounds.height() / 10;
1099 gfx::Point location = bounds.origin() + gfx::Vector2d(0, kYStep); 1099 gfx::Point location = bounds.origin() + gfx::Vector2d(0, kYStep);
1100 base::TimeDelta timestamp = ui::EventTimeForNow(); 1100 base::TimeTicks timestamp = ui::EventTimeForNow();
1101 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, location, 0, timestamp); 1101 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, location, 0, timestamp);
1102 ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&press); 1102 ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&press);
1103 ASSERT_FALSE(details.dispatcher_destroyed); 1103 ASSERT_FALSE(details.dispatcher_destroyed);
1104 WaitAFrame(); 1104 WaitAFrame();
1105 location += gfx::Vector2d(0, kYStep); 1105 location += gfx::Vector2d(0, kYStep);
1106 timestamp += base::TimeDelta::FromMilliseconds(10); 1106 timestamp += base::TimeDelta::FromMilliseconds(10);
1107 1107
1108 for (size_t i = 0; i < 3; ++i) { 1108 for (size_t i = 0; i < 3; ++i) {
1109 ui::TouchEvent inc(ui::ET_TOUCH_MOVED, location, 0, timestamp); 1109 ui::TouchEvent inc(ui::ET_TOUCH_MOVED, location, 0, timestamp);
1110 details = dispatcher->OnEventFromSource(&inc); 1110 details = dispatcher->OnEventFromSource(&inc);
(...skipping 16 matching lines...) Expand all
1127 details = dispatcher->OnEventFromSource(&release); 1127 details = dispatcher->OnEventFromSource(&release);
1128 ASSERT_FALSE(details.dispatcher_destroyed); 1128 ASSERT_FALSE(details.dispatcher_destroyed);
1129 WaitAFrame(); 1129 WaitAFrame();
1130 1130
1131 EXPECT_LT(0, tracker.num_overscroll_updates()); 1131 EXPECT_LT(0, tracker.num_overscroll_updates());
1132 EXPECT_FALSE(tracker.overscroll_completed()); 1132 EXPECT_FALSE(tracker.overscroll_completed());
1133 } 1133 }
1134 } 1134 }
1135 1135
1136 } // namespace content 1136 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698