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

Side by Side Diff: chrome/browser/ui/panels/panel_browsertest.cc

Issue 1865213004: Convert //chrome/browser/ui from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 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
« no previous file with comments | « chrome/browser/ui/panels/panel.cc ('k') | chrome/browser/ui/panels/panel_drag_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "chrome/app/chrome_command_ids.h" 10 #include "chrome/app/chrome_command_ids.h"
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 267
268 // Create 3 docked panels that are in expanded, title-only or minimized states 268 // Create 3 docked panels that are in expanded, title-only or minimized states
269 // respectively. 269 // respectively.
270 Panel* panel1 = CreatePanelWithBounds("1", gfx::Rect(0, 0, 100, 100)); 270 Panel* panel1 = CreatePanelWithBounds("1", gfx::Rect(0, 0, 100, 100));
271 Panel* panel2 = CreatePanelWithBounds("2", gfx::Rect(0, 0, 100, 100)); 271 Panel* panel2 = CreatePanelWithBounds("2", gfx::Rect(0, 0, 100, 100));
272 Panel* panel3 = CreatePanelWithBounds("3", gfx::Rect(0, 0, 100, 100)); 272 Panel* panel3 = CreatePanelWithBounds("3", gfx::Rect(0, 0, 100, 100));
273 panel2->SetExpansionState(Panel::TITLE_ONLY); 273 panel2->SetExpansionState(Panel::TITLE_ONLY);
274 EXPECT_EQ(Panel::TITLE_ONLY, panel2->expansion_state()); 274 EXPECT_EQ(Panel::TITLE_ONLY, panel2->expansion_state());
275 panel3->SetExpansionState(Panel::MINIMIZED); 275 panel3->SetExpansionState(Panel::MINIMIZED);
276 EXPECT_EQ(Panel::MINIMIZED, panel3->expansion_state()); 276 EXPECT_EQ(Panel::MINIMIZED, panel3->expansion_state());
277 scoped_ptr<NativePanelTesting> panel1_testing( 277 std::unique_ptr<NativePanelTesting> panel1_testing(
278 CreateNativePanelTesting(panel1)); 278 CreateNativePanelTesting(panel1));
279 scoped_ptr<NativePanelTesting> panel2_testing( 279 std::unique_ptr<NativePanelTesting> panel2_testing(
280 CreateNativePanelTesting(panel2)); 280 CreateNativePanelTesting(panel2));
281 scoped_ptr<NativePanelTesting> panel3_testing( 281 std::unique_ptr<NativePanelTesting> panel3_testing(
282 CreateNativePanelTesting(panel3)); 282 CreateNativePanelTesting(panel3));
283 283
284 // Ensure that the layout message can get a chance to be processed so that 284 // Ensure that the layout message can get a chance to be processed so that
285 // the button visibility can be updated. 285 // the button visibility can be updated.
286 base::MessageLoop::current()->RunUntilIdle(); 286 base::MessageLoop::current()->RunUntilIdle();
287 287
288 EXPECT_EQ(3, panel_manager->num_panels()); 288 EXPECT_EQ(3, panel_manager->num_panels());
289 EXPECT_TRUE(docked_collection->HasPanel(panel1)); 289 EXPECT_TRUE(docked_collection->HasPanel(panel1));
290 EXPECT_TRUE(docked_collection->HasPanel(panel2)); 290 EXPECT_TRUE(docked_collection->HasPanel(panel2));
291 EXPECT_TRUE(docked_collection->HasPanel(panel3)); 291 EXPECT_TRUE(docked_collection->HasPanel(panel3));
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 EXPECT_EQ(original_height, panel->GetBounds().height()); 507 EXPECT_EQ(original_height, panel->GetBounds().height());
508 EXPECT_EQ(new_bounds.size(), panel->GetRestoredBounds().size()); 508 EXPECT_EQ(new_bounds.size(), panel->GetRestoredBounds().size());
509 509
510 panel->Close(); 510 panel->Close();
511 } 511 }
512 512
513 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, AnimateBounds) { 513 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, AnimateBounds) {
514 // Create a detached panel, instead of docked panel because it cannot be 514 // Create a detached panel, instead of docked panel because it cannot be
515 // moved to any location. 515 // moved to any location.
516 Panel* panel = CreateDetachedPanel("1", gfx::Rect(200, 100, 100, 100)); 516 Panel* panel = CreateDetachedPanel("1", gfx::Rect(200, 100, 100, 100));
517 scoped_ptr<NativePanelTesting> panel_testing( 517 std::unique_ptr<NativePanelTesting> panel_testing(
518 CreateNativePanelTesting(panel)); 518 CreateNativePanelTesting(panel));
519 519
520 // Validates that no animation should be triggered when the panel is being 520 // Validates that no animation should be triggered when the panel is being
521 // dragged. 521 // dragged.
522 gfx::Point mouse_location(panel->GetBounds().origin()); 522 gfx::Point mouse_location(panel->GetBounds().origin());
523 panel_testing->PressLeftMouseButtonTitlebar(mouse_location); 523 panel_testing->PressLeftMouseButtonTitlebar(mouse_location);
524 panel_testing->DragTitlebar(mouse_location + gfx::Vector2d(-100, 5)); 524 panel_testing->DragTitlebar(mouse_location + gfx::Vector2d(-100, 5));
525 EXPECT_FALSE(panel_testing->IsAnimatingBounds()); 525 EXPECT_FALSE(panel_testing->IsAnimatingBounds());
526 panel_testing->FinishDragTitlebar(); 526 panel_testing->FinishDragTitlebar();
527 527
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
681 #endif 681 #endif
682 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, MAYBE_RestoreAllWithTitlebarClick) { 682 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, MAYBE_RestoreAllWithTitlebarClick) {
683 // Test with three panels. 683 // Test with three panels.
684 Panel* panel1 = CreatePanel("PanelTest1"); 684 Panel* panel1 = CreatePanel("PanelTest1");
685 Panel* panel2 = CreatePanel("PanelTest2"); 685 Panel* panel2 = CreatePanel("PanelTest2");
686 Panel* panel3 = CreatePanel("PanelTest3"); 686 Panel* panel3 = CreatePanel("PanelTest3");
687 EXPECT_FALSE(panel1->IsMinimized()); 687 EXPECT_FALSE(panel1->IsMinimized());
688 EXPECT_FALSE(panel2->IsMinimized()); 688 EXPECT_FALSE(panel2->IsMinimized());
689 EXPECT_FALSE(panel3->IsMinimized()); 689 EXPECT_FALSE(panel3->IsMinimized());
690 690
691 scoped_ptr<NativePanelTesting> test_panel1( 691 std::unique_ptr<NativePanelTesting> test_panel1(
692 CreateNativePanelTesting(panel1)); 692 CreateNativePanelTesting(panel1));
693 scoped_ptr<NativePanelTesting> test_panel2( 693 std::unique_ptr<NativePanelTesting> test_panel2(
694 CreateNativePanelTesting(panel2)); 694 CreateNativePanelTesting(panel2));
695 scoped_ptr<NativePanelTesting> test_panel3( 695 std::unique_ptr<NativePanelTesting> test_panel3(
696 CreateNativePanelTesting(panel3)); 696 CreateNativePanelTesting(panel3));
697 697
698 // Click on an expanded panel's titlebar using the apply-all modifier. 698 // Click on an expanded panel's titlebar using the apply-all modifier.
699 // Verify expansion state is unchanged. 699 // Verify expansion state is unchanged.
700 test_panel2->PressLeftMouseButtonTitlebar(panel2->GetBounds().origin(), 700 test_panel2->PressLeftMouseButtonTitlebar(panel2->GetBounds().origin(),
701 panel::APPLY_TO_ALL); 701 panel::APPLY_TO_ALL);
702 test_panel2->ReleaseMouseButtonTitlebar(panel::APPLY_TO_ALL); 702 test_panel2->ReleaseMouseButtonTitlebar(panel::APPLY_TO_ALL);
703 EXPECT_FALSE(panel1->IsMinimized()); 703 EXPECT_FALSE(panel1->IsMinimized());
704 EXPECT_FALSE(panel2->IsMinimized()); 704 EXPECT_FALSE(panel2->IsMinimized());
705 EXPECT_FALSE(panel3->IsMinimized()); 705 EXPECT_FALSE(panel3->IsMinimized());
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
992 #define MAYBE_ActivateDeactivateBasic DISABLED_ActivateDeactivateBasic 992 #define MAYBE_ActivateDeactivateBasic DISABLED_ActivateDeactivateBasic
993 #endif 993 #endif
994 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, MAYBE_ActivateDeactivateBasic) { 994 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, MAYBE_ActivateDeactivateBasic) {
995 if (!WmSupportWindowActivation()) { 995 if (!WmSupportWindowActivation()) {
996 LOG(WARNING) << "Skipping test due to WM problems."; 996 LOG(WARNING) << "Skipping test due to WM problems.";
997 return; 997 return;
998 } 998 }
999 999
1000 // Create an active panel. 1000 // Create an active panel.
1001 Panel* panel = CreatePanel("PanelTest"); 1001 Panel* panel = CreatePanel("PanelTest");
1002 scoped_ptr<NativePanelTesting> native_panel_testing( 1002 std::unique_ptr<NativePanelTesting> native_panel_testing(
1003 CreateNativePanelTesting(panel)); 1003 CreateNativePanelTesting(panel));
1004 1004
1005 WaitForPanelActiveState(panel, SHOW_AS_ACTIVE); // doublecheck active state 1005 WaitForPanelActiveState(panel, SHOW_AS_ACTIVE); // doublecheck active state
1006 EXPECT_TRUE(native_panel_testing->VerifyActiveState(true)); 1006 EXPECT_TRUE(native_panel_testing->VerifyActiveState(true));
1007 1007
1008 // Deactivate the panel. 1008 // Deactivate the panel.
1009 panel->Deactivate(); 1009 panel->Deactivate();
1010 WaitForPanelActiveState(panel, SHOW_AS_INACTIVE); 1010 WaitForPanelActiveState(panel, SHOW_AS_INACTIVE);
1011 1011
1012 // On GTK there is no way to deactivate a window. So the Deactivate() call 1012 // On GTK there is no way to deactivate a window. So the Deactivate() call
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1050 EXPECT_EQ(expected_active_states, GetAllPanelActiveStates()); 1050 EXPECT_EQ(expected_active_states, GetAllPanelActiveStates());
1051 1051
1052 // Minimizing inactive panel P2 should not affect other panels' active states. 1052 // Minimizing inactive panel P2 should not affect other panels' active states.
1053 panels[2]->SetExpansionState(Panel::MINIMIZED); 1053 panels[2]->SetExpansionState(Panel::MINIMIZED);
1054 EXPECT_EQ(expected_active_states, GetAllPanelActiveStates()); 1054 EXPECT_EQ(expected_active_states, GetAllPanelActiveStates());
1055 EXPECT_FALSE(tabbed_window->IsActive()); 1055 EXPECT_FALSE(tabbed_window->IsActive());
1056 } 1056 }
1057 1057
1058 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, DrawAttentionBasic) { 1058 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, DrawAttentionBasic) {
1059 Panel* panel = CreateInactivePanel("P1"); 1059 Panel* panel = CreateInactivePanel("P1");
1060 scoped_ptr<NativePanelTesting> native_panel_testing( 1060 std::unique_ptr<NativePanelTesting> native_panel_testing(
1061 CreateNativePanelTesting(panel)); 1061 CreateNativePanelTesting(panel));
1062 1062
1063 // Test that the attention is drawn when the expanded panel is not in focus. 1063 // Test that the attention is drawn when the expanded panel is not in focus.
1064 EXPECT_EQ(Panel::EXPANDED, panel->expansion_state()); 1064 EXPECT_EQ(Panel::EXPANDED, panel->expansion_state());
1065 EXPECT_FALSE(panel->IsActive()); 1065 EXPECT_FALSE(panel->IsActive());
1066 EXPECT_FALSE(panel->IsDrawingAttention()); 1066 EXPECT_FALSE(panel->IsDrawingAttention());
1067 panel->FlashFrame(true); 1067 panel->FlashFrame(true);
1068 EXPECT_TRUE(panel->IsDrawingAttention()); 1068 EXPECT_TRUE(panel->IsDrawingAttention());
1069 EXPECT_TRUE(native_panel_testing->VerifyDrawingAttention()); 1069 EXPECT_TRUE(native_panel_testing->VerifyDrawingAttention());
1070 1070
(...skipping 15 matching lines...) Expand all
1086 EXPECT_FALSE(panel->IsDrawingAttention()); 1086 EXPECT_FALSE(panel->IsDrawingAttention());
1087 EXPECT_EQ(Panel::MINIMIZED, panel->expansion_state()); 1087 EXPECT_EQ(Panel::MINIMIZED, panel->expansion_state());
1088 1088
1089 panel->Close(); 1089 panel->Close();
1090 } 1090 }
1091 1091
1092 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, DrawAttentionWhileMinimized) { 1092 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, DrawAttentionWhileMinimized) {
1093 Panel* panel1 = CreateInactivePanel("P1"); 1093 Panel* panel1 = CreateInactivePanel("P1");
1094 Panel* panel2 = CreateInactivePanel("P2"); 1094 Panel* panel2 = CreateInactivePanel("P2");
1095 1095
1096 scoped_ptr<NativePanelTesting> native_panel1_testing( 1096 std::unique_ptr<NativePanelTesting> native_panel1_testing(
1097 CreateNativePanelTesting(panel1)); 1097 CreateNativePanelTesting(panel1));
1098 1098
1099 // Test that the attention is drawn and the title-bar is brought up when the 1099 // Test that the attention is drawn and the title-bar is brought up when the
1100 // minimized panel is drawing attention. 1100 // minimized panel is drawing attention.
1101 panel1->Minimize(); 1101 panel1->Minimize();
1102 EXPECT_EQ(Panel::MINIMIZED, panel1->expansion_state()); 1102 EXPECT_EQ(Panel::MINIMIZED, panel1->expansion_state());
1103 panel1->FlashFrame(true); 1103 panel1->FlashFrame(true);
1104 EXPECT_TRUE(panel1->IsDrawingAttention()); 1104 EXPECT_TRUE(panel1->IsDrawingAttention());
1105 EXPECT_EQ(Panel::TITLE_ONLY, panel1->expansion_state()); 1105 EXPECT_EQ(Panel::TITLE_ONLY, panel1->expansion_state());
1106 EXPECT_TRUE(native_panel1_testing->VerifyDrawingAttention()); 1106 EXPECT_TRUE(native_panel1_testing->VerifyDrawingAttention());
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
1195 MoveMouseAndWaitForExpansionStateChange(panel1, hover_point); 1195 MoveMouseAndWaitForExpansionStateChange(panel1, hover_point);
1196 EXPECT_EQ(Panel::MINIMIZED, panel1->expansion_state()); 1196 EXPECT_EQ(Panel::MINIMIZED, panel1->expansion_state());
1197 EXPECT_EQ(Panel::MINIMIZED, panel2->expansion_state()); 1197 EXPECT_EQ(Panel::MINIMIZED, panel2->expansion_state());
1198 1198
1199 PanelManager::GetInstance()->CloseAll(); 1199 PanelManager::GetInstance()->CloseAll();
1200 } 1200 }
1201 1201
1202 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, DrawAttentionWhenActive) { 1202 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, DrawAttentionWhenActive) {
1203 // Create an active panel. 1203 // Create an active panel.
1204 Panel* panel = CreatePanel("P1"); 1204 Panel* panel = CreatePanel("P1");
1205 scoped_ptr<NativePanelTesting> native_panel_testing( 1205 std::unique_ptr<NativePanelTesting> native_panel_testing(
1206 CreateNativePanelTesting(panel)); 1206 CreateNativePanelTesting(panel));
1207 1207
1208 // Test that the attention should not be drawn if the expanded panel is in 1208 // Test that the attention should not be drawn if the expanded panel is in
1209 // focus. 1209 // focus.
1210 panel->FlashFrame(true); 1210 panel->FlashFrame(true);
1211 EXPECT_FALSE(panel->IsDrawingAttention()); 1211 EXPECT_FALSE(panel->IsDrawingAttention());
1212 EXPECT_FALSE(native_panel_testing->VerifyDrawingAttention()); 1212 EXPECT_FALSE(native_panel_testing->VerifyDrawingAttention());
1213 1213
1214 panel->Close(); 1214 panel->Close();
1215 } 1215 }
1216 1216
1217 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, DrawAttentionResetOnActivate) { 1217 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, DrawAttentionResetOnActivate) {
1218 Panel* panel = CreateInactivePanel("P1"); 1218 Panel* panel = CreateInactivePanel("P1");
1219 scoped_ptr<NativePanelTesting> native_panel_testing( 1219 std::unique_ptr<NativePanelTesting> native_panel_testing(
1220 CreateNativePanelTesting(panel)); 1220 CreateNativePanelTesting(panel));
1221 1221
1222 panel->FlashFrame(true); 1222 panel->FlashFrame(true);
1223 EXPECT_TRUE(panel->IsDrawingAttention()); 1223 EXPECT_TRUE(panel->IsDrawingAttention());
1224 EXPECT_TRUE(native_panel_testing->VerifyDrawingAttention()); 1224 EXPECT_TRUE(native_panel_testing->VerifyDrawingAttention());
1225 1225
1226 // Test that the attention is cleared when panel gets focus. 1226 // Test that the attention is cleared when panel gets focus.
1227 panel->Activate(); 1227 panel->Activate();
1228 WaitForPanelActiveState(panel, SHOW_AS_ACTIVE); 1228 WaitForPanelActiveState(panel, SHOW_AS_ACTIVE);
1229 EXPECT_FALSE(panel->IsDrawingAttention()); 1229 EXPECT_FALSE(panel->IsDrawingAttention());
(...skipping 23 matching lines...) Expand all
1253 EXPECT_TRUE(panel->IsDrawingAttention()); // Unchanged. 1253 EXPECT_TRUE(panel->IsDrawingAttention()); // Unchanged.
1254 1254
1255 panel->OnActiveStateChanged(true); 1255 panel->OnActiveStateChanged(true);
1256 EXPECT_FALSE(panel->IsDrawingAttention()); // Attention cleared. 1256 EXPECT_FALSE(panel->IsDrawingAttention()); // Attention cleared.
1257 1257
1258 panel->Close(); 1258 panel->Close();
1259 } 1259 }
1260 1260
1261 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, DrawAttentionResetOnClick) { 1261 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, DrawAttentionResetOnClick) {
1262 Panel* panel = CreateInactivePanel("P1"); 1262 Panel* panel = CreateInactivePanel("P1");
1263 scoped_ptr<NativePanelTesting> native_panel_testing( 1263 std::unique_ptr<NativePanelTesting> native_panel_testing(
1264 CreateNativePanelTesting(panel)); 1264 CreateNativePanelTesting(panel));
1265 1265
1266 panel->FlashFrame(true); 1266 panel->FlashFrame(true);
1267 EXPECT_TRUE(panel->IsDrawingAttention()); 1267 EXPECT_TRUE(panel->IsDrawingAttention());
1268 EXPECT_TRUE(native_panel_testing->VerifyDrawingAttention()); 1268 EXPECT_TRUE(native_panel_testing->VerifyDrawingAttention());
1269 1269
1270 // Test that the attention is cleared when panel gets focus. 1270 // Test that the attention is cleared when panel gets focus.
1271 native_panel_testing->PressLeftMouseButtonTitlebar( 1271 native_panel_testing->PressLeftMouseButtonTitlebar(
1272 panel->GetBounds().origin()); 1272 panel->GetBounds().origin());
1273 native_panel_testing->ReleaseMouseButtonTitlebar(); 1273 native_panel_testing->ReleaseMouseButtonTitlebar();
1274 1274
1275 WaitForPanelActiveState(panel, SHOW_AS_ACTIVE); 1275 WaitForPanelActiveState(panel, SHOW_AS_ACTIVE);
1276 EXPECT_FALSE(panel->IsDrawingAttention()); 1276 EXPECT_FALSE(panel->IsDrawingAttention());
1277 EXPECT_FALSE(native_panel_testing->VerifyDrawingAttention()); 1277 EXPECT_FALSE(native_panel_testing->VerifyDrawingAttention());
1278 1278
1279 panel->Close(); 1279 panel->Close();
1280 } 1280 }
1281 1281
1282 // http://crbug.com/175760; several panel tests failing regularly on mac. 1282 // http://crbug.com/175760; several panel tests failing regularly on mac.
1283 #if defined(OS_MACOSX) 1283 #if defined(OS_MACOSX)
1284 #define MAYBE_MinimizeImmediatelyAfterRestore \ 1284 #define MAYBE_MinimizeImmediatelyAfterRestore \
1285 DISABLED_MinimizeImmediatelyAfterRestore 1285 DISABLED_MinimizeImmediatelyAfterRestore
1286 #else 1286 #else
1287 #define MAYBE_MinimizeImmediatelyAfterRestore MinimizeImmediatelyAfterRestore 1287 #define MAYBE_MinimizeImmediatelyAfterRestore MinimizeImmediatelyAfterRestore
1288 #endif 1288 #endif
1289 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, 1289 IN_PROC_BROWSER_TEST_F(PanelBrowserTest,
1290 MAYBE_MinimizeImmediatelyAfterRestore) { 1290 MAYBE_MinimizeImmediatelyAfterRestore) {
1291 CreatePanelParams params("Panel Test", gfx::Rect(), SHOW_AS_ACTIVE); 1291 CreatePanelParams params("Panel Test", gfx::Rect(), SHOW_AS_ACTIVE);
1292 Panel* panel = CreatePanelWithParams(params); 1292 Panel* panel = CreatePanelWithParams(params);
1293 scoped_ptr<NativePanelTesting> native_panel_testing( 1293 std::unique_ptr<NativePanelTesting> native_panel_testing(
1294 CreateNativePanelTesting(panel)); 1294 CreateNativePanelTesting(panel));
1295 1295
1296 PanelActiveStateObserver signal(panel, false); 1296 PanelActiveStateObserver signal(panel, false);
1297 panel->Minimize(); // this should deactivate. 1297 panel->Minimize(); // this should deactivate.
1298 signal.Wait(); 1298 signal.Wait();
1299 EXPECT_EQ(Panel::MINIMIZED, panel->expansion_state()); 1299 EXPECT_EQ(Panel::MINIMIZED, panel->expansion_state());
1300 1300
1301 panel->Restore(); 1301 panel->Restore();
1302 EXPECT_EQ(Panel::EXPANDED, panel->expansion_state()); 1302 EXPECT_EQ(Panel::EXPANDED, panel->expansion_state());
1303 1303
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
1698 content::NativeWebKeyboardEvent key_event(ui_event); 1698 content::NativeWebKeyboardEvent key_event(ui_event);
1699 panel->HandleKeyboardEvent(key_event); 1699 panel->HandleKeyboardEvent(key_event);
1700 signal.Wait(); 1700 signal.Wait();
1701 EXPECT_EQ(0, panel_manager->num_panels()); 1701 EXPECT_EQ(0, panel_manager->num_panels());
1702 } 1702 }
1703 1703
1704 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, 1704 IN_PROC_BROWSER_TEST_F(PanelBrowserTest,
1705 HideDockedPanelCreatedBeforeFullScreenMode) { 1705 HideDockedPanelCreatedBeforeFullScreenMode) {
1706 // Create a docked panel. 1706 // Create a docked panel.
1707 Panel* panel = CreatePanel("PanelTest"); 1707 Panel* panel = CreatePanel("PanelTest");
1708 scoped_ptr<NativePanelTesting> panel_testing(CreateNativePanelTesting(panel)); 1708 std::unique_ptr<NativePanelTesting> panel_testing(
1709 CreateNativePanelTesting(panel));
1709 1710
1710 // Panel should be visible at first. 1711 // Panel should be visible at first.
1711 EXPECT_TRUE(panel_testing->IsWindowVisible()); 1712 EXPECT_TRUE(panel_testing->IsWindowVisible());
1712 1713
1713 // Panel should become hidden when entering full-screen mode. 1714 // Panel should become hidden when entering full-screen mode.
1714 mock_display_settings_provider()->EnableFullScreenMode(true); 1715 mock_display_settings_provider()->EnableFullScreenMode(true);
1715 EXPECT_FALSE(panel_testing->IsWindowVisible()); 1716 EXPECT_FALSE(panel_testing->IsWindowVisible());
1716 1717
1717 // Panel should become visible when leaving full-screen mode. 1718 // Panel should become visible when leaving full-screen mode.
1718 mock_display_settings_provider()->EnableFullScreenMode(false); 1719 mock_display_settings_provider()->EnableFullScreenMode(false);
1719 EXPECT_TRUE(panel_testing->IsWindowVisible()); 1720 EXPECT_TRUE(panel_testing->IsWindowVisible());
1720 1721
1721 PanelManager::GetInstance()->CloseAll(); 1722 PanelManager::GetInstance()->CloseAll();
1722 } 1723 }
1723 1724
1724 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, 1725 IN_PROC_BROWSER_TEST_F(PanelBrowserTest,
1725 HideDockedPanelCreatedOnFullScreenMode) { 1726 HideDockedPanelCreatedOnFullScreenMode) {
1726 // Enable full-screen mode first. 1727 // Enable full-screen mode first.
1727 mock_display_settings_provider()->EnableFullScreenMode(true); 1728 mock_display_settings_provider()->EnableFullScreenMode(true);
1728 1729
1729 // Create a docked panel without waiting for it to be shown since it is not 1730 // Create a docked panel without waiting for it to be shown since it is not
1730 // supposed to be shown on full-screen mode. 1731 // supposed to be shown on full-screen mode.
1731 CreatePanelParams params("1", gfx::Rect(0, 0, 250, 200), SHOW_AS_ACTIVE); 1732 CreatePanelParams params("1", gfx::Rect(0, 0, 250, 200), SHOW_AS_ACTIVE);
1732 params.wait_for_fully_created = false; 1733 params.wait_for_fully_created = false;
1733 Panel* panel = CreatePanelWithParams(params); 1734 Panel* panel = CreatePanelWithParams(params);
1734 scoped_ptr<NativePanelTesting> panel_testing( 1735 std::unique_ptr<NativePanelTesting> panel_testing(
1735 CreateNativePanelTesting(panel)); 1736 CreateNativePanelTesting(panel));
1736 1737
1737 // Panel should not be shown on full-screen mode. 1738 // Panel should not be shown on full-screen mode.
1738 EXPECT_FALSE(panel_testing->IsWindowVisible()); 1739 EXPECT_FALSE(panel_testing->IsWindowVisible());
1739 1740
1740 // Panel should become visible when leaving full-screen mode. 1741 // Panel should become visible when leaving full-screen mode.
1741 mock_display_settings_provider()->EnableFullScreenMode(false); 1742 mock_display_settings_provider()->EnableFullScreenMode(false);
1742 EXPECT_TRUE(panel_testing->IsWindowVisible()); 1743 EXPECT_TRUE(panel_testing->IsWindowVisible());
1743 1744
1744 PanelManager::GetInstance()->CloseAll(); 1745 PanelManager::GetInstance()->CloseAll();
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
1849 expected_prefix, 1850 expected_prefix,
1850 base::CompareCase::INSENSITIVE_ASCII)); 1851 base::CompareCase::INSENSITIVE_ASCII));
1851 1852
1852 PanelManager::GetInstance()->CloseAll(); 1853 PanelManager::GetInstance()->CloseAll();
1853 EXPECT_EQ(1U, task_manager.tasks().size()); 1854 EXPECT_EQ(1U, task_manager.tasks().size());
1854 } 1855 }
1855 1856
1856 } // namespace 1857 } // namespace
1857 1858
1858 #endif // defined(ENABLE_TASK_MANAGER) 1859 #endif // defined(ENABLE_TASK_MANAGER)
OLDNEW
« no previous file with comments | « chrome/browser/ui/panels/panel.cc ('k') | chrome/browser/ui/panels/panel_drag_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698