text: // Copyright (c) 2012 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"
  #include "ui/views/focus/focus_manager.h"
  
  using views::FocusManager;
  
  typedef InProcessBrowserTest BrowserViewTest;
  
  // Active window and focus testing is not reliable on Windows crbug.com/79493
  #if defined(OS_WIN)
  #define MAYBE_FullscreenClearsFocus DISABLED_FullscreenClearsFocus
  #else
  #define MAYBE_FullscreenClearsFocus FullscreenClearsFocus
  #endif
  IN_PROC_BROWSER_TEST_F(BrowserViewTest, MAYBE_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()));
  }
  