OLD | NEW |
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 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 #else | 367 #else |
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 EXPECT_TRUE(host()->QueryMouseLocation(&mouse_location)); | |
378 // TODO(yoshiki): fix this to build on Windows. See crbug.com/133413.OD | 377 // TODO(yoshiki): fix this to build on Windows. See crbug.com/133413.OD |
379 EXPECT_EQ("50,120", mouse_location.ToString()); | 378 EXPECT_EQ("50,120", QueryLatestMousePositionRequestInHost(host()).ToString()); |
380 #endif | 379 #endif |
381 EXPECT_EQ("10,10", gfx::Screen::GetScreenFor( | 380 EXPECT_EQ("10,10", gfx::Screen::GetScreenFor( |
382 root_window())->GetCursorScreenPoint().ToString()); | 381 root_window())->GetCursorScreenPoint().ToString()); |
383 } | 382 } |
384 | 383 |
385 // Tests Window::ConvertPointToWindow() with transform to non-root windows. | 384 // Tests Window::ConvertPointToWindow() with transform to non-root windows. |
386 TEST_F(WindowTest, MoveCursorToWithTransformWindow) { | 385 TEST_F(WindowTest, MoveCursorToWithTransformWindow) { |
387 scoped_ptr<Window> w1( | 386 scoped_ptr<Window> w1( |
388 CreateTestWindow(SK_ColorWHITE, 1, gfx::Rect(10, 10, 500, 500), | 387 CreateTestWindow(SK_ColorWHITE, 1, gfx::Rect(10, 10, 500, 500), |
389 root_window())); | 388 root_window())); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 host()->SetRootTransform(root_transform); | 453 host()->SetRootTransform(root_transform); |
455 w1->SetTransform(transform); | 454 w1->SetTransform(transform); |
456 w11->SetTransform(transform); | 455 w11->SetTransform(transform); |
457 w111->SetTransform(transform); | 456 w111->SetTransform(transform); |
458 w1111->SetTransform(transform); | 457 w1111->SetTransform(transform); |
459 | 458 |
460 w1111->MoveCursorTo(gfx::Point(10, 10)); | 459 w1111->MoveCursorTo(gfx::Point(10, 10)); |
461 | 460 |
462 #if !defined(OS_WIN) | 461 #if !defined(OS_WIN) |
463 // TODO(yoshiki): fix this to build on Windows. See crbug.com/133413. | 462 // TODO(yoshiki): fix this to build on Windows. See crbug.com/133413. |
464 gfx::Point mouse_location; | 463 EXPECT_EQ("169,80", QueryLatestMousePositionRequestInHost(host()).ToString()); |
465 EXPECT_TRUE(host()->QueryMouseLocation(&mouse_location)); | |
466 EXPECT_EQ("169,80", mouse_location.ToString()); | |
467 #endif | 464 #endif |
468 EXPECT_EQ("20,53", | 465 EXPECT_EQ("20,53", |
469 gfx::Screen::GetScreenFor(root)->GetCursorScreenPoint().ToString()); | 466 gfx::Screen::GetScreenFor(root)->GetCursorScreenPoint().ToString()); |
470 } | 467 } |
471 | 468 |
472 TEST_F(WindowTest, GetEventHandlerForPoint) { | 469 TEST_F(WindowTest, GetEventHandlerForPoint) { |
473 scoped_ptr<Window> w1( | 470 scoped_ptr<Window> w1( |
474 CreateTestWindow(SK_ColorWHITE, 1, gfx::Rect(10, 10, 500, 500), | 471 CreateTestWindow(SK_ColorWHITE, 1, gfx::Rect(10, 10, 500, 500), |
475 root_window())); | 472 root_window())); |
476 scoped_ptr<Window> w11( | 473 scoped_ptr<Window> w11( |
(...skipping 2870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3347 BuildRootLayerTreeDescription(*root.layer())) | 3344 BuildRootLayerTreeDescription(*root.layer())) |
3348 << "layer tree doesn't match at " << i; | 3345 << "layer tree doesn't match at " << i; |
3349 EXPECT_EQ(data[i].expected_description, | 3346 EXPECT_EQ(data[i].expected_description, |
3350 BuildRootWindowTreeDescription(root)) | 3347 BuildRootWindowTreeDescription(root)) |
3351 << "window tree doesn't match at " << i; | 3348 << "window tree doesn't match at " << i; |
3352 } | 3349 } |
3353 } | 3350 } |
3354 | 3351 |
3355 } // namespace test | 3352 } // namespace test |
3356 } // namespace aura | 3353 } // namespace aura |
OLD | NEW |