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

Side by Side Diff: ash/wm/workspace/workspace_event_handler_unittest.cc

Issue 37733003: Make GetRootWindow() return a Window instead of a RootWindow. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 1 month 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
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 "ash/wm/workspace/workspace_event_handler.h" 5 #include "ash/wm/workspace/workspace_event_handler.h"
6 6
7 #include "ash/screen_ash.h" 7 #include "ash/screen_ash.h"
8 #include "ash/shell.h" 8 #include "ash/shell.h"
9 #include "ash/test/ash_test_base.h" 9 #include "ash/test/ash_test_base.h"
10 #include "ash/wm/window_state.h" 10 #include "ash/wm/window_state.h"
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 249
250 TEST_F(WorkspaceEventHandlerTest, DoubleClickCaptionTogglesMaximize) { 250 TEST_F(WorkspaceEventHandlerTest, DoubleClickCaptionTogglesMaximize) {
251 aura::test::TestWindowDelegate wd; 251 aura::test::TestWindowDelegate wd;
252 scoped_ptr<aura::Window> window( 252 scoped_ptr<aura::Window> window(
253 CreateTestWindow(&wd, gfx::Rect(1, 2, 30, 40))); 253 CreateTestWindow(&wd, gfx::Rect(1, 2, 30, 40)));
254 window->SetProperty(aura::client::kCanMaximizeKey, true); 254 window->SetProperty(aura::client::kCanMaximizeKey, true);
255 wd.set_window_component(HTCAPTION); 255 wd.set_window_component(HTCAPTION);
256 256
257 wm::WindowState* window_state = wm::GetWindowState(window.get()); 257 wm::WindowState* window_state = wm::GetWindowState(window.get());
258 EXPECT_FALSE(window_state->IsMaximized()); 258 EXPECT_FALSE(window_state->IsMaximized());
259 aura::RootWindow* root = Shell::GetPrimaryRootWindow(); 259 aura::Window* root = Shell::GetPrimaryRootWindow();
260 aura::test::EventGenerator generator(root, window.get()); 260 aura::test::EventGenerator generator(root, window.get());
261 generator.DoubleClickLeftButton(); 261 generator.DoubleClickLeftButton();
262 EXPECT_NE("1,2 30x40", window->bounds().ToString()); 262 EXPECT_NE("1,2 30x40", window->bounds().ToString());
263 263
264 EXPECT_TRUE(window_state->IsMaximized()); 264 EXPECT_TRUE(window_state->IsMaximized());
265 generator.DoubleClickLeftButton(); 265 generator.DoubleClickLeftButton();
266 266
267 EXPECT_FALSE(window_state->IsMaximized()); 267 EXPECT_FALSE(window_state->IsMaximized());
268 EXPECT_EQ("1,2 30x40", window->bounds().ToString()); 268 EXPECT_EQ("1,2 30x40", window->bounds().ToString());
269 269
270 // Double-clicking the middle button shouldn't toggle the maximized state. 270 // Double-clicking the middle button shouldn't toggle the maximized state.
271 WindowPropertyObserver observer(window.get()); 271 WindowPropertyObserver observer(window.get());
272 ui::MouseEvent press(ui::ET_MOUSE_PRESSED, generator.current_location(), 272 ui::MouseEvent press(ui::ET_MOUSE_PRESSED, generator.current_location(),
273 generator.current_location(), 273 generator.current_location(),
274 ui::EF_MIDDLE_MOUSE_BUTTON | ui::EF_IS_DOUBLE_CLICK); 274 ui::EF_MIDDLE_MOUSE_BUTTON | ui::EF_IS_DOUBLE_CLICK);
275 root->AsRootWindowHostDelegate()->OnHostMouseEvent(&press); 275 aura::WindowEventDispatcher* dispatcher = root->GetDispatcher();
276 dispatcher->AsRootWindowHostDelegate()->OnHostMouseEvent(&press);
276 ui::MouseEvent release(ui::ET_MOUSE_RELEASED, generator.current_location(), 277 ui::MouseEvent release(ui::ET_MOUSE_RELEASED, generator.current_location(),
277 generator.current_location(), 278 generator.current_location(),
278 ui::EF_IS_DOUBLE_CLICK); 279 ui::EF_IS_DOUBLE_CLICK);
279 root->AsRootWindowHostDelegate()->OnHostMouseEvent(&release); 280 dispatcher->AsRootWindowHostDelegate()->OnHostMouseEvent(&release);
280 281
281 EXPECT_FALSE(window_state->IsMaximized()); 282 EXPECT_FALSE(window_state->IsMaximized());
282 EXPECT_EQ("1,2 30x40", window->bounds().ToString()); 283 EXPECT_EQ("1,2 30x40", window->bounds().ToString());
283 EXPECT_FALSE(observer.DidPropertyChange(aura::client::kShowStateKey)); 284 EXPECT_FALSE(observer.DidPropertyChange(aura::client::kShowStateKey));
284 } 285 }
285 286
286 TEST_F(WorkspaceEventHandlerTest, DoubleTapCaptionTogglesMaximize) { 287 TEST_F(WorkspaceEventHandlerTest, DoubleTapCaptionTogglesMaximize) {
287 aura::test::TestWindowDelegate wd; 288 aura::test::TestWindowDelegate wd;
288 gfx::Rect bounds(10, 20, 30, 40); 289 gfx::Rect bounds(10, 20, 30, 40);
289 scoped_ptr<aura::Window> window(CreateTestWindow(&wd, bounds)); 290 scoped_ptr<aura::Window> window(CreateTestWindow(&wd, bounds));
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 ASSERT_TRUE(aura::client::GetWindowMoveClient(window->parent())); 339 ASSERT_TRUE(aura::client::GetWindowMoveClient(window->parent()));
339 base::MessageLoop::current()->DeleteSoon(FROM_HERE, window.get()); 340 base::MessageLoop::current()->DeleteSoon(FROM_HERE, window.get());
340 aura::client::GetWindowMoveClient(window->parent()) 341 aura::client::GetWindowMoveClient(window->parent())
341 ->RunMoveLoop(window.release(), 342 ->RunMoveLoop(window.release(),
342 gfx::Vector2d(), 343 gfx::Vector2d(),
343 aura::client::WINDOW_MOVE_SOURCE_MOUSE); 344 aura::client::WINDOW_MOVE_SOURCE_MOUSE);
344 } 345 }
345 346
346 } // namespace internal 347 } // namespace internal
347 } // namespace ash 348 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/workspace/phantom_window_controller.cc ('k') | ash/wm/workspace/workspace_layout_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698