| Index: ui/aura/window_unittest.cc
|
| diff --git a/ui/aura/window_unittest.cc b/ui/aura/window_unittest.cc
|
| index f16fd54285e747b1b909ae3291e8a78af1850f57..d8124464cb8911baf057499741469529847cc892 100644
|
| --- a/ui/aura/window_unittest.cc
|
| +++ b/ui/aura/window_unittest.cc
|
| @@ -371,7 +371,7 @@ TEST_F(WindowTest, StackChildAbove) {
|
| EXPECT_EQ(child3.layer(), parent.layer()->children()[2]);
|
| }
|
|
|
| -// Various destruction assertions.
|
| +// Various capture assertions.
|
| TEST_F(WindowTest, CaptureTests) {
|
| aura::RootWindow* root_window = aura::RootWindow::GetInstance();
|
| CaptureWindowDelegateImpl delegate;
|
| @@ -415,6 +415,35 @@ TEST_F(WindowTest, CaptureTests) {
|
| EXPECT_EQ(NULL, root_window->capture_window());
|
| }
|
|
|
| +// Changes capture while capture is already ongoing.
|
| +TEST_F(WindowTest, ChangeCaptureWhileMouseDown) {
|
| + CaptureWindowDelegateImpl delegate;
|
| + scoped_ptr<Window> window(CreateTestWindowWithDelegate(
|
| + &delegate, 0, gfx::Rect(0, 0, 20, 20), NULL));
|
| + CaptureWindowDelegateImpl delegate2;
|
| + scoped_ptr<Window> w2(CreateTestWindowWithDelegate(
|
| + &delegate2, 0, gfx::Rect(20, 20, 20, 20), NULL));
|
| + EXPECT_FALSE(window->HasCapture());
|
| +
|
| + // Do a capture.
|
| + window->SetCapture();
|
| + delegate.set_mouse_event_count(0);
|
| + EXPECT_TRUE(window->HasCapture());
|
| + EXPECT_EQ(0, delegate.capture_lost_count());
|
| + EventGenerator generator(gfx::Point(50, 50));
|
| + generator.PressLeftButton();
|
| + EXPECT_EQ(1, delegate.mouse_event_count());
|
| + delegate.set_mouse_event_count(0);
|
| +
|
| + // Reset the capture.
|
| + window->ReleaseCapture();
|
| + w2->SetCapture();
|
| + delegate2.set_mouse_event_count(0);
|
| + generator.MoveMouseTo(gfx::Point(40, 40));
|
| + EXPECT_EQ(0, delegate.mouse_event_count());
|
| + EXPECT_EQ(2, delegate2.mouse_event_count());
|
| +}
|
| +
|
| // Verifies capture is reset when a window is destroyed.
|
| TEST_F(WindowTest, ReleaseCaptureOnDestroy) {
|
| RootWindow* root_window = RootWindow::GetInstance();
|
|
|