| 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 "base/message_loop.h" | 5 #include "base/message_loop.h" |
| 6 #include "chrome/browser/ui/panels/base_panel_browser_test.h" | 6 #include "chrome/browser/ui/panels/base_panel_browser_test.h" |
| 7 #include "chrome/browser/ui/panels/detached_panel_collection.h" | 7 #include "chrome/browser/ui/panels/detached_panel_collection.h" |
| 8 #include "chrome/browser/ui/panels/docked_panel_collection.h" | 8 #include "chrome/browser/ui/panels/docked_panel_collection.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/panel.h" | 10 #include "chrome/browser/ui/panels/panel.h" |
| (...skipping 1058 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1069 // Expect that the panel is back as docked. | 1069 // Expect that the panel is back as docked. |
| 1070 panel_testing->CancelDragTitlebar(); | 1070 panel_testing->CancelDragTitlebar(); |
| 1071 ASSERT_EQ(1, docked_collection->num_panels()); | 1071 ASSERT_EQ(1, docked_collection->num_panels()); |
| 1072 ASSERT_EQ(0, detached_collection->num_panels()); | 1072 ASSERT_EQ(0, detached_collection->num_panels()); |
| 1073 EXPECT_EQ(PanelCollection::DOCKED, panel->collection()->type()); | 1073 EXPECT_EQ(PanelCollection::DOCKED, panel->collection()->type()); |
| 1074 EXPECT_EQ(panel_old_bounds, panel->GetBounds()); | 1074 EXPECT_EQ(panel_old_bounds, panel->GetBounds()); |
| 1075 | 1075 |
| 1076 panel_manager->CloseAll(); | 1076 panel_manager->CloseAll(); |
| 1077 } | 1077 } |
| 1078 | 1078 |
| 1079 IN_PROC_BROWSER_TEST_F(PanelDragBrowserTest, Attach) { | 1079 // http://crbug.com/175760; several panel tests failing regularly on mac. |
| 1080 #if defined(OS_MAC) |
| 1081 #define MAYBE_Attach DISABLED_Attach |
| 1082 #else |
| 1083 #define MAYBE_Attach Attach |
| 1084 #endif |
| 1085 IN_PROC_BROWSER_TEST_F(PanelDragBrowserTest, MAYBE_Attach) { |
| 1080 PanelManager* panel_manager = PanelManager::GetInstance(); | 1086 PanelManager* panel_manager = PanelManager::GetInstance(); |
| 1081 DockedPanelCollection* docked_collection = panel_manager->docked_collection(); | 1087 DockedPanelCollection* docked_collection = panel_manager->docked_collection(); |
| 1082 DetachedPanelCollection* detached_collection = | 1088 DetachedPanelCollection* detached_collection = |
| 1083 panel_manager->detached_collection(); | 1089 panel_manager->detached_collection(); |
| 1084 | 1090 |
| 1085 // Create one detached panel. | 1091 // Create one detached panel. |
| 1086 Panel* panel = CreateDetachedPanel("1", gfx::Rect(400, 300, 100, 100)); | 1092 Panel* panel = CreateDetachedPanel("1", gfx::Rect(400, 300, 100, 100)); |
| 1087 ASSERT_EQ(0, docked_collection->num_panels()); | 1093 ASSERT_EQ(0, docked_collection->num_panels()); |
| 1088 ASSERT_EQ(1, detached_collection->num_panels()); | 1094 ASSERT_EQ(1, detached_collection->num_panels()); |
| 1089 EXPECT_EQ(PanelCollection::DETACHED, panel->collection()->type()); | 1095 EXPECT_EQ(PanelCollection::DETACHED, panel->collection()->type()); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1129 EXPECT_EQ(PanelCollection::DOCKED, panel->collection()->type()); | 1135 EXPECT_EQ(PanelCollection::DOCKED, panel->collection()->type()); |
| 1130 panel_new_bounds.set_x( | 1136 panel_new_bounds.set_x( |
| 1131 docked_collection->StartingRightPosition() - panel_new_bounds.width()); | 1137 docked_collection->StartingRightPosition() - panel_new_bounds.width()); |
| 1132 panel_new_bounds.set_y( | 1138 panel_new_bounds.set_y( |
| 1133 docked_collection->display_area().bottom() - panel_new_bounds.height()); | 1139 docked_collection->display_area().bottom() - panel_new_bounds.height()); |
| 1134 EXPECT_EQ(panel_new_bounds, panel->GetBounds()); | 1140 EXPECT_EQ(panel_new_bounds, panel->GetBounds()); |
| 1135 | 1141 |
| 1136 panel_manager->CloseAll(); | 1142 panel_manager->CloseAll(); |
| 1137 } | 1143 } |
| 1138 | 1144 |
| 1139 IN_PROC_BROWSER_TEST_F(PanelDragBrowserTest, AttachAndCancel) { | 1145 // http://crbug.com/175760; several panel tests failing regularly on mac. |
| 1146 #if defined(OS_MAC) |
| 1147 #define MAYBE_AttachAndCancel DISABLED_AttachAndCancel |
| 1148 #else |
| 1149 #define MAYBE_AttachAndCancel AttachAndCancel |
| 1150 #endif |
| 1151 IN_PROC_BROWSER_TEST_F(PanelDragBrowserTest, MAYBE_AttachAndCancel) { |
| 1140 PanelManager* panel_manager = PanelManager::GetInstance(); | 1152 PanelManager* panel_manager = PanelManager::GetInstance(); |
| 1141 DockedPanelCollection* docked_collection = panel_manager->docked_collection(); | 1153 DockedPanelCollection* docked_collection = panel_manager->docked_collection(); |
| 1142 DetachedPanelCollection* detached_collection = | 1154 DetachedPanelCollection* detached_collection = |
| 1143 panel_manager->detached_collection(); | 1155 panel_manager->detached_collection(); |
| 1144 | 1156 |
| 1145 // Create one detached panel. | 1157 // Create one detached panel. |
| 1146 Panel* panel = CreateDetachedPanel("1", gfx::Rect(400, 300, 100, 100)); | 1158 Panel* panel = CreateDetachedPanel("1", gfx::Rect(400, 300, 100, 100)); |
| 1147 ASSERT_EQ(0, docked_collection->num_panels()); | 1159 ASSERT_EQ(0, docked_collection->num_panels()); |
| 1148 ASSERT_EQ(1, detached_collection->num_panels()); | 1160 ASSERT_EQ(1, detached_collection->num_panels()); |
| 1149 EXPECT_EQ(PanelCollection::DETACHED, panel->collection()->type()); | 1161 EXPECT_EQ(PanelCollection::DETACHED, panel->collection()->type()); |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1248 panel_testing->CancelDragTitlebar(); | 1260 panel_testing->CancelDragTitlebar(); |
| 1249 ASSERT_EQ(1, docked_collection->num_panels()); | 1261 ASSERT_EQ(1, docked_collection->num_panels()); |
| 1250 ASSERT_EQ(0, detached_collection->num_panels()); | 1262 ASSERT_EQ(0, detached_collection->num_panels()); |
| 1251 EXPECT_EQ(PanelCollection::DOCKED, panel->collection()->type()); | 1263 EXPECT_EQ(PanelCollection::DOCKED, panel->collection()->type()); |
| 1252 EXPECT_EQ(panel_old_bounds, panel->GetBounds()); | 1264 EXPECT_EQ(panel_old_bounds, panel->GetBounds()); |
| 1253 | 1265 |
| 1254 panel_manager->CloseAll(); | 1266 panel_manager->CloseAll(); |
| 1255 } | 1267 } |
| 1256 | 1268 |
| 1257 // Disabled on GTK in metacity: http://crbug.com/167114 | 1269 // Disabled on GTK in metacity: http://crbug.com/167114 |
| 1258 #if defined(TOOLKIT_GTK) | 1270 // http://crbug.com/175760; several panel tests failing regularly on mac. |
| 1271 #if defined(TOOLKIT_GTK) || defined(OS_MAC) |
| 1259 #define MAYBE_DetachWithSqueeze DISABLED_DetachWithSqueeze | 1272 #define MAYBE_DetachWithSqueeze DISABLED_DetachWithSqueeze |
| 1260 #else | 1273 #else |
| 1261 #define MAYBE_DetachWithSqueeze DetachWithSqueeze | 1274 #define MAYBE_DetachWithSqueeze DetachWithSqueeze |
| 1262 #endif | 1275 #endif |
| 1263 IN_PROC_BROWSER_TEST_F(PanelDragBrowserTest, MAYBE_DetachWithSqueeze) { | 1276 IN_PROC_BROWSER_TEST_F(PanelDragBrowserTest, MAYBE_DetachWithSqueeze) { |
| 1264 PanelManager* panel_manager = PanelManager::GetInstance(); | 1277 PanelManager* panel_manager = PanelManager::GetInstance(); |
| 1265 DockedPanelCollection* docked_collection = panel_manager->docked_collection(); | 1278 DockedPanelCollection* docked_collection = panel_manager->docked_collection(); |
| 1266 DetachedPanelCollection* detached_collection = | 1279 DetachedPanelCollection* detached_collection = |
| 1267 panel_manager->detached_collection(); | 1280 panel_manager->detached_collection(); |
| 1268 | 1281 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1335 | 1348 |
| 1336 // No more squeeze, docked panels should stay put. | 1349 // No more squeeze, docked panels should stay put. |
| 1337 EXPECT_EQ(docked_position1, panel3->GetBounds().origin()); | 1350 EXPECT_EQ(docked_position1, panel3->GetBounds().origin()); |
| 1338 EXPECT_EQ(panel1->GetBounds().width(), panel1->GetRestoredBounds().width()); | 1351 EXPECT_EQ(panel1->GetBounds().width(), panel1->GetRestoredBounds().width()); |
| 1339 EXPECT_EQ(docked_position2, panel5->GetBounds().origin()); | 1352 EXPECT_EQ(docked_position2, panel5->GetBounds().origin()); |
| 1340 EXPECT_EQ(panel2->GetBounds().width(), panel2->GetRestoredBounds().width()); | 1353 EXPECT_EQ(panel2->GetBounds().width(), panel2->GetRestoredBounds().width()); |
| 1341 | 1354 |
| 1342 panel_manager->CloseAll(); | 1355 panel_manager->CloseAll(); |
| 1343 } | 1356 } |
| 1344 | 1357 |
| 1345 // http://crbug.com/143247 | 1358 // http://crbug.com/143247, http://crbug.com/175760 |
| 1346 #if defined(OS_LINUX) | 1359 #if defined(OS_LINUX) || defined(OS_MAC) |
| 1347 #define MAYBE_AttachWithSqueeze DISABLED_AttachWithSqueeze | 1360 #define MAYBE_AttachWithSqueeze DISABLED_AttachWithSqueeze |
| 1348 #else | 1361 #else |
| 1349 #define MAYBE_AttachWithSqueeze AttachWithSqueeze | 1362 #define MAYBE_AttachWithSqueeze AttachWithSqueeze |
| 1350 #endif | 1363 #endif |
| 1351 IN_PROC_BROWSER_TEST_F(PanelDragBrowserTest, MAYBE_AttachWithSqueeze) { | 1364 IN_PROC_BROWSER_TEST_F(PanelDragBrowserTest, MAYBE_AttachWithSqueeze) { |
| 1352 PanelManager* panel_manager = PanelManager::GetInstance(); | 1365 PanelManager* panel_manager = PanelManager::GetInstance(); |
| 1353 DockedPanelCollection* docked_collection = panel_manager->docked_collection(); | 1366 DockedPanelCollection* docked_collection = panel_manager->docked_collection(); |
| 1354 DetachedPanelCollection* detached_collection = | 1367 DetachedPanelCollection* detached_collection = |
| 1355 panel_manager->detached_collection(); | 1368 panel_manager->detached_collection(); |
| 1356 | 1369 |
| (...skipping 1569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2926 panel1->GetBounds().height() - panel2->GetBounds().height()); | 2939 panel1->GetBounds().height() - panel2->GetBounds().height()); |
| 2927 EXPECT_EQ(panel1_expected_bounds, panel1->GetBounds()); | 2940 EXPECT_EQ(panel1_expected_bounds, panel1->GetBounds()); |
| 2928 panel2_expected_bounds.set_x(expected_x); | 2941 panel2_expected_bounds.set_x(expected_x); |
| 2929 panel2_expected_bounds.set_y(display_area.bottom() - | 2942 panel2_expected_bounds.set_y(display_area.bottom() - |
| 2930 panel2->GetBounds().height()); | 2943 panel2->GetBounds().height()); |
| 2931 EXPECT_EQ(panel2_expected_bounds, panel2->GetBounds()); | 2944 EXPECT_EQ(panel2_expected_bounds, panel2->GetBounds()); |
| 2932 | 2945 |
| 2933 panel_manager->CloseAll(); | 2946 panel_manager->CloseAll(); |
| 2934 } | 2947 } |
| 2935 #endif | 2948 #endif |
| OLD | NEW |