Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Side by Side Diff: chrome/browser/ui/views/frame/browser_view_browsertest.cc

Issue 13684002: cros: Instant extended support for immersive fullscreen (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/ui/views/frame/browser_view.h"
6
7 #include "chrome/app/chrome_command_ids.h"
8 #include "chrome/browser/ui/browser_commands.h"
9 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h"
10 #include "chrome/browser/ui/views/frame/top_container_view.h"
11 #include "chrome/browser/ui/views/infobars/infobar_container_view.h"
12 #include "chrome/browser/ui/views/location_bar/location_bar_view.h"
13 #include "chrome/browser/ui/views/tabs/tab_strip.h"
14 #include "chrome/browser/ui/views/toolbar_view.h"
15 #include "chrome/common/url_constants.h"
16 #include "chrome/test/base/in_process_browser_test.h"
17 #include "chrome/test/base/ui_test_utils.h"
18 #include "ui/views/focus/focus_manager.h"
19
20 using views::FocusManager;
21
22 typedef InProcessBrowserTest BrowserViewTest;
23
24 IN_PROC_BROWSER_TEST_F(BrowserViewTest, BrowserView) {
25 BookmarkBarView::DisableAnimationsForTesting(true);
26
27 BrowserView* browser_view = static_cast<BrowserView*>(browser()->window());
28 TopContainerView* top_container = browser_view->top_container();
29
30 // Verify the view hierarchy.
31 EXPECT_EQ(top_container, browser_view->tabstrip()->parent());
32 EXPECT_EQ(top_container, browser_view->toolbar()->parent());
33 EXPECT_EQ(top_container, browser_view->GetBookmarkBarView()->parent());
34 EXPECT_EQ(browser_view, browser_view->infobar_container()->parent());
35
36 // Top container is at the front of the view hierarchy.
37 EXPECT_EQ(browser_view->child_count() - 1,
38 browser_view->GetIndexOf(top_container));
39
40 // Verify basic layout.
41 EXPECT_EQ(0, top_container->x());
42 EXPECT_EQ(0, top_container->y());
43 EXPECT_EQ(browser_view->width(), top_container->width());
44
45 // Verify bookmark bar visibility.
46 BookmarkBarView* bookmark_bar = browser_view->GetBookmarkBarView();
47 EXPECT_FALSE(bookmark_bar->visible());
48 EXPECT_FALSE(bookmark_bar->IsDetached());
49 chrome::ExecuteCommand(browser(), IDC_SHOW_BOOKMARK_BAR);
50 EXPECT_TRUE(bookmark_bar->visible());
51 EXPECT_FALSE(bookmark_bar->IsDetached());
52 chrome::ExecuteCommand(browser(), IDC_SHOW_BOOKMARK_BAR);
53 EXPECT_FALSE(bookmark_bar->visible());
54 EXPECT_FALSE(bookmark_bar->IsDetached());
55
56 // Bookmark bar is reparented to BrowserView on NTP.
57 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUINewTabURL));
58 EXPECT_TRUE(bookmark_bar->visible());
59 EXPECT_TRUE(bookmark_bar->IsDetached());
60 EXPECT_EQ(browser_view, bookmark_bar->parent());
61 // Top container is still in front.
62 EXPECT_EQ(browser_view->child_count() - 1,
63 browser_view->GetIndexOf(top_container));
64
65 // Bookmark bar is parented back to top container on normal page.
66 ui_test_utils::NavigateToURL(browser(), GURL("about:blank"));
67 EXPECT_FALSE(bookmark_bar->visible());
68 EXPECT_FALSE(bookmark_bar->IsDetached());
69 EXPECT_EQ(top_container, bookmark_bar->parent());
70 // Top container is still in front.
71 EXPECT_EQ(browser_view->child_count() - 1,
72 browser_view->GetIndexOf(top_container));
73
74 BookmarkBarView::DisableAnimationsForTesting(false);
75 }
76
77 // Active window and focus testing is not reliable on Windows crbug.com/79493
78 // TODO(linux_aura) http://crbug.com/163931
79 #if defined(OS_WIN) || (defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(US E_AURA))
80 #define MAYBE_FullscreenClearsFocus DISABLED_FullscreenClearsFocus
81 #else
82 #define MAYBE_FullscreenClearsFocus FullscreenClearsFocus
83 #endif
84 IN_PROC_BROWSER_TEST_F(BrowserViewTest, MAYBE_FullscreenClearsFocus) {
85 BrowserView* browser_view = static_cast<BrowserView*>(browser()->window());
86 LocationBarView* location_bar_view = browser_view->GetLocationBarView();
87 FocusManager* focus_manager = browser_view->GetFocusManager();
88
89 // Focus starts in the location bar or one of its children.
90 EXPECT_TRUE(location_bar_view->Contains(focus_manager->GetFocusedView()));
91
92 chrome::ToggleFullscreenMode(browser());
93 EXPECT_TRUE(browser_view->IsFullscreen());
94
95 // Focus is released from the location bar.
96 EXPECT_FALSE(location_bar_view->Contains(focus_manager->GetFocusedView()));
97 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/browser_view.cc ('k') | chrome/browser/ui/views/frame/browser_view_interactive_uitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698