| 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" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 browser()->window()->Close(); | 71 browser()->window()->Close(); |
| 72 | 72 |
| 73 // Create a new app browser | 73 // Create a new app browser |
| 74 Browser* browser = new Browser(params); | 74 Browser* browser = new Browser(params); |
| 75 ASSERT_TRUE(browser); | 75 ASSERT_TRUE(browser); |
| 76 gfx::NativeWindow window = browser->window()->GetNativeWindow(); | 76 gfx::NativeWindow window = browser->window()->GetNativeWindow(); |
| 77 gfx::Rect original_bounds(gfx::Rect(150, 250, 400, 100)); | 77 gfx::Rect original_bounds(gfx::Rect(150, 250, 400, 100)); |
| 78 window->SetBounds(original_bounds); | 78 window->SetBounds(original_bounds); |
| 79 window->Show(); | 79 window->Show(); |
| 80 // Dock the browser window using |kShowStateKey| property. | 80 // Dock the browser window using |kShowStateKey| property. |
| 81 gfx::Rect work_area = gfx::Screen::GetScreenFor(window) | 81 gfx::Rect work_area = gfx::Screen::GetScreen() |
| 82 ->GetDisplayNearestPoint(window->bounds().origin()) | 82 ->GetDisplayNearestPoint(window->bounds().origin()) |
| 83 .work_area(); | 83 .work_area(); |
| 84 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_DOCKED); | 84 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_DOCKED); |
| 85 | 85 |
| 86 // Saved placement should reflect docked state (for app windows only in Ash). | 86 // Saved placement should reflect docked state (for app windows only in Ash). |
| 87 gfx::Rect bounds; | 87 gfx::Rect bounds; |
| 88 ui::WindowShowState show_state = ui::SHOW_STATE_DEFAULT; | 88 ui::WindowShowState show_state = ui::SHOW_STATE_DEFAULT; |
| 89 const views::Widget* widget = views::Widget::GetWidgetForNativeWindow(window); | 89 const views::Widget* widget = views::Widget::GetWidgetForNativeWindow(window); |
| 90 widget->widget_delegate()->GetSavedWindowPlacement(widget, &bounds, | 90 widget->widget_delegate()->GetSavedWindowPlacement(widget, &bounds, |
| 91 &show_state); | 91 &show_state); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 window = browser->window()->GetNativeWindow(); | 148 window = browser->window()->GetNativeWindow(); |
| 149 EXPECT_EQ(expected_bounds.ToString(), window->GetTargetBounds().ToString()); | 149 EXPECT_EQ(expected_bounds.ToString(), window->GetTargetBounds().ToString()); |
| 150 EXPECT_EQ(ui::SHOW_STATE_NORMAL, | 150 EXPECT_EQ(ui::SHOW_STATE_NORMAL, |
| 151 window->GetProperty(aura::client::kShowStateKey)); | 151 window->GetProperty(aura::client::kShowStateKey)); |
| 152 } | 152 } |
| 153 | 153 |
| 154 INSTANTIATE_TEST_CASE_P(BrowserViewTestTabbedOrApp, | 154 INSTANTIATE_TEST_CASE_P(BrowserViewTestTabbedOrApp, |
| 155 BrowserViewTestParam, | 155 BrowserViewTestParam, |
| 156 testing::Bool()); | 156 testing::Bool()); |
| 157 #endif | 157 #endif |
| OLD | NEW |