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

Side by Side Diff: trunk/src/ash/host/ash_window_tree_host_x11_unittest.cc

Issue 276773004: Revert 269892 "linux_aura: Compile ash into chrome." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « trunk/src/ash/host/ash_window_tree_host_x11.cc ('k') | trunk/src/build/common.gypi » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ash/host/ash_window_tree_host_x11.h" 5 #include "ash/host/ash_window_tree_host_x11.h"
6 6
7 #undef None 7 #undef None
8 #undef Bool 8 #undef Bool
9 9
10 #include "base/sys_info.h" 10 #include "base/sys_info.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 int last_touch_id_; 49 int last_touch_id_;
50 gfx::Point last_touch_location_; 50 gfx::Point last_touch_location_;
51 51
52 DISALLOW_COPY_AND_ASSIGN(RootWindowEventHandler); 52 DISALLOW_COPY_AND_ASSIGN(RootWindowEventHandler);
53 }; 53 };
54 54
55 } // namespace 55 } // namespace
56 56
57 namespace ash { 57 namespace ash {
58 58
59 class AshWindowTreeHostX11Test : public aura::test::AuraTestBase { 59 typedef aura::test::AuraTestBase WindowTreeHostX11Test;
60 public:
61 virtual void SetUp() OVERRIDE {
62 aura::test::AuraTestBase::SetUp();
63
64 #if defined(OS_CHROMEOS)
65 // Fake a ChromeOS running env.
66 const char* kLsbRelease = "CHROMEOS_RELEASE_NAME=Chromium OS\n";
67 base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease, base::Time());
68 #endif
69 }
70
71 virtual void TearDown() OVERRIDE {
72 aura::test::AuraTestBase::TearDown();
73
74 #if defined(OS_CHROMEOS)
75 // Revert the CrOS testing env otherwise the following non-CrOS aura
76 // tests will fail.
77 // Fake a ChromeOS running env.
78 const char* kLsbRelease = "";
79 base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease, base::Time());
80 #endif
81 }
82 };
83 60
84 // Send X touch events to one WindowTreeHost. The WindowTreeHost's 61 // Send X touch events to one WindowTreeHost. The WindowTreeHost's
85 // delegate will get corresponding ui::TouchEvent if the touch events 62 // delegate will get corresponding ui::TouchEvent if the touch events
86 // are targeting this WindowTreeHost. 63 // are winthin the bound of the WindowTreeHost.
87 TEST_F(AshWindowTreeHostX11Test, DispatchTouchEventToOneRootWindow) { 64 TEST_F(WindowTreeHostX11Test, DispatchTouchEventToOneRootWindow) {
65 // Fake a ChromeOS running env.
66 const char* kLsbRelease = "CHROMEOS_RELEASE_NAME=Chromium OS\n";
67 base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease, base::Time());
68
88 scoped_ptr<AshWindowTreeHostX11> window_tree_host( 69 scoped_ptr<AshWindowTreeHostX11> window_tree_host(
89 new AshWindowTreeHostX11(gfx::Rect(0, 0, 2560, 1700))); 70 new AshWindowTreeHostX11(gfx::Rect(0, 0, 2560, 1700)));
90 window_tree_host->InitHost(); 71 window_tree_host->InitHost();
91 scoped_ptr<RootWindowEventHandler> handler( 72 scoped_ptr<RootWindowEventHandler> handler(
92 new RootWindowEventHandler(window_tree_host.get())); 73 new RootWindowEventHandler(window_tree_host.get()));
93 74
94 std::vector<unsigned int> devices; 75 std::vector<unsigned int> devices;
95 devices.push_back(0); 76 devices.push_back(0);
96 ui::SetUpTouchDevicesForTest(devices); 77 ui::SetUpTouchDevicesForTest(devices);
97 std::vector<ui::Valuator> valuators; 78 std::vector<ui::Valuator> valuators;
(...skipping 26 matching lines...) Expand all
124 EXPECT_EQ(gfx::Point(1500, 1600), handler->last_touch_location()); 105 EXPECT_EQ(gfx::Point(1500, 1600), handler->last_touch_location());
125 106
126 scoped_xevent.InitTouchEvent( 107 scoped_xevent.InitTouchEvent(
127 0, XI_TouchEnd, 5, gfx::Point(1500, 1600), valuators); 108 0, XI_TouchEnd, 5, gfx::Point(1500, 1600), valuators);
128 window_tree_host->DispatchEvent(scoped_xevent); 109 window_tree_host->DispatchEvent(scoped_xevent);
129 EXPECT_EQ(ui::ET_TOUCH_RELEASED, handler->last_touch_type()); 110 EXPECT_EQ(ui::ET_TOUCH_RELEASED, handler->last_touch_type());
130 EXPECT_EQ(0, handler->last_touch_id()); 111 EXPECT_EQ(0, handler->last_touch_id());
131 EXPECT_EQ(gfx::Point(1500, 1600), handler->last_touch_location()); 112 EXPECT_EQ(gfx::Point(1500, 1600), handler->last_touch_location());
132 113
133 handler.reset(); 114 handler.reset();
115
116 // Revert the CrOS testing env otherwise the following non-CrOS aura
117 // tests will fail.
118 // Fake a ChromeOS running env.
119 kLsbRelease = "";
120 base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease, base::Time());
134 } 121 }
135 122
136 // Send X touch events to two WindowTreeHost. The WindowTreeHost which is 123 // Send X touch events to two WindowTreeHost. The WindowTreeHost which is
137 // the event target of the X touch events should generate the corresponding 124 // the event target of the X touch events should generate the corresponding
138 // ui::TouchEvent for its delegate. 125 // ui::TouchEvent for its delegate.
139 TEST_F(AshWindowTreeHostX11Test, DispatchTouchEventToTwoRootWindow) { 126 TEST_F(WindowTreeHostX11Test, DispatchTouchEventToTwoRootWindow) {
127 // Fake a ChromeOS running env.
128 const char* kLsbRelease = "CHROMEOS_RELEASE_NAME=Chromium OS\n";
129 base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease, base::Time());
130
140 scoped_ptr<AshWindowTreeHostX11> window_tree_host1( 131 scoped_ptr<AshWindowTreeHostX11> window_tree_host1(
141 new AshWindowTreeHostX11(gfx::Rect(0, 0, 2560, 1700))); 132 new AshWindowTreeHostX11(gfx::Rect(0, 0, 2560, 1700)));
142 window_tree_host1->InitHost(); 133 window_tree_host1->InitHost();
143 scoped_ptr<RootWindowEventHandler> handler1( 134 scoped_ptr<RootWindowEventHandler> handler1(
144 new RootWindowEventHandler(window_tree_host1.get())); 135 new RootWindowEventHandler(window_tree_host1.get()));
145 136
146 int host2_y_offset = 1700; 137 int host2_y_offset = 1700;
147 scoped_ptr<AshWindowTreeHostX11> window_tree_host2( 138 scoped_ptr<AshWindowTreeHostX11> window_tree_host2(
148 new AshWindowTreeHostX11(gfx::Rect(0, host2_y_offset, 1920, 1080))); 139 new AshWindowTreeHostX11(gfx::Rect(0, host2_y_offset, 1920, 1080)));
149 window_tree_host2->InitHost(); 140 window_tree_host2->InitHost();
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 EXPECT_EQ(ui::ET_UNKNOWN, handler1->last_touch_type()); 219 EXPECT_EQ(ui::ET_UNKNOWN, handler1->last_touch_type());
229 EXPECT_EQ(-1, handler1->last_touch_id()); 220 EXPECT_EQ(-1, handler1->last_touch_id());
230 EXPECT_EQ(gfx::Point(0, 0), handler1->last_touch_location()); 221 EXPECT_EQ(gfx::Point(0, 0), handler1->last_touch_location());
231 EXPECT_EQ(ui::ET_TOUCH_RELEASED, handler2->last_touch_type()); 222 EXPECT_EQ(ui::ET_TOUCH_RELEASED, handler2->last_touch_type());
232 EXPECT_EQ(1, handler2->last_touch_id()); 223 EXPECT_EQ(1, handler2->last_touch_id());
233 EXPECT_EQ(gfx::Point(1600, 2650 - host2_y_offset), 224 EXPECT_EQ(gfx::Point(1600, 2650 - host2_y_offset),
234 handler2->last_touch_location()); 225 handler2->last_touch_location());
235 226
236 handler1.reset(); 227 handler1.reset();
237 handler2.reset(); 228 handler2.reset();
229
230 // Revert the CrOS testing env otherwise the following non-CrOS aura
231 // tests will fail.
232 // Fake a ChromeOS running env.
233 kLsbRelease = "";
234 base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease, base::Time());
238 } 235 }
239 236
240 } // namespace aura 237 } // namespace aura
OLDNEW
« no previous file with comments | « trunk/src/ash/host/ash_window_tree_host_x11.cc ('k') | trunk/src/build/common.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698