| // Copyright (c) 2015 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| #include "chrome/browser/ui/views/frame/browser_view.h" |
| |
| #include "chrome/browser/ui/browser_commands.h" |
| #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
| #include "chrome/test/base/in_process_browser_test.h" |
| |
| using views::FocusManager; |
| |
| typedef InProcessBrowserTest BrowserViewTest; |
| |
| IN_PROC_BROWSER_TEST_F(BrowserViewTest, FullscreenClearsFocus) { |
| BrowserView* browser_view = static_cast<BrowserView*>(browser()->window()); |
| LocationBarView* location_bar_view = browser_view->GetLocationBarView(); |
| FocusManager* focus_manager = browser_view->GetFocusManager(); |
| |
| // Focus starts in the location bar or one of its children. |
| EXPECT_TRUE(location_bar_view->Contains(focus_manager->GetFocusedView())); |
| |
| chrome::ToggleFullscreenMode(browser()); |
| EXPECT_TRUE(browser_view->IsFullscreen()); |
| |
| // Focus is released from the location bar. |
| EXPECT_FALSE(location_bar_view->Contains(focus_manager->GetFocusedView())); |
| } |