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

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

Issue 7646003: Support auto-hide taskbar for panels on Windows. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 3 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
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/command_line.h"
6 #include "base/mac/scoped_nsautorelease_pool.h"
7 #include "chrome/browser/extensions/extension_service.h"
8 #include "chrome/browser/prefs/pref_service.h" 5 #include "chrome/browser/prefs/pref_service.h"
9 #include "chrome/browser/profiles/profile.h" 6 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/ui/browser.h"
11 #include "chrome/browser/ui/browser_list.h" 7 #include "chrome/browser/ui/browser_list.h"
12 #include "chrome/browser/ui/browser_window.h" 8 #include "chrome/browser/ui/browser_window.h"
13 #include "chrome/browser/ui/find_bar/find_bar.h" 9 #include "chrome/browser/ui/find_bar/find_bar.h"
14 #include "chrome/browser/ui/find_bar/find_bar_controller.h" 10 #include "chrome/browser/ui/find_bar/find_bar_controller.h"
11 #include "chrome/browser/ui/panels/base_panel_browser_test.h"
15 #include "chrome/browser/ui/panels/native_panel.h" 12 #include "chrome/browser/ui/panels/native_panel.h"
16 #include "chrome/browser/ui/panels/panel.h" 13 #include "chrome/browser/ui/panels/panel.h"
17 #include "chrome/browser/ui/panels/panel_manager.h" 14 #include "chrome/browser/ui/panels/panel_manager.h"
18 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
19 #include "chrome/browser/web_applications/web_app.h" 15 #include "chrome/browser/web_applications/web_app.h"
20 #include "chrome/common/chrome_notification_types.h" 16 #include "chrome/common/chrome_notification_types.h"
21 #include "chrome/common/chrome_switches.h"
22 #include "chrome/common/extensions/extension.h"
23 #include "chrome/common/pref_names.h" 17 #include "chrome/common/pref_names.h"
24 #include "chrome/test/base/in_process_browser_test.h"
25 #include "chrome/test/base/ui_test_utils.h" 18 #include "chrome/test/base/ui_test_utils.h"
26 #include "content/browser/download/download_manager.h" 19 #include "content/browser/download/download_manager.h"
27 #include "content/browser/net/url_request_mock_http_job.h" 20 #include "content/browser/net/url_request_mock_http_job.h"
28 #include "content/browser/tab_contents/test_tab_contents.h"
29 #include "testing/gtest/include/gtest/gtest.h" 21 #include "testing/gtest/include/gtest/gtest.h"
30 22
31 #if defined(OS_MACOSX) 23 class PanelBrowserTest : public BasePanelBrowserTest {
32 #include "chrome/browser/ui/cocoa/find_bar/find_bar_bridge.h"
33 #endif
34
35 class PanelBrowserTest : public InProcessBrowserTest {
36 public: 24 public:
37 PanelBrowserTest() : InProcessBrowserTest() { 25 PanelBrowserTest() : BasePanelBrowserTest() {
38 #if defined(OS_MACOSX)
39 FindBarBridge::disable_animations_during_testing_ = true;
40 #endif
41 }
42
43 virtual void SetUpCommandLine(CommandLine* command_line) {
44 command_line->AppendSwitch(switches::kEnablePanels);
45 } 26 }
46 27
47 protected: 28 protected:
48 Panel* CreatePanel(const std::string& name, const gfx::Rect& bounds) {
49 // Opening panels on a Mac causes NSWindowController of the Panel window
50 // to be autoreleased. We need a pool drained after it's done so the test
51 // can close correctly. The NSWindowController of the Panel window controls
52 // lifetime of the Browser object so we want to release it as soon as
53 // possible. In real Chrome, this is done by message pump.
54 // On non-Mac platform, this is an empty class.
55 base::mac::ScopedNSAutoreleasePool autorelease_pool;
56
57 Browser* panel_browser = Browser::CreateForApp(Browser::TYPE_PANEL,
58 name,
59 bounds,
60 browser()->profile());
61 EXPECT_TRUE(panel_browser->is_type_panel());
62
63 TabContentsWrapper* tab_contents =
64 new TabContentsWrapper(new TestTabContents(browser()->profile(), NULL));
65 panel_browser->AddTab(tab_contents, PageTransition::LINK);
66
67 Panel* panel = static_cast<Panel*>(panel_browser->window());
68 panel->Show();
69 MessageLoopForUI::current()->RunAllPending();
70
71 return panel;
72 }
73
74 void CloseWindowAndWait(Browser* browser) { 29 void CloseWindowAndWait(Browser* browser) {
75 // Closing a browser window may involve several async tasks. Need to use 30 // Closing a browser window may involve several async tasks. Need to use
76 // message pump and wait for the notification. 31 // message pump and wait for the notification.
77 size_t browser_count = BrowserList::size(); 32 size_t browser_count = BrowserList::size();
78 ui_test_utils::WindowedNotificationObserver signal( 33 ui_test_utils::WindowedNotificationObserver signal(
79 chrome::NOTIFICATION_BROWSER_CLOSED, 34 chrome::NOTIFICATION_BROWSER_CLOSED,
80 Source<Browser>(browser)); 35 Source<Browser>(browser));
81 browser->CloseWindow(); 36 browser->CloseWindow();
82 signal.Wait(); 37 signal.Wait();
83 // Now we have one less browser instance. 38 // Now we have one less browser instance.
84 EXPECT_EQ(browser_count - 1, BrowserList::size()); 39 EXPECT_EQ(browser_count - 1, BrowserList::size());
85 } 40 }
86 41
87 // Creates a testing extension.
88 scoped_refptr<Extension> CreateExtension(const FilePath::StringType& path) {
89 #if defined(OS_WIN)
90 FilePath full_path(FILE_PATH_LITERAL("c:\\"));
91 #else
92 FilePath full_path(FILE_PATH_LITERAL("/"));
93 #endif
94 full_path = full_path.Append(path);
95 DictionaryValue input_value;
96 input_value.SetString(extension_manifest_keys::kVersion, "1.0.0.0");
97 input_value.SetString(extension_manifest_keys::kName, "Sample Extension");
98 std::string error;
99 scoped_refptr<Extension> extension = Extension::Create(
100 full_path, Extension::INVALID, input_value,
101 Extension::STRICT_ERROR_CHECKS, &error);
102 EXPECT_TRUE(extension.get());
103 EXPECT_STREQ("", error.c_str());
104 browser()->GetProfile()->GetExtensionService()->OnLoadSingleExtension(
105 extension.get(), false);
106 return extension;
107 }
108
109 void TestCreatePanelOnOverflow() { 42 void TestCreatePanelOnOverflow() {
110 PanelManager* panel_manager = PanelManager::GetInstance(); 43 PanelManager* panel_manager = PanelManager::GetInstance();
111 EXPECT_EQ(0, panel_manager->num_panels()); // No panels initially. 44 EXPECT_EQ(0, panel_manager->num_panels()); // No panels initially.
112 45
113 // Specify the work area for testing purpose.
114 panel_manager->SetWorkArea(gfx::Rect(0, 0, 800, 600));
115
116 // Create testing extensions. 46 // Create testing extensions.
47 DictionaryValue empty_value;
117 scoped_refptr<Extension> extension1 = 48 scoped_refptr<Extension> extension1 =
118 CreateExtension(FILE_PATH_LITERAL("extension1")); 49 CreateExtension(FILE_PATH_LITERAL("extension1"),
50 Extension::INVALID, empty_value);
119 scoped_refptr<Extension> extension2 = 51 scoped_refptr<Extension> extension2 =
120 CreateExtension(FILE_PATH_LITERAL("extension2")); 52 CreateExtension(FILE_PATH_LITERAL("extension2"),
53 Extension::INVALID, empty_value);
121 scoped_refptr<Extension> extension3 = 54 scoped_refptr<Extension> extension3 =
122 CreateExtension(FILE_PATH_LITERAL("extension3")); 55 CreateExtension(FILE_PATH_LITERAL("extension3"),
56 Extension::INVALID, empty_value);
123 57
124 // First, create 3 panels. 58 // First, create 3 panels.
125 Panel* panel1 = CreatePanel( 59 Panel* panel1 = CreatePanelWithBounds(
126 web_app::GenerateApplicationNameFromExtensionId(extension1->id()), 60 web_app::GenerateApplicationNameFromExtensionId(extension1->id()),
127 gfx::Rect(0, 0, 250, 200)); 61 gfx::Rect(0, 0, 250, 200));
128 Panel* panel2 = CreatePanel( 62 Panel* panel2 = CreatePanelWithBounds(
129 web_app::GenerateApplicationNameFromExtensionId(extension2->id()), 63 web_app::GenerateApplicationNameFromExtensionId(extension2->id()),
130 gfx::Rect(0, 0, 300, 200)); 64 gfx::Rect(0, 0, 300, 200));
131 Panel* panel3 = CreatePanel( 65 Panel* panel3 = CreatePanelWithBounds(
132 web_app::GenerateApplicationNameFromExtensionId(extension1->id()), 66 web_app::GenerateApplicationNameFromExtensionId(extension1->id()),
133 gfx::Rect(0, 0, 200, 200)); 67 gfx::Rect(0, 0, 200, 200));
134 ASSERT_EQ(3, panel_manager->num_panels()); 68 ASSERT_EQ(3, panel_manager->num_panels());
135 69
136 // Test closing the leftmost panel that is from same extension. 70 // Test closing the leftmost panel that is from same extension.
137 ui_test_utils::WindowedNotificationObserver signal( 71 ui_test_utils::WindowedNotificationObserver signal(
138 chrome::NOTIFICATION_BROWSER_CLOSED, 72 chrome::NOTIFICATION_BROWSER_CLOSED,
139 Source<Browser>(panel2->browser())); 73 Source<Browser>(panel2->browser()));
140 Panel* panel4 = CreatePanel( 74 Panel* panel4 = CreatePanelWithBounds(
141 web_app::GenerateApplicationNameFromExtensionId(extension2->id()), 75 web_app::GenerateApplicationNameFromExtensionId(extension2->id()),
142 gfx::Rect(0, 0, 280, 200)); 76 gfx::Rect(0, 0, 280, 200));
143 signal.Wait(); 77 signal.Wait();
144 ASSERT_EQ(3, panel_manager->num_panels()); 78 ASSERT_EQ(3, panel_manager->num_panels());
145 EXPECT_LT(panel4->GetBounds().right(), panel3->GetBounds().x()); 79 EXPECT_LT(panel4->GetBounds().right(), panel3->GetBounds().x());
146 EXPECT_LT(panel3->GetBounds().right(), panel1->GetBounds().x()); 80 EXPECT_LT(panel3->GetBounds().right(), panel1->GetBounds().x());
147 81
148 // Test closing the leftmost panel. 82 // Test closing the leftmost panel.
149 ui_test_utils::WindowedNotificationObserver signal2( 83 ui_test_utils::WindowedNotificationObserver signal2(
150 chrome::NOTIFICATION_BROWSER_CLOSED, 84 chrome::NOTIFICATION_BROWSER_CLOSED,
151 Source<Browser>(panel4->browser())); 85 Source<Browser>(panel4->browser()));
152 Panel* panel5 = CreatePanel( 86 Panel* panel5 = CreatePanelWithBounds(
153 web_app::GenerateApplicationNameFromExtensionId(extension3->id()), 87 web_app::GenerateApplicationNameFromExtensionId(extension3->id()),
154 gfx::Rect(0, 0, 300, 200)); 88 gfx::Rect(0, 0, 300, 200));
155 signal2.Wait(); 89 signal2.Wait();
156 ASSERT_EQ(3, panel_manager->num_panels()); 90 ASSERT_EQ(3, panel_manager->num_panels());
157 EXPECT_LT(panel5->GetBounds().right(), panel3->GetBounds().x()); 91 EXPECT_LT(panel5->GetBounds().right(), panel3->GetBounds().x());
158 EXPECT_LT(panel3->GetBounds().right(), panel1->GetBounds().x()); 92 EXPECT_LT(panel3->GetBounds().right(), panel1->GetBounds().x());
159 93
160 // Test closing 2 leftmost panels. 94 // Test closing 2 leftmost panels.
161 ui_test_utils::WindowedNotificationObserver signal3( 95 ui_test_utils::WindowedNotificationObserver signal3(
162 chrome::NOTIFICATION_BROWSER_CLOSED, 96 chrome::NOTIFICATION_BROWSER_CLOSED,
163 Source<Browser>(panel3->browser())); 97 Source<Browser>(panel3->browser()));
164 ui_test_utils::WindowedNotificationObserver signal4( 98 ui_test_utils::WindowedNotificationObserver signal4(
165 chrome::NOTIFICATION_BROWSER_CLOSED, 99 chrome::NOTIFICATION_BROWSER_CLOSED,
166 Source<Browser>(panel5->browser())); 100 Source<Browser>(panel5->browser()));
167 Panel* panel6 = CreatePanel( 101 Panel* panel6 = CreatePanelWithBounds(
168 web_app::GenerateApplicationNameFromExtensionId(extension3->id()), 102 web_app::GenerateApplicationNameFromExtensionId(extension3->id()),
169 gfx::Rect(0, 0, 500, 200)); 103 gfx::Rect(0, 0, 500, 200));
170 signal3.Wait(); 104 signal3.Wait();
171 signal4.Wait(); 105 signal4.Wait();
172 ASSERT_EQ(2, panel_manager->num_panels()); 106 ASSERT_EQ(2, panel_manager->num_panels());
173 EXPECT_LT(panel6->GetBounds().right(), panel1->GetBounds().x()); 107 EXPECT_LT(panel6->GetBounds().right(), panel1->GetBounds().x());
174 108
175 panel1->Close(); 109 panel1->Close();
176 panel6->Close(); 110 panel6->Close();
177 } 111 }
178 112
179 void SetWorkArea(const gfx::Rect& work_area) {
180 PanelManager::GetInstance()->SetWorkArea(gfx::Rect(0, 0, 800, 600));
181 }
182
183 int horizontal_spacing() { 113 int horizontal_spacing() {
184 return PanelManager::horizontal_spacing(); 114 return PanelManager::horizontal_spacing();
185 } 115 }
186 116
187 std::vector<gfx::Rect> GetAllPanelsBounds() { 117 std::vector<gfx::Rect> GetAllPanelsBounds() {
188 std::vector<gfx::Rect> panels_bounds; 118 std::vector<gfx::Rect> panels_bounds;
189 const std::vector<Panel*>& panels = PanelManager::GetInstance()->panels(); 119 const std::vector<Panel*>& panels = PanelManager::GetInstance()->panels();
190 for (size_t i = 0; i < panels.size(); ++i) 120 for (size_t i = 0; i < panels.size(); ++i)
191 panels_bounds.push_back(panels[i]->GetRestoredBounds()); 121 panels_bounds.push_back(panels[i]->GetRestoredBounds());
192 return panels_bounds; 122 return panels_bounds;
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 CheckPanelBoundsWithDeltas(panels, test_begin_bounds, 219 CheckPanelBoundsWithDeltas(panels, test_begin_bounds,
290 expected_delta_x_after_finish); 220 expected_delta_x_after_finish);
291 } 221 }
292 } 222 }
293 }; 223 };
294 224
295 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, CreatePanel) { 225 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, CreatePanel) {
296 PanelManager* panel_manager = PanelManager::GetInstance(); 226 PanelManager* panel_manager = PanelManager::GetInstance();
297 EXPECT_EQ(0, panel_manager->num_panels()); // No panels initially. 227 EXPECT_EQ(0, panel_manager->num_panels()); // No panels initially.
298 228
299 Panel* panel = CreatePanel("PanelTest", gfx::Rect()); 229 Panel* panel = CreatePanel("PanelTest");
300 EXPECT_EQ(1, panel_manager->num_panels()); 230 EXPECT_EQ(1, panel_manager->num_panels());
301 231
302 gfx::Rect bounds = panel->GetBounds(); 232 gfx::Rect bounds = panel->GetBounds();
303 EXPECT_GT(bounds.x(), 0); 233 EXPECT_GT(bounds.x(), 0);
304 EXPECT_GT(bounds.y(), 0); 234 EXPECT_GT(bounds.y(), 0);
305 EXPECT_GT(bounds.width(), 0); 235 EXPECT_GT(bounds.width(), 0);
306 EXPECT_GT(bounds.height(), 0); 236 EXPECT_GT(bounds.height(), 0);
307 237
308 CloseWindowAndWait(panel->browser()); 238 CloseWindowAndWait(panel->browser());
309 239
310 EXPECT_EQ(0, panel_manager->num_panels()); 240 EXPECT_EQ(0, panel_manager->num_panels());
311 } 241 }
312 242
313 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, FindBar) { 243 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, FindBar) {
314 Panel* panel = CreatePanel("PanelTest", gfx::Rect(0, 0, 400, 400)); 244 Panel* panel = CreatePanelWithBounds("PanelTest", gfx::Rect(0, 0, 400, 400));
315 Browser* browser = panel->browser(); 245 Browser* browser = panel->browser();
316 browser->ShowFindBar(); 246 browser->ShowFindBar();
317 ASSERT_TRUE(browser->GetFindBarController()->find_bar()->IsFindBarVisible()); 247 ASSERT_TRUE(browser->GetFindBarController()->find_bar()->IsFindBarVisible());
318 panel->Close(); 248 panel->Close();
319 } 249 }
320 250
321 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, CreatePanelOnOverflow) { 251 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, CreatePanelOnOverflow) {
322 TestCreatePanelOnOverflow(); 252 TestCreatePanelOnOverflow();
323 } 253 }
324 254
325 #if defined(TOOLKIT_GTK) || defined(OS_WIN) 255 #if defined(TOOLKIT_GTK) || defined(OS_WIN)
326 #define MAYBE_DragPanels DragPanels 256 #define MAYBE_DragPanels DragPanels
327 #else 257 #else
328 #define MAYBE_DragPanels DISABLED_DragPanels 258 #define MAYBE_DragPanels DISABLED_DragPanels
329 #endif 259 #endif
330 260
331 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, MAYBE_DragPanels) { 261 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, MAYBE_DragPanels) {
332 // Set work area to make the test consistent on different monitor sizes.
333 SetWorkArea(gfx::Rect(0, 0, 800, 600));
334
335 static const int max_panels = 3; 262 static const int max_panels = 3;
336 static const int zero_delta = 0; 263 static const int zero_delta = 0;
337 static const int small_delta = 10; 264 static const int small_delta = 10;
338 static const int big_delta = 70; 265 static const int big_delta = 70;
339 static const int bigger_delta = 120; 266 static const int bigger_delta = 120;
340 static const int biggest_delta = 200; 267 static const int biggest_delta = 200;
341 static const std::vector<int> zero_deltas(max_panels, zero_delta); 268 static const std::vector<int> zero_deltas(max_panels, zero_delta);
342 269
343 std::vector<int> expected_delta_x_after_drag(max_panels, zero_delta); 270 std::vector<int> expected_delta_x_after_drag(max_panels, zero_delta);
344 std::vector<int> expected_delta_x_after_finish(max_panels, zero_delta); 271 std::vector<int> expected_delta_x_after_finish(max_panels, zero_delta);
345 std::vector<gfx::Rect> current_bounds; 272 std::vector<gfx::Rect> current_bounds;
346 std::vector<gfx::Rect> initial_bounds; 273 std::vector<gfx::Rect> initial_bounds;
347 274
348 // Tests with a single panel. 275 // Tests with a single panel.
349 { 276 {
350 CreatePanel("PanelTest1", gfx::Rect(0, 0, 100, 100)); 277 CreatePanelWithBounds("PanelTest1", gfx::Rect(0, 0, 100, 100));
351 278
352 // Drag left. 279 // Drag left.
353 expected_delta_x_after_drag[0] = -big_delta; 280 expected_delta_x_after_drag[0] = -big_delta;
354 expected_delta_x_after_finish = zero_deltas; 281 expected_delta_x_after_finish = zero_deltas;
355 TestDragging(-big_delta, zero_delta, 0, expected_delta_x_after_drag, 282 TestDragging(-big_delta, zero_delta, 0, expected_delta_x_after_drag,
356 zero_deltas, GetAllPanelsBounds(), 283 zero_deltas, GetAllPanelsBounds(),
357 DRAG_ACTION_BEGIN | DRAG_ACTION_FINISH); 284 DRAG_ACTION_BEGIN | DRAG_ACTION_FINISH);
358 285
359 // Drag left and cancel. 286 // Drag left and cancel.
360 expected_delta_x_after_drag[0] = -big_delta; 287 expected_delta_x_after_drag[0] = -big_delta;
(...skipping 17 matching lines...) Expand all
378 TestDragging(0, -big_delta, 0, zero_deltas, zero_deltas, 305 TestDragging(0, -big_delta, 0, zero_deltas, zero_deltas,
379 GetAllPanelsBounds(), DRAG_ACTION_BEGIN | DRAG_ACTION_FINISH); 306 GetAllPanelsBounds(), DRAG_ACTION_BEGIN | DRAG_ACTION_FINISH);
380 307
381 // Drag down. Expect no movement on drag. 308 // Drag down. Expect no movement on drag.
382 TestDragging(0, big_delta, 0, zero_deltas, zero_deltas, 309 TestDragging(0, big_delta, 0, zero_deltas, zero_deltas,
383 GetAllPanelsBounds(), DRAG_ACTION_BEGIN | DRAG_ACTION_FINISH); 310 GetAllPanelsBounds(), DRAG_ACTION_BEGIN | DRAG_ACTION_FINISH);
384 } 311 }
385 312
386 // Tests with two panels. 313 // Tests with two panels.
387 { 314 {
388 CreatePanel("PanelTest2", gfx::Rect(0, 0, 120, 120)); 315 CreatePanelWithBounds("PanelTest2", gfx::Rect(0, 0, 120, 120));
389 316
390 // Drag left, small delta, expect no shuffle. 317 // Drag left, small delta, expect no shuffle.
391 { 318 {
392 expected_delta_x_after_drag = zero_deltas; 319 expected_delta_x_after_drag = zero_deltas;
393 expected_delta_x_after_drag[0] = -small_delta; 320 expected_delta_x_after_drag[0] = -small_delta;
394 TestDragging(-small_delta, zero_delta, 0, expected_delta_x_after_drag, 321 TestDragging(-small_delta, zero_delta, 0, expected_delta_x_after_drag,
395 zero_deltas, GetAllPanelsBounds(), 322 zero_deltas, GetAllPanelsBounds(),
396 DRAG_ACTION_BEGIN | DRAG_ACTION_FINISH); 323 DRAG_ACTION_BEGIN | DRAG_ACTION_FINISH);
397 324
398 // Drag right panel i.e index 0, towards left, big delta, expect shuffle. 325 // Drag right panel i.e index 0, towards left, big delta, expect shuffle.
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 // As the drag is being canceled, we don't need expected_delta_x_after 378 // As the drag is being canceled, we don't need expected_delta_x_after
452 // finish. Instead initial_bounds will be used. 379 // finish. Instead initial_bounds will be used.
453 TestDragging(big_delta, zero_delta, 1, expected_delta_x_after_drag, 380 TestDragging(big_delta, zero_delta, 1, expected_delta_x_after_drag,
454 zero_deltas, initial_bounds, 381 zero_deltas, initial_bounds,
455 DRAG_ACTION_BEGIN | DRAG_ACTION_CANCEL); 382 DRAG_ACTION_BEGIN | DRAG_ACTION_CANCEL);
456 } 383 }
457 } 384 }
458 385
459 // Tests with three panels. 386 // Tests with three panels.
460 { 387 {
461 CreatePanel("PanelTest3", gfx::Rect(0, 0, 110, 110)); 388 CreatePanelWithBounds("PanelTest3", gfx::Rect(0, 0, 110, 110));
462 389
463 // Drag leftmost panel to become rightmost with two shuffles. 390 // Drag leftmost panel to become rightmost with two shuffles.
464 // We test both shuffles. 391 // We test both shuffles.
465 { 392 {
466 // Drag the left-most panel towards right without ending or cancelling it. 393 // Drag the left-most panel towards right without ending or cancelling it.
467 // Expect shuffle. 394 // Expect shuffle.
468 initial_bounds = GetAllPanelsBounds(); 395 initial_bounds = GetAllPanelsBounds();
469 expected_delta_x_after_drag = zero_deltas; 396 expected_delta_x_after_drag = zero_deltas;
470 397
471 // Delta for panel being dragged. 398 // Delta for panel being dragged.
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
776 EXPECT_EQ(1, tabbed_browser->tab_count()); 703 EXPECT_EQ(1, tabbed_browser->tab_count());
777 ASSERT_TRUE(tabbed_browser->window()->IsDownloadShelfVisible()); 704 ASSERT_TRUE(tabbed_browser->window()->IsDownloadShelfVisible());
778 tabbed_browser->CloseWindow(); 705 tabbed_browser->CloseWindow();
779 #endif 706 #endif
780 707
781 EXPECT_EQ(1, panel_browser->tab_count()); 708 EXPECT_EQ(1, panel_browser->tab_count());
782 ASSERT_FALSE(panel_browser->window()->IsDownloadShelfVisible()); 709 ASSERT_FALSE(panel_browser->window()->IsDownloadShelfVisible());
783 710
784 panel_browser->CloseWindow(); 711 panel_browser->CloseWindow();
785 } 712 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/panels/panel_browser_view_browsertest.cc ('k') | chrome/browser/ui/panels/panel_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698