| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "ash/shelf/shelf.h" | 5 #include "ash/shelf/shelf.h" |
| 6 #include "ash/shelf/shelf_view.h" | 6 #include "ash/shelf/shelf_view.h" |
| 7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "ash/test/shelf_test_api.h" | 8 #include "ash/test/shelf_test_api.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 #define MAYBE_OpenBrowserUsingShelfOnOtherDisplay DISABLED_OpenBrowserUsingShelf
OnOtherDisplay | 71 #define MAYBE_OpenBrowserUsingShelfOnOtherDisplay DISABLED_OpenBrowserUsingShelf
OnOtherDisplay |
| 72 #define MAYBE_OpenBrowserUsingContextMenuOnOtherDisplay DISABLED_OpenBrowserUsin
gContextMenuOnOtherDisplay | 72 #define MAYBE_OpenBrowserUsingContextMenuOnOtherDisplay DISABLED_OpenBrowserUsin
gContextMenuOnOtherDisplay |
| 73 #else | 73 #else |
| 74 #define MAYBE_OpenBrowserUsingShelfOnOtherDisplay OpenBrowserUsingShelfOnOtherDi
splay | 74 #define MAYBE_OpenBrowserUsingShelfOnOtherDisplay OpenBrowserUsingShelfOnOtherDi
splay |
| 75 #define MAYBE_OpenBrowserUsingContextMenuOnOtherDisplay OpenBrowserUsingContextM
enuOnOtherDisplay | 75 #define MAYBE_OpenBrowserUsingContextMenuOnOtherDisplay OpenBrowserUsingContextM
enuOnOtherDisplay |
| 76 #endif | 76 #endif |
| 77 | 77 |
| 78 IN_PROC_BROWSER_TEST_F(WindowSizerTest, | 78 IN_PROC_BROWSER_TEST_F(WindowSizerTest, |
| 79 MAYBE_OpenBrowserUsingShelfOnOtherDisplay) { | 79 MAYBE_OpenBrowserUsingShelfOnOtherDisplay) { |
| 80 // Don't shutdown when closing the last browser window. | 80 // Don't shutdown when closing the last browser window. |
| 81 chrome::StartKeepAlive(); | 81 chrome::IncrementKeepAliveCount(); |
| 82 | 82 |
| 83 aura::Window::Windows root_windows = ash::Shell::GetAllRootWindows(); | 83 aura::Window::Windows root_windows = ash::Shell::GetAllRootWindows(); |
| 84 | 84 |
| 85 BrowserList* browser_list = | 85 BrowserList* browser_list = |
| 86 BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_ASH); | 86 BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_ASH); |
| 87 | 87 |
| 88 EXPECT_EQ(1u, browser_list->size()); | 88 EXPECT_EQ(1u, browser_list->size()); |
| 89 // Close the browser window so that clicking icon will create a new window. | 89 // Close the browser window so that clicking icon will create a new window. |
| 90 CloseBrowser(browser_list->get(0)); | 90 CloseBrowser(browser_list->get(0)); |
| 91 EXPECT_EQ(0u, browser_list->size()); | 91 EXPECT_EQ(0u, browser_list->size()); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 104 EXPECT_EQ(0u, browser_list->size()); | 104 EXPECT_EQ(0u, browser_list->size()); |
| 105 | 105 |
| 106 OpenBrowserUsingShelfOnRootWindow(root_windows[0]); | 106 OpenBrowserUsingShelfOnRootWindow(root_windows[0]); |
| 107 | 107 |
| 108 // A new browser must be created on 1st display. | 108 // A new browser must be created on 1st display. |
| 109 EXPECT_EQ(1u, browser_list->size()); | 109 EXPECT_EQ(1u, browser_list->size()); |
| 110 EXPECT_EQ(root_windows[0], | 110 EXPECT_EQ(root_windows[0], |
| 111 browser_list->get(0)->window()->GetNativeWindow()->GetRootWindow()); | 111 browser_list->get(0)->window()->GetNativeWindow()->GetRootWindow()); |
| 112 EXPECT_EQ(root_windows[0], ash::Shell::GetTargetRootWindow()); | 112 EXPECT_EQ(root_windows[0], ash::Shell::GetTargetRootWindow()); |
| 113 | 113 |
| 114 // Balanced with the chrome::StartKeepAlive above. | 114 // Balanced with the chrome::IncrementKeepAliveCount above. |
| 115 chrome::EndKeepAlive(); | 115 chrome::DecrementKeepAliveCount(); |
| 116 } | 116 } |
| 117 | 117 |
| 118 namespace { | 118 namespace { |
| 119 | 119 |
| 120 class WindowSizerContextMenuTest : public WindowSizerTest { | 120 class WindowSizerContextMenuTest : public WindowSizerTest { |
| 121 public: | 121 public: |
| 122 WindowSizerContextMenuTest() {} | 122 WindowSizerContextMenuTest() {} |
| 123 virtual ~WindowSizerContextMenuTest() {} | 123 virtual ~WindowSizerContextMenuTest() {} |
| 124 | 124 |
| 125 static void Step1(gfx::Point release_point) { | 125 static void Step1(gfx::Point release_point) { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 chrome_icon.x(), chrome_icon.y(), | 159 chrome_icon.x(), chrome_icon.y(), |
| 160 base::Bind(&WindowSizerContextMenuTest::Step1, release_point)); | 160 base::Bind(&WindowSizerContextMenuTest::Step1, release_point)); |
| 161 base::MessageLoop::current()->Run(); | 161 base::MessageLoop::current()->Run(); |
| 162 } | 162 } |
| 163 | 163 |
| 164 } // namespace | 164 } // namespace |
| 165 | 165 |
| 166 IN_PROC_BROWSER_TEST_F(WindowSizerContextMenuTest, | 166 IN_PROC_BROWSER_TEST_F(WindowSizerContextMenuTest, |
| 167 MAYBE_OpenBrowserUsingContextMenuOnOtherDisplay) { | 167 MAYBE_OpenBrowserUsingContextMenuOnOtherDisplay) { |
| 168 // Don't shutdown when closing the last browser window. | 168 // Don't shutdown when closing the last browser window. |
| 169 chrome::StartKeepAlive(); | 169 chrome::IncrementKeepAliveCount(); |
| 170 | 170 |
| 171 views::MenuController::TurnOffMenuSelectionHoldForTest(); | 171 views::MenuController::TurnOffMenuSelectionHoldForTest(); |
| 172 | 172 |
| 173 aura::Window::Windows root_windows = ash::Shell::GetAllRootWindows(); | 173 aura::Window::Windows root_windows = ash::Shell::GetAllRootWindows(); |
| 174 | 174 |
| 175 BrowserList* browser_list = | 175 BrowserList* browser_list = |
| 176 BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_ASH); | 176 BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_ASH); |
| 177 | 177 |
| 178 EXPECT_EQ(1u, browser_list->size()); | 178 EXPECT_EQ(1u, browser_list->size()); |
| 179 EXPECT_EQ(root_windows[0], ash::Shell::GetTargetRootWindow()); | 179 EXPECT_EQ(root_windows[0], ash::Shell::GetTargetRootWindow()); |
| 180 CloseBrowser(browser_list->get(0)); | 180 CloseBrowser(browser_list->get(0)); |
| 181 | 181 |
| 182 OpenBrowserUsingContextMenuOnRootWindow(root_windows[1]); | 182 OpenBrowserUsingContextMenuOnRootWindow(root_windows[1]); |
| 183 | 183 |
| 184 // A new browser must be created on 2nd display. | 184 // A new browser must be created on 2nd display. |
| 185 EXPECT_EQ(1u, browser_list->size()); | 185 EXPECT_EQ(1u, browser_list->size()); |
| 186 EXPECT_EQ(root_windows[1], | 186 EXPECT_EQ(root_windows[1], |
| 187 browser_list->get(0)->window()->GetNativeWindow()->GetRootWindow()); | 187 browser_list->get(0)->window()->GetNativeWindow()->GetRootWindow()); |
| 188 EXPECT_EQ(root_windows[1], ash::Shell::GetTargetRootWindow()); | 188 EXPECT_EQ(root_windows[1], ash::Shell::GetTargetRootWindow()); |
| 189 | 189 |
| 190 OpenBrowserUsingContextMenuOnRootWindow(root_windows[0]); | 190 OpenBrowserUsingContextMenuOnRootWindow(root_windows[0]); |
| 191 | 191 |
| 192 // Next new browser must be created on 1st display. | 192 // Next new browser must be created on 1st display. |
| 193 EXPECT_EQ(2u, browser_list->size()); | 193 EXPECT_EQ(2u, browser_list->size()); |
| 194 EXPECT_EQ(root_windows[0], | 194 EXPECT_EQ(root_windows[0], |
| 195 browser_list->get(1)->window()->GetNativeWindow()->GetRootWindow()); | 195 browser_list->get(1)->window()->GetNativeWindow()->GetRootWindow()); |
| 196 EXPECT_EQ(root_windows[0], ash::Shell::GetTargetRootWindow()); | 196 EXPECT_EQ(root_windows[0], ash::Shell::GetTargetRootWindow()); |
| 197 | 197 |
| 198 // Balanced with the chrome::StartKeepAlive above. | 198 // Balanced with the chrome::IncrementKeepAliveCount above. |
| 199 chrome::EndKeepAlive(); | 199 chrome::DecrementKeepAliveCount(); |
| 200 } | 200 } |
| OLD | NEW |