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

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

Issue 2617733002: Hide docked windows behind a flag (Closed)
Patch Set: Fix tests failed because of DCHECK Created 3 years, 11 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
OLDNEW
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 "base/command_line.h"
7 #include "build/build_config.h" 8 #include "build/build_config.h"
8 #include "chrome/browser/ui/browser_commands.h" 9 #include "chrome/browser/ui/browser_commands.h"
9 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" 10 #include "chrome/browser/ui/views/location_bar/location_bar_view.h"
10 #include "chrome/test/base/in_process_browser_test.h" 11 #include "chrome/test/base/in_process_browser_test.h"
11 #include "ui/views/focus/focus_manager.h" 12 #include "ui/views/focus/focus_manager.h"
12 13
14 #if defined(USE_ASH)
15 #include "ash/common/ash_switches.h"
16 #endif
17
13 #if defined(USE_AURA) 18 #if defined(USE_AURA)
14 #include "chrome/browser/ui/browser_window_state.h" 19 #include "chrome/browser/ui/browser_window_state.h"
15 #include "ui/aura/client/aura_constants.h" 20 #include "ui/aura/client/aura_constants.h"
16 #include "ui/aura/window.h" 21 #include "ui/aura/window.h"
17 #include "ui/aura/window_delegate.h" 22 #include "ui/aura/window_delegate.h"
18 #include "ui/display/display.h" 23 #include "ui/display/display.h"
19 #include "ui/display/screen.h" 24 #include "ui/display/screen.h"
20 #endif 25 #endif
21 26
22 using views::FocusManager; 27 using views::FocusManager;
(...skipping 28 matching lines...) Expand all
51 public testing::WithParamInterface<bool> { 56 public testing::WithParamInterface<bool> {
52 public: 57 public:
53 bool TestApp() { return GetParam(); } 58 bool TestApp() { return GetParam(); }
54 }; 59 };
55 60
56 } // namespace 61 } // namespace
57 62
58 // Test that docked state is remembered for app browser windows and not 63 // Test that docked state is remembered for app browser windows and not
59 // remembered for tabbed browser windows. 64 // remembered for tabbed browser windows.
60 IN_PROC_BROWSER_TEST_P(BrowserViewTestParam, BrowserRemembersDockedState) { 65 IN_PROC_BROWSER_TEST_P(BrowserViewTestParam, BrowserRemembersDockedState) {
66 #if defined(USE_ASH)
67 // Enable window docking for this test.
68 base::CommandLine::ForCurrentProcess()->AppendSwitch(
69 ash::switches::kAshEnableDockedWindows);
70 const bool kIsAsh = true;
71 #else
72 const bool kIsAsh = false;
73 #endif // defined(USE_ASH)
74
61 // Open a new browser window (app or tabbed depending on a parameter). 75 // Open a new browser window (app or tabbed depending on a parameter).
62 bool test_app = TestApp(); 76 bool test_app = TestApp();
63 Browser::CreateParams params = 77 Browser::CreateParams params =
64 test_app ? Browser::CreateParams::CreateForApp( 78 test_app ? Browser::CreateParams::CreateForApp(
65 "test_browser_app", true /* trusted_source */, gfx::Rect(), 79 "test_browser_app", true /* trusted_source */, gfx::Rect(),
66 browser()->profile()) 80 browser()->profile())
67 : Browser::CreateParams(browser()->profile()); 81 : Browser::CreateParams(browser()->profile());
68 params.initial_show_state = ui::SHOW_STATE_DEFAULT; 82 params.initial_show_state = ui::SHOW_STATE_DEFAULT;
69 #if defined(USE_ASH) 83
70 const bool kIsAsh = true;
71 #else
72 const bool kIsAsh = false;
73 #endif
74 // Default |browser()| is not used by this test. 84 // Default |browser()| is not used by this test.
75 browser()->window()->Close(); 85 browser()->window()->Close();
76 86
77 // Create a new app browser 87 // Create a new app browser
78 Browser* browser = new Browser(params); 88 Browser* browser = new Browser(params);
79 ASSERT_TRUE(browser); 89 ASSERT_TRUE(browser);
80 gfx::NativeWindow window = browser->window()->GetNativeWindow(); 90 gfx::NativeWindow window = browser->window()->GetNativeWindow();
81 gfx::Rect original_bounds(gfx::Rect(150, 250, 400, 100)); 91 gfx::Rect original_bounds(gfx::Rect(150, 250, 400, 100));
82 window->SetBounds(original_bounds); 92 window->SetBounds(original_bounds);
83 window->Show(); 93 window->Show();
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 window = browser->window()->GetNativeWindow(); 162 window = browser->window()->GetNativeWindow();
153 EXPECT_EQ(expected_bounds.ToString(), window->GetTargetBounds().ToString()); 163 EXPECT_EQ(expected_bounds.ToString(), window->GetTargetBounds().ToString());
154 EXPECT_EQ(ui::SHOW_STATE_NORMAL, 164 EXPECT_EQ(ui::SHOW_STATE_NORMAL,
155 window->GetProperty(aura::client::kShowStateKey)); 165 window->GetProperty(aura::client::kShowStateKey));
156 } 166 }
157 167
158 INSTANTIATE_TEST_CASE_P(BrowserViewTestTabbedOrApp, 168 INSTANTIATE_TEST_CASE_P(BrowserViewTestTabbedOrApp,
159 BrowserViewTestParam, 169 BrowserViewTestParam,
160 testing::Bool()); 170 testing::Bool());
161 #endif 171 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698