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 <vector> | 5 #include <vector> |
6 #include "chrome/browser/ui/browser.h" | 6 #include "chrome/browser/ui/browser.h" |
7 #include "chrome/browser/ui/panels/base_panel_browser_test.h" | 7 #include "chrome/browser/ui/panels/base_panel_browser_test.h" |
8 #include "chrome/browser/ui/panels/docked_panel_strip.h" | 8 #include "chrome/browser/ui/panels/docked_panel_strip.h" |
9 #include "chrome/browser/ui/panels/native_panel.h" | 9 #include "chrome/browser/ui/panels/native_panel.h" |
10 #include "chrome/browser/ui/panels/overflow_panel_strip.h" | 10 #include "chrome/browser/ui/panels/overflow_panel_strip.h" |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 #define MAYBE_CreateMoreOverflowPanels CreateMoreOverflowPanels | 249 #define MAYBE_CreateMoreOverflowPanels CreateMoreOverflowPanels |
250 #define MAYBE_OverflowIndicatorCount OverflowIndicatorCount | 250 #define MAYBE_OverflowIndicatorCount OverflowIndicatorCount |
251 #define MAYBE_DrawOverflowAttention DrawOverflowAttention | 251 #define MAYBE_DrawOverflowAttention DrawOverflowAttention |
252 #else | 252 #else |
253 #define MAYBE_CreateMoreOverflowPanels DISABLED_CreateMoreOverflowPanels | 253 #define MAYBE_CreateMoreOverflowPanels DISABLED_CreateMoreOverflowPanels |
254 #define MAYBE_OverflowIndicatorCount DISABLED_OverflowIndicatorCount | 254 #define MAYBE_OverflowIndicatorCount DISABLED_OverflowIndicatorCount |
255 #define MAYBE_DrawOverflowAttention DISABLED_DrawOverflowAttention | 255 #define MAYBE_DrawOverflowAttention DISABLED_DrawOverflowAttention |
256 #endif | 256 #endif |
257 | 257 |
258 IN_PROC_BROWSER_TEST_F(PanelOverflowBrowserTest, MAYBE_CheckPanelProperties) { | 258 IN_PROC_BROWSER_TEST_F(PanelOverflowBrowserTest, MAYBE_CheckPanelProperties) { |
| 259 PanelManager* panel_manager = PanelManager::GetInstance(); |
| 260 |
259 // Create 3 panels that fit. | 261 // Create 3 panels that fit. |
260 Panel* panel1 = CreatePanelWithBounds("1", gfx::Rect(0, 0, 250, 200)); | 262 Panel* panel1 = CreatePanelWithBounds("1", gfx::Rect(0, 0, 250, 200)); |
261 Panel* panel2 = CreatePanelWithBounds("2", gfx::Rect(0, 0, 300, 200)); | 263 Panel* panel2 = CreatePanelWithBounds("2", gfx::Rect(0, 0, 300, 200)); |
262 Panel* panel3 = CreatePanelWithBounds("3", gfx::Rect(0, 0, 200, 200)); | 264 Panel* panel3 = CreatePanelWithBounds("3", gfx::Rect(0, 0, 200, 200)); |
263 | 265 |
264 // Create an overflow panel without waiting for it to be moved to overflow. | 266 // Create an overflow panel without waiting for it to be moved to overflow. |
265 // Check its properties before and after it is moved to overflow. | 267 // Check its properties before and after it is moved to overflow. |
266 CreatePanelParams params( | 268 CreatePanelParams params( |
267 "4", gfx::Rect(0, 0, 255, 200), SHOW_AS_INACTIVE); | 269 "4", gfx::Rect(0, 0, 255, 200), SHOW_AS_INACTIVE); |
268 params.wait_for_fully_created = false; | 270 params.wait_for_fully_created = false; |
269 Panel* panel4 = CreatePanelWithParams(params); | 271 Panel* panel4 = CreatePanelWithParams(params); |
270 | 272 |
271 EXPECT_EQ(Panel::EXPANDED, panel1->expansion_state()); | 273 EXPECT_EQ(Panel::EXPANDED, panel1->expansion_state()); |
272 EXPECT_EQ(Panel::EXPANDED, panel2->expansion_state()); | 274 EXPECT_EQ(Panel::EXPANDED, panel2->expansion_state()); |
273 EXPECT_EQ(Panel::EXPANDED, panel3->expansion_state()); | 275 EXPECT_EQ(Panel::EXPANDED, panel3->expansion_state()); |
274 EXPECT_EQ(Panel::EXPANDED, panel4->expansion_state()); | 276 EXPECT_EQ(Panel::EXPANDED, panel4->expansion_state()); |
275 | 277 |
276 EXPECT_FALSE(panel1->has_temporary_layout()); | 278 EXPECT_FALSE(panel1->has_temporary_layout()); |
277 EXPECT_FALSE(panel2->has_temporary_layout()); | 279 EXPECT_FALSE(panel2->has_temporary_layout()); |
278 EXPECT_FALSE(panel3->has_temporary_layout()); | 280 EXPECT_FALSE(panel3->has_temporary_layout()); |
279 EXPECT_TRUE(panel4->has_temporary_layout()); | 281 EXPECT_TRUE(panel4->has_temporary_layout()); |
280 | 282 |
281 EXPECT_TRUE(panel1->draggable()); | 283 EXPECT_TRUE(panel_manager->CanDrag(panel1)); |
282 EXPECT_TRUE(panel2->draggable()); | 284 EXPECT_TRUE(panel_manager->CanDrag(panel2)); |
283 EXPECT_TRUE(panel3->draggable()); | 285 EXPECT_TRUE(panel_manager->CanDrag(panel3)); |
284 EXPECT_FALSE(panel4->draggable()); | 286 EXPECT_FALSE(panel_manager->CanDrag(panel4)); |
285 | 287 |
286 // Make sure last panel really did overflow. | 288 // Make sure last panel really did overflow. |
287 WaitForLayoutModeChanged(panel4, PanelStrip::IN_OVERFLOW); | 289 WaitForLayoutModeChanged(panel4, PanelStrip::IN_OVERFLOW); |
288 EXPECT_FALSE(panel4->has_temporary_layout()); | 290 EXPECT_FALSE(panel4->has_temporary_layout()); |
289 EXPECT_FALSE(panel4->draggable()); | 291 EXPECT_FALSE(panel_manager->CanDrag(panel4)); |
290 | 292 |
291 PanelManager::GetInstance()->CloseAll(); | 293 panel_manager->CloseAll(); |
292 } | 294 } |
293 | 295 |
294 IN_PROC_BROWSER_TEST_F(PanelOverflowBrowserTest, MAYBE_UpdateDraggableStatus) { | 296 IN_PROC_BROWSER_TEST_F(PanelOverflowBrowserTest, MAYBE_UpdateDraggableStatus) { |
295 PanelManager* panel_manager = PanelManager::GetInstance(); | 297 PanelManager* panel_manager = PanelManager::GetInstance(); |
296 Panel* panel = CreatePanel("panel"); | 298 Panel* panel = CreatePanel("panel"); |
297 EXPECT_TRUE(panel->draggable()); | 299 EXPECT_TRUE(panel_manager->CanDrag(panel)); |
298 panel->MoveToStrip(panel_manager->overflow_strip()); | 300 panel->MoveToStrip(panel_manager->overflow_strip()); |
299 EXPECT_FALSE(panel->draggable()); | 301 EXPECT_FALSE(panel_manager->CanDrag(panel)); |
300 panel->MoveToStrip(panel_manager->docked_strip()); | 302 panel->MoveToStrip(panel_manager->docked_strip()); |
301 EXPECT_TRUE(panel->draggable()); | 303 EXPECT_TRUE(panel_manager->CanDrag(panel)); |
302 panel->Close(); | 304 panel->Close(); |
303 } | 305 } |
304 | 306 |
305 IN_PROC_BROWSER_TEST_F(PanelOverflowBrowserTest, MAYBE_CreateOverflowPanels) { | 307 IN_PROC_BROWSER_TEST_F(PanelOverflowBrowserTest, MAYBE_CreateOverflowPanels) { |
306 PanelManager* panel_manager = PanelManager::GetInstance(); | 308 PanelManager* panel_manager = PanelManager::GetInstance(); |
307 DockedPanelStrip* docked_strip = panel_manager->docked_strip(); | 309 DockedPanelStrip* docked_strip = panel_manager->docked_strip(); |
308 OverflowPanelStrip* overflow_strip = | 310 OverflowPanelStrip* overflow_strip = |
309 panel_manager->overflow_strip(); | 311 panel_manager->overflow_strip(); |
310 | 312 |
311 EXPECT_EQ(0, panel_manager->num_panels()); | 313 EXPECT_EQ(0, panel_manager->num_panels()); |
(...skipping 1293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1605 // docked: P0, P1, P5 | 1607 // docked: P0, P1, P5 |
1606 // overflow: P2, P10, P3, (P4, P6, P7, P9, P11) | 1608 // overflow: P2, P10, P3, (P4, P6, P7, P9, P11) |
1607 CloseWindowAndWait(panels[8]->browser()); | 1609 CloseWindowAndWait(panels[8]->browser()); |
1608 EXPECT_EQ(3, docked_strip->num_panels()); | 1610 EXPECT_EQ(3, docked_strip->num_panels()); |
1609 EXPECT_EQ(8, overflow_strip->num_panels()); | 1611 EXPECT_EQ(8, overflow_strip->num_panels()); |
1610 EXPECT_TRUE(panels[3]->IsDrawingAttention()); | 1612 EXPECT_TRUE(panels[3]->IsDrawingAttention()); |
1611 EXPECT_FALSE(overflow_indicator->IsDrawingAttention()); | 1613 EXPECT_FALSE(overflow_indicator->IsDrawingAttention()); |
1612 | 1614 |
1613 panel_manager->CloseAll(); | 1615 panel_manager->CloseAll(); |
1614 } | 1616 } |
OLD | NEW |