| OLD | NEW |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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 "chrome/browser/ui/views/frame/browser_view.h" | 5 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 #include "chrome/browser/ui/browser_commands.h" | 8 #include "chrome/browser/ui/browser_commands.h" |
| 9 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 9 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
| 10 #include "chrome/test/base/in_process_browser_test.h" | 10 #include "chrome/test/base/in_process_browser_test.h" |
| 11 #include "ui/views/focus/focus_manager.h" | 11 #include "ui/views/focus/focus_manager.h" |
| 12 | 12 |
| 13 #if defined(USE_AURA) | 13 #if defined(USE_AURA) |
| 14 #include "chrome/browser/ui/browser_window_state.h" | 14 #include "chrome/browser/ui/browser_window_state.h" |
| 15 #include "ui/aura/client/aura_constants.h" | 15 #include "ui/aura/client/aura_constants.h" |
| 16 #include "ui/aura/window.h" | 16 #include "ui/aura/window.h" |
| 17 #include "ui/aura/window_delegate.h" | 17 #include "ui/aura/window_delegate.h" |
| 18 #include "ui/gfx/screen.h" | 18 #include "ui/display/screen.h" |
| 19 #endif | 19 #endif |
| 20 | 20 |
| 21 using views::FocusManager; | 21 using views::FocusManager; |
| 22 | 22 |
| 23 typedef InProcessBrowserTest BrowserViewTest; | 23 typedef InProcessBrowserTest BrowserViewTest; |
| 24 | 24 |
| 25 // Active window and focus testing is not reliable on Windows crbug.com/79493 | 25 // Active window and focus testing is not reliable on Windows crbug.com/79493 |
| 26 #if defined(OS_WIN) | 26 #if defined(OS_WIN) |
| 27 #define MAYBE_FullscreenClearsFocus DISABLED_FullscreenClearsFocus | 27 #define MAYBE_FullscreenClearsFocus DISABLED_FullscreenClearsFocus |
| 28 #else | 28 #else |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 browser()->window()->Close(); | 74 browser()->window()->Close(); |
| 75 | 75 |
| 76 // Create a new app browser | 76 // Create a new app browser |
| 77 Browser* browser = new Browser(params); | 77 Browser* browser = new Browser(params); |
| 78 ASSERT_TRUE(browser); | 78 ASSERT_TRUE(browser); |
| 79 gfx::NativeWindow window = browser->window()->GetNativeWindow(); | 79 gfx::NativeWindow window = browser->window()->GetNativeWindow(); |
| 80 gfx::Rect original_bounds(gfx::Rect(150, 250, 400, 100)); | 80 gfx::Rect original_bounds(gfx::Rect(150, 250, 400, 100)); |
| 81 window->SetBounds(original_bounds); | 81 window->SetBounds(original_bounds); |
| 82 window->Show(); | 82 window->Show(); |
| 83 // Dock the browser window using |kShowStateKey| property. | 83 // Dock the browser window using |kShowStateKey| property. |
| 84 gfx::Rect work_area = gfx::Screen::GetScreen() | 84 gfx::Rect work_area = display::Screen::GetScreen() |
| 85 ->GetDisplayNearestPoint(window->bounds().origin()) | 85 ->GetDisplayNearestPoint(window->bounds().origin()) |
| 86 .work_area(); | 86 .work_area(); |
| 87 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_DOCKED); | 87 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_DOCKED); |
| 88 | 88 |
| 89 // Saved placement should reflect docked state (for app windows only in Ash). | 89 // Saved placement should reflect docked state (for app windows only in Ash). |
| 90 gfx::Rect bounds; | 90 gfx::Rect bounds; |
| 91 ui::WindowShowState show_state = ui::SHOW_STATE_DEFAULT; | 91 ui::WindowShowState show_state = ui::SHOW_STATE_DEFAULT; |
| 92 const views::Widget* widget = views::Widget::GetWidgetForNativeWindow(window); | 92 const views::Widget* widget = views::Widget::GetWidgetForNativeWindow(window); |
| 93 widget->widget_delegate()->GetSavedWindowPlacement(widget, &bounds, | 93 widget->widget_delegate()->GetSavedWindowPlacement(widget, &bounds, |
| 94 &show_state); | 94 &show_state); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 window = browser->window()->GetNativeWindow(); | 151 window = browser->window()->GetNativeWindow(); |
| 152 EXPECT_EQ(expected_bounds.ToString(), window->GetTargetBounds().ToString()); | 152 EXPECT_EQ(expected_bounds.ToString(), window->GetTargetBounds().ToString()); |
| 153 EXPECT_EQ(ui::SHOW_STATE_NORMAL, | 153 EXPECT_EQ(ui::SHOW_STATE_NORMAL, |
| 154 window->GetProperty(aura::client::kShowStateKey)); | 154 window->GetProperty(aura::client::kShowStateKey)); |
| 155 } | 155 } |
| 156 | 156 |
| 157 INSTANTIATE_TEST_CASE_P(BrowserViewTestTabbedOrApp, | 157 INSTANTIATE_TEST_CASE_P(BrowserViewTestTabbedOrApp, |
| 158 BrowserViewTestParam, | 158 BrowserViewTestParam, |
| 159 testing::Bool()); | 159 testing::Bool()); |
| 160 #endif | 160 #endif |
| OLD | NEW |