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

Side by Side Diff: ui/aura/window_unittest.cc

Issue 10831240: Remove TouchEvent interface, and rename TouchEventImpl to TouchEvent (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge-tot Created 8 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 | Annotate | Revision Log
« no previous file with comments | « ui/aura/window_delegate.h ('k') | ui/base/event.h » ('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 "ui/aura/window.h" 5 #include "ui/aura/window.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 int mouse_event_count() const { return mouse_event_count_; } 163 int mouse_event_count() const { return mouse_event_count_; }
164 int touch_event_count() const { return touch_event_count_; } 164 int touch_event_count() const { return touch_event_count_; }
165 int gesture_event_count() const { return gesture_event_count_; } 165 int gesture_event_count() const { return gesture_event_count_; }
166 166
167 virtual bool OnMouseEvent(ui::MouseEvent* event) OVERRIDE { 167 virtual bool OnMouseEvent(ui::MouseEvent* event) OVERRIDE {
168 if (event->type() == ui::ET_MOUSE_CAPTURE_CHANGED) 168 if (event->type() == ui::ET_MOUSE_CAPTURE_CHANGED)
169 capture_changed_event_count_++; 169 capture_changed_event_count_++;
170 mouse_event_count_++; 170 mouse_event_count_++;
171 return false; 171 return false;
172 } 172 }
173 virtual ui::TouchStatus OnTouchEvent(ui::TouchEventImpl* event) OVERRIDE { 173 virtual ui::TouchStatus OnTouchEvent(ui::TouchEvent* event) OVERRIDE {
174 touch_event_count_++; 174 touch_event_count_++;
175 return ui::TOUCH_STATUS_UNKNOWN; 175 return ui::TOUCH_STATUS_UNKNOWN;
176 } 176 }
177 virtual ui::GestureStatus OnGestureEvent( 177 virtual ui::GestureStatus OnGestureEvent(
178 ui::GestureEventImpl* event) OVERRIDE { 178 ui::GestureEventImpl* event) OVERRIDE {
179 gesture_event_count_++; 179 gesture_event_count_++;
180 return ui::GESTURE_STATUS_UNKNOWN; 180 return ui::GESTURE_STATUS_UNKNOWN;
181 } 181 }
182 virtual void OnCaptureLost() OVERRIDE { 182 virtual void OnCaptureLost() OVERRIDE {
183 capture_lost_count_++; 183 capture_lost_count_++;
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 426
427 // Points are in the Window's coordinates. 427 // Points are in the Window's coordinates.
428 EXPECT_TRUE(w1.HitTest(gfx::Point(1, 1))); 428 EXPECT_TRUE(w1.HitTest(gfx::Point(1, 1)));
429 EXPECT_FALSE(w1.HitTest(gfx::Point(-1, -1))); 429 EXPECT_FALSE(w1.HitTest(gfx::Point(-1, -1)));
430 430
431 // We can expand the bounds slightly to track events outside our border. 431 // We can expand the bounds slightly to track events outside our border.
432 w1.SetHitTestBoundsOverrideOuter(gfx::Insets(-1, -1, -1, -1), 5); 432 w1.SetHitTestBoundsOverrideOuter(gfx::Insets(-1, -1, -1, -1), 5);
433 EXPECT_TRUE(w1.HitTest(gfx::Point(-1, -1))); 433 EXPECT_TRUE(w1.HitTest(gfx::Point(-1, -1)));
434 EXPECT_FALSE(w1.HitTest(gfx::Point(-2, -2))); 434 EXPECT_FALSE(w1.HitTest(gfx::Point(-2, -2)));
435 435
436 ui::TouchEventImpl pressed( 436 ui::TouchEvent pressed(
437 ui::ET_TOUCH_PRESSED, gfx::Point(50, 50), 0, getTime()); 437 ui::ET_TOUCH_PRESSED, gfx::Point(50, 50), 0, getTime());
438 root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&pressed); 438 root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&pressed);
439 EXPECT_TRUE(w1.HitTest(gfx::Point(-2, -2))); 439 EXPECT_TRUE(w1.HitTest(gfx::Point(-2, -2)));
440 EXPECT_TRUE(w1.HitTest(gfx::Point(-5, -5))); 440 EXPECT_TRUE(w1.HitTest(gfx::Point(-5, -5)));
441 EXPECT_FALSE(w1.HitTest(gfx::Point(-5, -6))); 441 EXPECT_FALSE(w1.HitTest(gfx::Point(-5, -6)));
442 ui::TouchEventImpl released( 442 ui::TouchEvent released(
443 ui::ET_TOUCH_RELEASED, gfx::Point(50, 50), 0, getTime()); 443 ui::ET_TOUCH_RELEASED, gfx::Point(50, 50), 0, getTime());
444 root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&released); 444 root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&released);
445 EXPECT_FALSE(w1.HitTest(gfx::Point(-2, -2))); 445 EXPECT_FALSE(w1.HitTest(gfx::Point(-2, -2)));
446 446
447 // TODO(beng): clip Window to parent. 447 // TODO(beng): clip Window to parent.
448 } 448 }
449 449
450 TEST_F(WindowTest, HitTestMask) { 450 TEST_F(WindowTest, HitTestMask) {
451 Window w1(new MaskedWindowDelegate(gfx::Rect(5, 6, 20, 30))); 451 Window w1(new MaskedWindowDelegate(gfx::Rect(5, 6, 20, 30)));
452 w1.Init(ui::LAYER_NOT_DRAWN); 452 w1.Init(ui::LAYER_NOT_DRAWN);
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
759 EXPECT_EQ(0, delegate.capture_lost_count()); 759 EXPECT_EQ(0, delegate.capture_lost_count());
760 EXPECT_EQ(0, delegate.capture_changed_event_count()); 760 EXPECT_EQ(0, delegate.capture_changed_event_count());
761 EventGenerator generator(root_window(), gfx::Point(50, 50)); 761 EventGenerator generator(root_window(), gfx::Point(50, 50));
762 generator.PressLeftButton(); 762 generator.PressLeftButton();
763 EXPECT_EQ(1, delegate.mouse_event_count()); 763 EXPECT_EQ(1, delegate.mouse_event_count());
764 generator.ReleaseLeftButton(); 764 generator.ReleaseLeftButton();
765 765
766 EXPECT_EQ(2, delegate.mouse_event_count()); 766 EXPECT_EQ(2, delegate.mouse_event_count());
767 delegate.ResetCounts(); 767 delegate.ResetCounts();
768 768
769 ui::TouchEventImpl touchev( 769 ui::TouchEvent touchev(
770 ui::ET_TOUCH_PRESSED, gfx::Point(50, 50), 0, getTime()); 770 ui::ET_TOUCH_PRESSED, gfx::Point(50, 50), 0, getTime());
771 root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&touchev); 771 root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&touchev);
772 EXPECT_EQ(1, delegate.touch_event_count()); 772 EXPECT_EQ(1, delegate.touch_event_count());
773 delegate.ResetCounts(); 773 delegate.ResetCounts();
774 774
775 window->ReleaseCapture(); 775 window->ReleaseCapture();
776 EXPECT_FALSE(window->HasCapture()); 776 EXPECT_FALSE(window->HasCapture());
777 EXPECT_EQ(1, delegate.capture_lost_count()); 777 EXPECT_EQ(1, delegate.capture_lost_count());
778 EXPECT_EQ(1, delegate.capture_changed_event_count()); 778 EXPECT_EQ(1, delegate.capture_changed_event_count());
779 EXPECT_EQ(1, delegate.mouse_event_count()); 779 EXPECT_EQ(1, delegate.mouse_event_count());
780 EXPECT_EQ(1, delegate.touch_event_count()); 780 EXPECT_EQ(1, delegate.touch_event_count());
781 781
782 generator.PressLeftButton(); 782 generator.PressLeftButton();
783 EXPECT_EQ(1, delegate.mouse_event_count()); 783 EXPECT_EQ(1, delegate.mouse_event_count());
784 784
785 ui::TouchEventImpl touchev2( 785 ui::TouchEvent touchev2(
786 ui::ET_TOUCH_PRESSED, gfx::Point(250, 250), 1, getTime()); 786 ui::ET_TOUCH_PRESSED, gfx::Point(250, 250), 1, getTime());
787 root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&touchev2); 787 root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&touchev2);
788 EXPECT_EQ(1, delegate.touch_event_count()); 788 EXPECT_EQ(1, delegate.touch_event_count());
789 789
790 // Removing the capture window from parent should reset the capture window 790 // Removing the capture window from parent should reset the capture window
791 // in the root window. 791 // in the root window.
792 window->SetCapture(); 792 window->SetCapture();
793 EXPECT_EQ(window.get(), aura::client::GetCaptureWindow(root_window())); 793 EXPECT_EQ(window.get(), aura::client::GetCaptureWindow(root_window()));
794 window->parent()->RemoveChild(window.get()); 794 window->parent()->RemoveChild(window.get());
795 EXPECT_FALSE(window->HasCapture()); 795 EXPECT_FALSE(window->HasCapture());
796 EXPECT_EQ(NULL, aura::client::GetCaptureWindow(root_window())); 796 EXPECT_EQ(NULL, aura::client::GetCaptureWindow(root_window()));
797 } 797 }
798 798
799 TEST_F(WindowTest, TouchCaptureCancelsOtherTouches) { 799 TEST_F(WindowTest, TouchCaptureCancelsOtherTouches) {
800 CaptureWindowDelegateImpl delegate1; 800 CaptureWindowDelegateImpl delegate1;
801 scoped_ptr<Window> w1(CreateTestWindowWithDelegate( 801 scoped_ptr<Window> w1(CreateTestWindowWithDelegate(
802 &delegate1, 0, gfx::Rect(0, 0, 20, 20), NULL)); 802 &delegate1, 0, gfx::Rect(0, 0, 20, 20), NULL));
803 CaptureWindowDelegateImpl delegate2; 803 CaptureWindowDelegateImpl delegate2;
804 scoped_ptr<Window> w2(CreateTestWindowWithDelegate( 804 scoped_ptr<Window> w2(CreateTestWindowWithDelegate(
805 &delegate2, 0, gfx::Rect(20, 20, 20, 20), NULL)); 805 &delegate2, 0, gfx::Rect(20, 20, 20, 20), NULL));
806 806
807 // Press on w1. 807 // Press on w1.
808 ui::TouchEventImpl press( 808 ui::TouchEvent press(
809 ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), 0, getTime()); 809 ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), 0, getTime());
810 root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); 810 root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
811 // We will get both GESTURE_BEGIN and GESTURE_TAP_DOWN. 811 // We will get both GESTURE_BEGIN and GESTURE_TAP_DOWN.
812 EXPECT_EQ(2, delegate1.gesture_event_count()); 812 EXPECT_EQ(2, delegate1.gesture_event_count());
813 delegate1.ResetCounts(); 813 delegate1.ResetCounts();
814 w2->SetCapture(); 814 w2->SetCapture();
815 815
816 // The touch was cancelled when the other window 816 // The touch was cancelled when the other window
817 // attained a touch lock. 817 // attained a touch lock.
818 EXPECT_EQ(1, delegate1.touch_event_count()); 818 EXPECT_EQ(1, delegate1.touch_event_count());
819 EXPECT_EQ(0, delegate2.touch_event_count()); 819 EXPECT_EQ(0, delegate2.touch_event_count());
820 820
821 delegate1.ResetCounts(); 821 delegate1.ResetCounts();
822 delegate2.ResetCounts(); 822 delegate2.ResetCounts();
823 823
824 ui::TouchEventImpl move(ui::ET_TOUCH_MOVED, gfx::Point(10, 10), 0, getTime()); 824 ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(10, 10), 0, getTime());
825 root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move); 825 root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move);
826 826
827 // This touch id is now ignored, no scroll fired. 827 // This touch id is now ignored, no scroll fired.
828 EXPECT_EQ(0, delegate1.gesture_event_count()); 828 EXPECT_EQ(0, delegate1.gesture_event_count());
829 EXPECT_EQ(0, delegate2.gesture_event_count()); 829 EXPECT_EQ(0, delegate2.gesture_event_count());
830 830
831 ui::TouchEventImpl release( 831 ui::TouchEvent release(
832 ui::ET_TOUCH_RELEASED, gfx::Point(10, 10), 0, getTime()); 832 ui::ET_TOUCH_RELEASED, gfx::Point(10, 10), 0, getTime());
833 root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); 833 root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release);
834 EXPECT_EQ(0, delegate1.gesture_event_count()); 834 EXPECT_EQ(0, delegate1.gesture_event_count());
835 EXPECT_EQ(0, delegate2.gesture_event_count()); 835 EXPECT_EQ(0, delegate2.gesture_event_count());
836 836
837 // A new press is captured by w2. 837 // A new press is captured by w2.
838 838
839 ui::TouchEventImpl press2( 839 ui::TouchEvent press2(
840 ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), 0, getTime()); 840 ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), 0, getTime());
841 root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2); 841 root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2);
842 EXPECT_EQ(0, delegate1.gesture_event_count()); 842 EXPECT_EQ(0, delegate1.gesture_event_count());
843 // We will get both GESTURE_BEGIN and GESTURE_TAP_DOWN. 843 // We will get both GESTURE_BEGIN and GESTURE_TAP_DOWN.
844 EXPECT_EQ(2, delegate2.gesture_event_count()); 844 EXPECT_EQ(2, delegate2.gesture_event_count());
845 } 845 }
846 846
847 TEST_F(WindowTest, TouchCaptureDoesntCancelCapturedTouches) { 847 TEST_F(WindowTest, TouchCaptureDoesntCancelCapturedTouches) {
848 CaptureWindowDelegateImpl delegate; 848 CaptureWindowDelegateImpl delegate;
849 scoped_ptr<Window> window(CreateTestWindowWithDelegate( 849 scoped_ptr<Window> window(CreateTestWindowWithDelegate(
850 &delegate, 0, gfx::Rect(0, 0, 20, 20), NULL)); 850 &delegate, 0, gfx::Rect(0, 0, 20, 20), NULL));
851 851
852 ui::TouchEventImpl press( 852 ui::TouchEvent press(
853 ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), 0, getTime()); 853 ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), 0, getTime());
854 root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); 854 root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
855 855
856 // We will get both GESTURE_BEGIN and GESTURE_TAP_DOWN. 856 // We will get both GESTURE_BEGIN and GESTURE_TAP_DOWN.
857 EXPECT_EQ(2, delegate.gesture_event_count()); 857 EXPECT_EQ(2, delegate.gesture_event_count());
858 delegate.ResetCounts(); 858 delegate.ResetCounts();
859 859
860 window->SetCapture(); 860 window->SetCapture();
861 EXPECT_EQ(0, delegate.gesture_event_count()); 861 EXPECT_EQ(0, delegate.gesture_event_count());
862 delegate.ResetCounts(); 862 delegate.ResetCounts();
863 863
864 // The move event should still create a gesture, as this touch was 864 // The move event should still create a gesture, as this touch was
865 // on the window which was captured. 865 // on the window which was captured.
866 ui::TouchEventImpl release(ui::ET_TOUCH_RELEASED, 866 ui::TouchEvent release(ui::ET_TOUCH_RELEASED,
867 gfx::Point(10, 10), 0, getTime() + 867 gfx::Point(10, 10), 0, getTime() +
868 base::TimeDelta::FromMilliseconds(50)); 868 base::TimeDelta::FromMilliseconds(50));
869 root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); 869 root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release);
870 EXPECT_EQ(2, delegate.gesture_event_count()); 870 EXPECT_EQ(2, delegate.gesture_event_count());
871 } 871 }
872 872
873 // Assertions around SetCapture() and touch/gestures. 873 // Assertions around SetCapture() and touch/gestures.
874 TEST_F(WindowTest, TransferCaptureTouchEvents) { 874 TEST_F(WindowTest, TransferCaptureTouchEvents) {
875 // Touch on |w1|. 875 // Touch on |w1|.
876 CaptureWindowDelegateImpl d1; 876 CaptureWindowDelegateImpl d1;
877 scoped_ptr<Window> w1(CreateTestWindowWithDelegate( 877 scoped_ptr<Window> w1(CreateTestWindowWithDelegate(
878 &d1, 0, gfx::Rect(0, 0, 20, 20), NULL)); 878 &d1, 0, gfx::Rect(0, 0, 20, 20), NULL));
879 ui::TouchEventImpl p1(ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), 0, getTime()); 879 ui::TouchEvent p1(ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), 0, getTime());
880 root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&p1); 880 root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&p1);
881 // We will get both GESTURE_BEGIN and GESTURE_TAP_DOWN. 881 // We will get both GESTURE_BEGIN and GESTURE_TAP_DOWN.
882 EXPECT_EQ(2, d1.gesture_event_count()); 882 EXPECT_EQ(2, d1.gesture_event_count());
883 d1.ResetCounts(); 883 d1.ResetCounts();
884 884
885 // Touch on |w2| with a different id. 885 // Touch on |w2| with a different id.
886 CaptureWindowDelegateImpl d2; 886 CaptureWindowDelegateImpl d2;
887 scoped_ptr<Window> w2(CreateTestWindowWithDelegate( 887 scoped_ptr<Window> w2(CreateTestWindowWithDelegate(
888 &d2, 0, gfx::Rect(40, 0, 40, 20), NULL)); 888 &d2, 0, gfx::Rect(40, 0, 40, 20), NULL));
889 ui::TouchEventImpl p2(ui::ET_TOUCH_PRESSED, gfx::Point(41, 10), 1, getTime()); 889 ui::TouchEvent p2(ui::ET_TOUCH_PRESSED, gfx::Point(41, 10), 1, getTime());
890 root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&p2); 890 root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&p2);
891 EXPECT_EQ(0, d1.gesture_event_count()); 891 EXPECT_EQ(0, d1.gesture_event_count());
892 // We will get both GESTURE_BEGIN and GESTURE_TAP_DOWN for new target window. 892 // We will get both GESTURE_BEGIN and GESTURE_TAP_DOWN for new target window.
893 EXPECT_EQ(2, d2.gesture_event_count()); 893 EXPECT_EQ(2, d2.gesture_event_count());
894 d1.ResetCounts(); 894 d1.ResetCounts();
895 d2.ResetCounts(); 895 d2.ResetCounts();
896 896
897 // Set capture on |w2|, this should send a cancel to |w1| but not |w2|. 897 // Set capture on |w2|, this should send a cancel to |w1| but not |w2|.
898 w2->SetCapture(); 898 w2->SetCapture();
899 EXPECT_EQ(1, d1.gesture_event_count()); 899 EXPECT_EQ(1, d1.gesture_event_count());
900 EXPECT_EQ(0, d2.gesture_event_count()); 900 EXPECT_EQ(0, d2.gesture_event_count());
901 d1.ResetCounts(); 901 d1.ResetCounts();
902 d2.ResetCounts(); 902 d2.ResetCounts();
903 903
904 CaptureWindowDelegateImpl d3; 904 CaptureWindowDelegateImpl d3;
905 scoped_ptr<Window> w3(CreateTestWindowWithDelegate( 905 scoped_ptr<Window> w3(CreateTestWindowWithDelegate(
906 &d3, 0, gfx::Rect(0, 0, 100, 101), NULL)); 906 &d3, 0, gfx::Rect(0, 0, 100, 101), NULL));
907 // Set capture on w3. No new events should be received. 907 // Set capture on w3. No new events should be received.
908 w3->SetCapture(); 908 w3->SetCapture();
909 EXPECT_EQ(0, d1.gesture_event_count()); 909 EXPECT_EQ(0, d1.gesture_event_count());
910 EXPECT_EQ(0, d2.gesture_event_count()); 910 EXPECT_EQ(0, d2.gesture_event_count());
911 EXPECT_EQ(0, d3.gesture_event_count()); 911 EXPECT_EQ(0, d3.gesture_event_count());
912 912
913 // Move touch id originally associated with |w2|. Since capture was transfered 913 // Move touch id originally associated with |w2|. Since capture was transfered
914 // from 2 to 3 only |w3| should get the event. 914 // from 2 to 3 only |w3| should get the event.
915 ui::TouchEventImpl m3(ui::ET_TOUCH_MOVED, gfx::Point(110, 105), 1, getTime()); 915 ui::TouchEvent m3(ui::ET_TOUCH_MOVED, gfx::Point(110, 105), 1, getTime());
916 root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&m3); 916 root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&m3);
917 EXPECT_EQ(0, d1.gesture_event_count()); 917 EXPECT_EQ(0, d1.gesture_event_count());
918 EXPECT_EQ(0, d2.gesture_event_count()); 918 EXPECT_EQ(0, d2.gesture_event_count());
919 // |w3| gets two events, both scroll related. 919 // |w3| gets two events, both scroll related.
920 EXPECT_EQ(2, d3.gesture_event_count()); 920 EXPECT_EQ(2, d3.gesture_event_count());
921 } 921 }
922 922
923 // Changes capture while capture is already ongoing. 923 // Changes capture while capture is already ongoing.
924 TEST_F(WindowTest, ChangeCaptureWhileMouseDown) { 924 TEST_F(WindowTest, ChangeCaptureWhileMouseDown) {
925 CaptureWindowDelegateImpl delegate; 925 CaptureWindowDelegateImpl delegate;
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
1317 new GestureTrackPositionDelegate); 1317 new GestureTrackPositionDelegate);
1318 scoped_ptr<Window> window(CreateTestWindowWithDelegate(delegate.get(), -1234, 1318 scoped_ptr<Window> window(CreateTestWindowWithDelegate(delegate.get(), -1234,
1319 gfx::Rect(0, 0, 20, 20), NULL)); 1319 gfx::Rect(0, 0, 20, 20), NULL));
1320 1320
1321 // Rotate the root-window clock-wise 90 degrees. 1321 // Rotate the root-window clock-wise 90 degrees.
1322 ui::Transform transform; 1322 ui::Transform transform;
1323 transform.SetRotate(90.0f); 1323 transform.SetRotate(90.0f);
1324 transform.ConcatTranslate(size.height(), 0); 1324 transform.ConcatTranslate(size.height(), 0);
1325 root_window()->SetTransform(transform); 1325 root_window()->SetTransform(transform);
1326 1326
1327 ui::TouchEventImpl press( 1327 ui::TouchEvent press(
1328 ui::ET_TOUCH_PRESSED, gfx::Point(size.height() - 10, 10), 0, getTime()); 1328 ui::ET_TOUCH_PRESSED, gfx::Point(size.height() - 10, 10), 0, getTime());
1329 root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); 1329 root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
1330 EXPECT_EQ(gfx::Point(10, 10).ToString(), delegate->position().ToString()); 1330 EXPECT_EQ(gfx::Point(10, 10).ToString(), delegate->position().ToString());
1331 } 1331 }
1332 1332
1333 // Various assertions for transient children. 1333 // Various assertions for transient children.
1334 TEST_F(WindowTest, TransientChildren) { 1334 TEST_F(WindowTest, TransientChildren) {
1335 scoped_ptr<Window> parent(CreateTestWindowWithId(0, NULL)); 1335 scoped_ptr<Window> parent(CreateTestWindowWithId(0, NULL));
1336 scoped_ptr<Window> w1(CreateTestWindowWithId(1, parent.get())); 1336 scoped_ptr<Window> w1(CreateTestWindowWithId(1, parent.get()));
1337 scoped_ptr<Window> w3(CreateTestWindowWithId(3, parent.get())); 1337 scoped_ptr<Window> w3(CreateTestWindowWithId(3, parent.get()));
(...skipping 1118 matching lines...) Expand 10 before | Expand all | Expand 10 after
2456 element->Step(start_time + base::TimeDelta::FromMilliseconds(1000)); 2456 element->Step(start_time + base::TimeDelta::FromMilliseconds(1000));
2457 2457
2458 // No bounds changed notification at the end of animation since layer 2458 // No bounds changed notification at the end of animation since layer
2459 // delegate is NULL. 2459 // delegate is NULL.
2460 EXPECT_FALSE(delegate.bounds_changed()); 2460 EXPECT_FALSE(delegate.bounds_changed());
2461 EXPECT_NE("0,0 100x100", window->bounds().ToString()); 2461 EXPECT_NE("0,0 100x100", window->bounds().ToString());
2462 } 2462 }
2463 2463
2464 } // namespace test 2464 } // namespace test
2465 } // namespace aura 2465 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/window_delegate.h ('k') | ui/base/event.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698