| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/views/widget/desktop_aura/desktop_screen_x11.h" | 5 #include "ui/views/widget/desktop_aura/desktop_screen_x11.h" |
| 6 | 6 |
| 7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 #include "ui/gfx/display_observer.h" | 9 #include "ui/gfx/display_observer.h" |
| 10 #include "ui/views/test/views_test_base.h" | 10 #include "ui/views/test/views_test_base.h" |
| 11 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" | 11 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" |
| 12 #include "ui/views/widget/desktop_aura/desktop_root_window_host_x11.h" | 12 #include "ui/views/widget/desktop_aura/desktop_root_window_host_x11.h" |
| 13 #include "ui/views/widget/desktop_aura/x11_desktop_handler.h" |
| 13 | 14 |
| 14 namespace views { | 15 namespace views { |
| 15 | 16 |
| 16 const int64 kFirstDisplay = 5321829; | 17 const int64 kFirstDisplay = 5321829; |
| 17 const int64 kSecondDisplay = 928310; | 18 const int64 kSecondDisplay = 928310; |
| 18 | 19 |
| 19 class DesktopScreenX11Test : public views::ViewsTestBase, | 20 class DesktopScreenX11Test : public views::ViewsTestBase, |
| 20 public gfx::DisplayObserver { | 21 public gfx::DisplayObserver { |
| 21 public: | 22 public: |
| 22 DesktopScreenX11Test() {} | 23 DesktopScreenX11Test() {} |
| 23 virtual ~DesktopScreenX11Test() {} | 24 virtual ~DesktopScreenX11Test() {} |
| 24 | 25 |
| 25 // Overridden from testing::Test: | 26 // Overridden from testing::Test: |
| 26 virtual void SetUp() OVERRIDE { | 27 virtual void SetUp() OVERRIDE { |
| 27 ViewsTestBase::SetUp(); | 28 ViewsTestBase::SetUp(); |
| 28 // Initialize the world to the single monitor case. | 29 // Initialize the world to the single monitor case. |
| 29 std::vector<gfx::Display> displays; | 30 std::vector<gfx::Display> displays; |
| 30 displays.push_back(gfx::Display(kFirstDisplay, gfx::Rect(0, 0, 640, 480))); | 31 displays.push_back(gfx::Display(kFirstDisplay, gfx::Rect(0, 0, 640, 480))); |
| 31 screen_.reset(new DesktopScreenX11(displays)); | 32 screen_.reset(new DesktopScreenX11(displays)); |
| 32 screen_->AddObserver(this); | 33 screen_->AddObserver(this); |
| 34 |
| 35 // We want to have a synchronous activation behavior. |
| 36 X11DesktopHandler::get()->SetWMSupportsActiveWindowForTests(false); |
| 33 } | 37 } |
| 34 | 38 |
| 35 virtual void TearDown() OVERRIDE { | 39 virtual void TearDown() OVERRIDE { |
| 36 screen_.reset(); | 40 screen_.reset(); |
| 37 ViewsTestBase::TearDown(); | 41 ViewsTestBase::TearDown(); |
| 38 } | 42 } |
| 39 | 43 |
| 40 protected: | 44 protected: |
| 41 std::vector<gfx::Display> changed_display_; | 45 std::vector<gfx::Display> changed_display_; |
| 42 std::vector<gfx::Display> added_display_; | 46 std::vector<gfx::Display> added_display_; |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 screen()->GetDisplayNearestWindow(window_one->GetNativeWindow()).id()); | 251 screen()->GetDisplayNearestWindow(window_one->GetNativeWindow()).id()); |
| 248 EXPECT_EQ( | 252 EXPECT_EQ( |
| 249 kSecondDisplay, | 253 kSecondDisplay, |
| 250 screen()->GetDisplayNearestWindow(window_two->GetNativeWindow()).id()); | 254 screen()->GetDisplayNearestWindow(window_two->GetNativeWindow()).id()); |
| 251 | 255 |
| 252 window_one->CloseNow(); | 256 window_one->CloseNow(); |
| 253 window_two->CloseNow(); | 257 window_two->CloseNow(); |
| 254 } | 258 } |
| 255 | 259 |
| 256 } // namespace views | 260 } // namespace views |
| OLD | NEW |