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

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

Issue 251743004: aura: Remove WindowTreeHost::QueryMouseLocation(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
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
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 <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/strings/string_number_conversions.h" 13 #include "base/strings/string_number_conversions.h"
14 #include "base/strings/string_util.h" 14 #include "base/strings/string_util.h"
15 #include "base/strings/stringprintf.h" 15 #include "base/strings/stringprintf.h"
16 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
17 #include "ui/aura/client/capture_client.h" 17 #include "ui/aura/client/capture_client.h"
18 #include "ui/aura/client/focus_change_observer.h" 18 #include "ui/aura/client/focus_change_observer.h"
19 #include "ui/aura/client/visibility_client.h" 19 #include "ui/aura/client/visibility_client.h"
20 #include "ui/aura/client/window_tree_client.h" 20 #include "ui/aura/client/window_tree_client.h"
21 #include "ui/aura/test/aura_test_base.h" 21 #include "ui/aura/test/aura_test_base.h"
22 #include "ui/aura/test/aura_test_utils.h"
22 #include "ui/aura/test/event_generator.h" 23 #include "ui/aura/test/event_generator.h"
23 #include "ui/aura/test/test_window_delegate.h" 24 #include "ui/aura/test/test_window_delegate.h"
24 #include "ui/aura/test/test_windows.h" 25 #include "ui/aura/test/test_windows.h"
25 #include "ui/aura/test/window_test_api.h" 26 #include "ui/aura/test/window_test_api.h"
26 #include "ui/aura/window_delegate.h" 27 #include "ui/aura/window_delegate.h"
27 #include "ui/aura/window_event_dispatcher.h" 28 #include "ui/aura/window_event_dispatcher.h"
28 #include "ui/aura/window_observer.h" 29 #include "ui/aura/window_observer.h"
29 #include "ui/aura/window_property.h" 30 #include "ui/aura/window_property.h"
30 #include "ui/aura/window_tree_host.h" 31 #include "ui/aura/window_tree_host.h"
31 #include "ui/base/hit_test.h" 32 #include "ui/base/hit_test.h"
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 TEST_F(WindowTest, MoveCursorToWithTransformRootWindow) { 368 TEST_F(WindowTest, MoveCursorToWithTransformRootWindow) {
368 #endif 369 #endif
369 gfx::Transform transform; 370 gfx::Transform transform;
370 transform.Translate(100.0, 100.0); 371 transform.Translate(100.0, 100.0);
371 transform.Rotate(90.0); 372 transform.Rotate(90.0);
372 transform.Scale(2.0, 5.0); 373 transform.Scale(2.0, 5.0);
373 host()->SetRootTransform(transform); 374 host()->SetRootTransform(transform);
374 host()->MoveCursorTo(gfx::Point(10, 10)); 375 host()->MoveCursorTo(gfx::Point(10, 10));
375 #if !defined(OS_WIN) 376 #if !defined(OS_WIN)
376 gfx::Point mouse_location; 377 gfx::Point mouse_location;
377 EXPECT_TRUE(host()->QueryMouseLocation(&mouse_location)); 378 WindowTreeHostTestApi test_api(host());
378 // TODO(yoshiki): fix this to build on Windows. See crbug.com/133413.OD 379 // TODO(yoshiki): fix this to build on Windows. See crbug.com/133413.OD
379 EXPECT_EQ("50,120", mouse_location.ToString()); 380 EXPECT_EQ("50,120",
381 test_api.last_cursor_request_position_in_host().ToString());
380 #endif 382 #endif
381 EXPECT_EQ("10,10", gfx::Screen::GetScreenFor( 383 EXPECT_EQ("10,10", gfx::Screen::GetScreenFor(
382 root_window())->GetCursorScreenPoint().ToString()); 384 root_window())->GetCursorScreenPoint().ToString());
383 } 385 }
384 386
385 // Tests Window::ConvertPointToWindow() with transform to non-root windows. 387 // Tests Window::ConvertPointToWindow() with transform to non-root windows.
386 TEST_F(WindowTest, MoveCursorToWithTransformWindow) { 388 TEST_F(WindowTest, MoveCursorToWithTransformWindow) {
387 scoped_ptr<Window> w1( 389 scoped_ptr<Window> w1(
388 CreateTestWindow(SK_ColorWHITE, 1, gfx::Rect(10, 10, 500, 500), 390 CreateTestWindow(SK_ColorWHITE, 1, gfx::Rect(10, 10, 500, 500),
389 root_window())); 391 root_window()));
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 host()->SetRootTransform(root_transform); 456 host()->SetRootTransform(root_transform);
455 w1->SetTransform(transform); 457 w1->SetTransform(transform);
456 w11->SetTransform(transform); 458 w11->SetTransform(transform);
457 w111->SetTransform(transform); 459 w111->SetTransform(transform);
458 w1111->SetTransform(transform); 460 w1111->SetTransform(transform);
459 461
460 w1111->MoveCursorTo(gfx::Point(10, 10)); 462 w1111->MoveCursorTo(gfx::Point(10, 10));
461 463
462 #if !defined(OS_WIN) 464 #if !defined(OS_WIN)
463 // TODO(yoshiki): fix this to build on Windows. See crbug.com/133413. 465 // TODO(yoshiki): fix this to build on Windows. See crbug.com/133413.
464 gfx::Point mouse_location; 466 WindowTreeHostTestApi test_api(host());
465 EXPECT_TRUE(host()->QueryMouseLocation(&mouse_location)); 467 EXPECT_EQ("169,80",
466 EXPECT_EQ("169,80", mouse_location.ToString()); 468 test_api.last_cursor_request_position_in_host().ToString());
467 #endif 469 #endif
468 EXPECT_EQ("20,53", 470 EXPECT_EQ("20,53",
469 gfx::Screen::GetScreenFor(root)->GetCursorScreenPoint().ToString()); 471 gfx::Screen::GetScreenFor(root)->GetCursorScreenPoint().ToString());
470 } 472 }
471 473
472 TEST_F(WindowTest, GetEventHandlerForPoint) { 474 TEST_F(WindowTest, GetEventHandlerForPoint) {
473 scoped_ptr<Window> w1( 475 scoped_ptr<Window> w1(
474 CreateTestWindow(SK_ColorWHITE, 1, gfx::Rect(10, 10, 500, 500), 476 CreateTestWindow(SK_ColorWHITE, 1, gfx::Rect(10, 10, 500, 500),
475 root_window())); 477 root_window()));
476 scoped_ptr<Window> w11( 478 scoped_ptr<Window> w11(
(...skipping 2870 matching lines...) Expand 10 before | Expand all | Expand 10 after
3347 BuildRootLayerTreeDescription(*root.layer())) 3349 BuildRootLayerTreeDescription(*root.layer()))
3348 << "layer tree doesn't match at " << i; 3350 << "layer tree doesn't match at " << i;
3349 EXPECT_EQ(data[i].expected_description, 3351 EXPECT_EQ(data[i].expected_description,
3350 BuildRootWindowTreeDescription(root)) 3352 BuildRootWindowTreeDescription(root))
3351 << "window tree doesn't match at " << i; 3353 << "window tree doesn't match at " << i;
3352 } 3354 }
3353 } 3355 }
3354 3356
3355 } // namespace test 3357 } // namespace test
3356 } // namespace aura 3358 } // namespace aura
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698