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

Side by Side Diff: ui/events/x/events_x_unittest.cc

Issue 2259753003: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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
« no previous file with comments | « ui/events/test/test_event_target.cc ('k') | ui/gfx/image/image.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <X11/XKBlib.h> 5 #include <X11/XKBlib.h>
6 #include <X11/Xlib.h> 6 #include <X11/Xlib.h>
7 #include <X11/Xutil.h> 7 #include <X11/Xutil.h>
8 #include <X11/extensions/XInput2.h> 8 #include <X11/extensions/XInput2.h>
9 #include <stddef.h> 9 #include <stddef.h>
10 #include <stdint.h> 10 #include <stdint.h>
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 private: 534 private:
535 base::TimeTicks ticks_; 535 base::TimeTicks ticks_;
536 }; 536 };
537 } // namespace 537 } // namespace
538 538
539 TEST_F(EventsXTest, TimestampRolloverAndAdjustWhenDecreasing) { 539 TEST_F(EventsXTest, TimestampRolloverAndAdjustWhenDecreasing) {
540 XEvent event; 540 XEvent event;
541 InitButtonEvent(&event, true, gfx::Point(5, 10), 1, 0); 541 InitButtonEvent(&event, true, gfx::Point(5, 10), 1, 0);
542 542
543 ResetTimestampRolloverCountersForTesting( 543 ResetTimestampRolloverCountersForTesting(
544 WrapUnique(new MockTickClock(0x100000001LL))); 544 base::MakeUnique<MockTickClock>(0x100000001LL));
545 545
546 event.xbutton.time = 0xFFFFFFFF; 546 event.xbutton.time = 0xFFFFFFFF;
547 EXPECT_EQ(base::TimeDelta::FromMilliseconds(0xFFFFFFFF).ToInternalValue(), 547 EXPECT_EQ(base::TimeDelta::FromMilliseconds(0xFFFFFFFF).ToInternalValue(),
548 ui::EventTimeFromNative(&event).ToInternalValue()); 548 ui::EventTimeFromNative(&event).ToInternalValue());
549 549
550 ResetTimestampRolloverCountersForTesting( 550 ResetTimestampRolloverCountersForTesting(
551 WrapUnique(new MockTickClock(0x100000007LL))); 551 base::MakeUnique<MockTickClock>(0x100000007LL));
552 552
553 event.xbutton.time = 3; 553 event.xbutton.time = 3;
554 EXPECT_EQ( 554 EXPECT_EQ(
555 base::TimeDelta::FromMilliseconds(0x100000000LL + 3).ToInternalValue(), 555 base::TimeDelta::FromMilliseconds(0x100000000LL + 3).ToInternalValue(),
556 ui::EventTimeFromNative(&event).ToInternalValue()); 556 ui::EventTimeFromNative(&event).ToInternalValue());
557 } 557 }
558 558
559 TEST_F(EventsXTest, NoTimestampRolloverWhenMonotonicIncreasing) { 559 TEST_F(EventsXTest, NoTimestampRolloverWhenMonotonicIncreasing) {
560 XEvent event; 560 XEvent event;
561 InitButtonEvent(&event, true, gfx::Point(5, 10), 1, 0); 561 InitButtonEvent(&event, true, gfx::Point(5, 10), 1, 0);
562 562
563 ResetTimestampRolloverCountersForTesting(WrapUnique(new MockTickClock(10))); 563 ResetTimestampRolloverCountersForTesting(base::MakeUnique<MockTickClock>(10));
564 564
565 event.xbutton.time = 6; 565 event.xbutton.time = 6;
566 EXPECT_EQ(base::TimeDelta::FromMilliseconds(6).ToInternalValue(), 566 EXPECT_EQ(base::TimeDelta::FromMilliseconds(6).ToInternalValue(),
567 ui::EventTimeFromNative(&event).ToInternalValue()); 567 ui::EventTimeFromNative(&event).ToInternalValue());
568 event.xbutton.time = 7; 568 event.xbutton.time = 7;
569 EXPECT_EQ(base::TimeDelta::FromMilliseconds(7).ToInternalValue(), 569 EXPECT_EQ(base::TimeDelta::FromMilliseconds(7).ToInternalValue(),
570 ui::EventTimeFromNative(&event).ToInternalValue()); 570 ui::EventTimeFromNative(&event).ToInternalValue());
571 571
572 ResetTimestampRolloverCountersForTesting( 572 ResetTimestampRolloverCountersForTesting(
573 WrapUnique(new MockTickClock(0x100000005))); 573 base::MakeUnique<MockTickClock>(0x100000005));
574 574
575 event.xbutton.time = 0xFFFFFFFF; 575 event.xbutton.time = 0xFFFFFFFF;
576 EXPECT_EQ(base::TimeDelta::FromMilliseconds(0xFFFFFFFF).ToInternalValue(), 576 EXPECT_EQ(base::TimeDelta::FromMilliseconds(0xFFFFFFFF).ToInternalValue(),
577 ui::EventTimeFromNative(&event).ToInternalValue()); 577 ui::EventTimeFromNative(&event).ToInternalValue());
578 } 578 }
579 579
580 } // namespace ui 580 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/test/test_event_target.cc ('k') | ui/gfx/image/image.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698