OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/app/chrome_command_ids.h" | 7 #include "chrome/app/chrome_command_ids.h" |
8 #include "chrome/browser/autocomplete/autocomplete_controller.h" | 8 #include "chrome/browser/autocomplete/autocomplete_controller.h" |
9 #include "chrome/browser/search/search.h" | 9 #include "chrome/browser/search/search.h" |
10 #include "chrome/browser/ui/browser_commands.h" | 10 #include "chrome/browser/ui/browser_commands.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 #if defined(OS_CHROMEOS) | 29 #if defined(OS_CHROMEOS) |
30 #include "chrome/browser/chrome_notification_types.h" | 30 #include "chrome/browser/chrome_notification_types.h" |
31 #include "content/public/browser/notification_service.h" | 31 #include "content/public/browser/notification_service.h" |
32 #include "ui/compositor/layer.h" | 32 #include "ui/compositor/layer.h" |
33 #include "ui/compositor/scoped_animation_duration_scale_mode.h" | 33 #include "ui/compositor/scoped_animation_duration_scale_mode.h" |
34 #endif | 34 #endif |
35 | 35 |
36 using views::FocusManager; | 36 using views::FocusManager; |
37 | 37 |
38 namespace { | |
39 | |
40 // Returns the bounds of |view| in widget coordinates. | |
41 gfx::Rect GetRectInWidget(views::View* view) { | |
42 return view->ConvertRectToWidget(view->GetLocalBounds()); | |
43 } | |
44 | |
45 } | |
46 | |
47 typedef InProcessBrowserTest BrowserViewTest; | 38 typedef InProcessBrowserTest BrowserViewTest; |
48 | 39 |
49 // Active window and focus testing is not reliable on Windows crbug.com/79493 | 40 // Active window and focus testing is not reliable on Windows crbug.com/79493 |
50 // TODO(linux_aura) http://crbug.com/163931 | 41 // TODO(linux_aura) http://crbug.com/163931 |
51 #if defined(OS_WIN) || (defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(US
E_AURA)) | 42 #if defined(OS_WIN) || (defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(US
E_AURA)) |
52 #define MAYBE_FullscreenClearsFocus DISABLED_FullscreenClearsFocus | 43 #define MAYBE_FullscreenClearsFocus DISABLED_FullscreenClearsFocus |
53 #else | 44 #else |
54 #define MAYBE_FullscreenClearsFocus FullscreenClearsFocus | 45 #define MAYBE_FullscreenClearsFocus FullscreenClearsFocus |
55 #endif | 46 #endif |
56 IN_PROC_BROWSER_TEST_F(BrowserViewTest, MAYBE_FullscreenClearsFocus) { | 47 IN_PROC_BROWSER_TEST_F(BrowserViewTest, MAYBE_FullscreenClearsFocus) { |
57 BrowserView* browser_view = static_cast<BrowserView*>(browser()->window()); | 48 BrowserView* browser_view = static_cast<BrowserView*>(browser()->window()); |
58 LocationBarView* location_bar_view = browser_view->GetLocationBarView(); | 49 LocationBarView* location_bar_view = browser_view->GetLocationBarView(); |
59 FocusManager* focus_manager = browser_view->GetFocusManager(); | 50 FocusManager* focus_manager = browser_view->GetFocusManager(); |
60 | 51 |
61 // Focus starts in the location bar or one of its children. | 52 // Focus starts in the location bar or one of its children. |
62 EXPECT_TRUE(location_bar_view->Contains(focus_manager->GetFocusedView())); | 53 EXPECT_TRUE(location_bar_view->Contains(focus_manager->GetFocusedView())); |
63 | 54 |
64 chrome::ToggleFullscreenMode(browser()); | 55 chrome::ToggleFullscreenMode(browser()); |
65 EXPECT_TRUE(browser_view->IsFullscreen()); | 56 EXPECT_TRUE(browser_view->IsFullscreen()); |
66 | 57 |
67 // Focus is released from the location bar. | 58 // Focus is released from the location bar. |
68 EXPECT_FALSE(location_bar_view->Contains(focus_manager->GetFocusedView())); | 59 EXPECT_FALSE(location_bar_view->Contains(focus_manager->GetFocusedView())); |
69 } | 60 } |
OLD | NEW |