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

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

Issue 8341098: Mac: Added a delay before panels go to minimized state from title-only state. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cr feedback Created 9 years, 1 month 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/bind.h" 5 #include "base/bind.h"
6 #include "base/string_number_conversions.h" 6 #include "base/string_number_conversions.h"
7 #include "chrome/browser/download/download_service.h" 7 #include "chrome/browser/download/download_service.h"
8 #include "chrome/browser/download/download_service_factory.h" 8 #include "chrome/browser/download/download_service_factory.h"
9 #include "chrome/browser/net/url_request_mock_util.h" 9 #include "chrome/browser/net/url_request_mock_util.h"
10 #include "chrome/browser/prefs/pref_service.h" 10 #include "chrome/browser/prefs/pref_service.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 signal.Wait(); 45 signal.Wait();
46 // Now we have one less browser instance. 46 // Now we have one less browser instance.
47 EXPECT_EQ(browser_count - 1, BrowserList::size()); 47 EXPECT_EQ(browser_count - 1, BrowserList::size());
48 } 48 }
49 49
50 void MoveMouse(gfx::Point position) { 50 void MoveMouse(gfx::Point position) {
51 PanelManager::GetInstance()->OnMouseMove(position); 51 PanelManager::GetInstance()->OnMouseMove(position);
52 MessageLoopForUI::current()->RunAllPending(); 52 MessageLoopForUI::current()->RunAllPending();
53 } 53 }
54 54
55 void MoveMouseAndWiatForExpansionStateChange(Panel* panel,
jianli 2011/10/28 21:31:33 Wiat => Wait
Dmitry Titov 2011/10/29 00:04:56 Done.
56 gfx::Point position) {
jianli 2011/10/28 21:31:33 const gfx::Point&
57 ui_test_utils::WindowedNotificationObserver signal(
58 chrome::NOTIFICATION_PANEL_CHANGED_EXPANSION_STATE,
59 content::Source<Panel>(panel));
60 MoveMouse(position);
61 signal.Wait();
62 }
63
55 void TestCreatePanelOnOverflow() { 64 void TestCreatePanelOnOverflow() {
56 PanelManager* panel_manager = PanelManager::GetInstance(); 65 PanelManager* panel_manager = PanelManager::GetInstance();
57 EXPECT_EQ(0, panel_manager->num_panels()); // No panels initially. 66 EXPECT_EQ(0, panel_manager->num_panels()); // No panels initially.
58 67
59 // Create testing extensions. 68 // Create testing extensions.
60 DictionaryValue empty_value; 69 DictionaryValue empty_value;
61 scoped_refptr<Extension> extension1 = 70 scoped_refptr<Extension> extension1 =
62 CreateExtension(FILE_PATH_LITERAL("extension1"), 71 CreateExtension(FILE_PATH_LITERAL("extension1"),
63 Extension::INVALID, empty_value); 72 Extension::INVALID, empty_value);
64 scoped_refptr<Extension> extension2 = 73 scoped_refptr<Extension> extension2 =
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 test_begin_bounds[index].height() - 400 test_begin_bounds[index].height() -
392 panels[index]->native_panel()->TitleOnlyHeight()); 401 panels[index]->native_panel()->TitleOnlyHeight());
393 } 402 }
394 403
395 // Test hover. All panels are currently in minimized state. 404 // Test hover. All panels are currently in minimized state.
396 EXPECT_EQ(minimized_states, GetAllPanelExpansionStates()); 405 EXPECT_EQ(minimized_states, GetAllPanelExpansionStates());
397 for (size_t index = 0; index < panels.size(); ++index) { 406 for (size_t index = 0; index < panels.size(); ++index) {
398 // Hover mouse on minimized panel. 407 // Hover mouse on minimized panel.
399 // Verify titlebar is exposed on all panels. 408 // Verify titlebar is exposed on all panels.
400 gfx::Point hover_point(panels[index]->GetBounds().origin()); 409 gfx::Point hover_point(panels[index]->GetBounds().origin());
401 MoveMouse(hover_point); 410 MoveMouseAndWiatForExpansionStateChange(panels[index], hover_point);
402 EXPECT_EQ(titlebar_exposed_bounds, GetAllPanelBounds()); 411 EXPECT_EQ(titlebar_exposed_bounds, GetAllPanelBounds());
403 EXPECT_EQ(titlebar_exposed_states, GetAllPanelExpansionStates()); 412 EXPECT_EQ(titlebar_exposed_states, GetAllPanelExpansionStates());
404 413
405 // Hover mouse above the panel. Verify all panels are minimized. 414 // Hover mouse above the panel. Verify all panels are minimized.
406 hover_point.set_y( 415 hover_point.set_y(
407 panels[index]->GetBounds().y() - kFarEnoughFromHoverArea); 416 panels[index]->GetBounds().y() - kFarEnoughFromHoverArea);
408 MoveMouse(hover_point); 417 MoveMouseAndWiatForExpansionStateChange(panels[index], hover_point);
409 EXPECT_EQ(minimized_bounds, GetAllPanelBounds()); 418 EXPECT_EQ(minimized_bounds, GetAllPanelBounds());
410 EXPECT_EQ(minimized_states, GetAllPanelExpansionStates()); 419 EXPECT_EQ(minimized_states, GetAllPanelExpansionStates());
411 420
412 // Hover mouse below minimized panel. 421 // Hover mouse below minimized panel.
413 // Verify titlebar is exposed on all panels. 422 // Verify titlebar is exposed on all panels.
414 hover_point.set_y(panels[index]->GetBounds().y() + 423 hover_point.set_y(panels[index]->GetBounds().y() +
415 panels[index]->GetBounds().height() + 5); 424 panels[index]->GetBounds().height() + 5);
416 MoveMouse(hover_point); 425 MoveMouseAndWiatForExpansionStateChange(panels[index], hover_point);
417 EXPECT_EQ(titlebar_exposed_bounds, GetAllPanelBounds()); 426 EXPECT_EQ(titlebar_exposed_bounds, GetAllPanelBounds());
418 EXPECT_EQ(titlebar_exposed_states, GetAllPanelExpansionStates()); 427 EXPECT_EQ(titlebar_exposed_states, GetAllPanelExpansionStates());
419 428
420 // Hover below titlebar exposed panel. Verify nothing changed. 429 // Hover below titlebar exposed panel. Verify nothing changed.
421 hover_point.set_y(panels[index]->GetBounds().y() + 430 hover_point.set_y(panels[index]->GetBounds().y() +
422 panels[index]->GetBounds().height() + 6); 431 panels[index]->GetBounds().height() + 6);
423 MoveMouse(hover_point); 432 MoveMouse(hover_point);
424 EXPECT_EQ(titlebar_exposed_bounds, GetAllPanelBounds()); 433 EXPECT_EQ(titlebar_exposed_bounds, GetAllPanelBounds());
425 EXPECT_EQ(titlebar_exposed_states, GetAllPanelExpansionStates()); 434 EXPECT_EQ(titlebar_exposed_states, GetAllPanelExpansionStates());
426 435
427 // Hover mouse above panel. Verify all panels are minimized. 436 // Hover mouse above panel. Verify all panels are minimized.
428 hover_point.set_y( 437 hover_point.set_y(
429 panels[index]->GetBounds().y() - kFarEnoughFromHoverArea); 438 panels[index]->GetBounds().y() - kFarEnoughFromHoverArea);
430 MoveMouse(hover_point); 439 MoveMouseAndWiatForExpansionStateChange(panels[index], hover_point);
431 EXPECT_EQ(minimized_bounds, GetAllPanelBounds()); 440 EXPECT_EQ(minimized_bounds, GetAllPanelBounds());
432 EXPECT_EQ(minimized_states, GetAllPanelExpansionStates()); 441 EXPECT_EQ(minimized_states, GetAllPanelExpansionStates());
433 } 442 }
434 443
435 // Test restore. All panels are currently in minimized state. 444 // Test restore. All panels are currently in minimized state.
436 for (size_t index = 0; index < panels.size(); ++index) { 445 for (size_t index = 0; index < panels.size(); ++index) {
437 // Hover on the last panel. This is to test the case of clicking on the 446 // Hover on the last panel. This is to test the case of clicking on the
438 // panel when it's in titlebar exposed state. 447 // panel when it's in titlebar exposed state.
439 if (index == panels.size() - 1) 448 if (index == panels.size() - 1)
440 MoveMouse(minimized_bounds[index].origin()); 449 MoveMouse(minimized_bounds[index].origin());
(...skipping 1039 matching lines...) Expand 10 before | Expand all | Expand 10 after
1480 EXPECT_EQ(1, tabbed_browser->tab_count()); 1489 EXPECT_EQ(1, tabbed_browser->tab_count());
1481 ASSERT_TRUE(tabbed_browser->window()->IsDownloadShelfVisible()); 1490 ASSERT_TRUE(tabbed_browser->window()->IsDownloadShelfVisible());
1482 tabbed_browser->CloseWindow(); 1491 tabbed_browser->CloseWindow();
1483 #endif 1492 #endif
1484 1493
1485 EXPECT_EQ(1, panel_browser->tab_count()); 1494 EXPECT_EQ(1, panel_browser->tab_count());
1486 ASSERT_FALSE(panel_browser->window()->IsDownloadShelfVisible()); 1495 ASSERT_FALSE(panel_browser->window()->IsDownloadShelfVisible());
1487 1496
1488 panel_browser->CloseWindow(); 1497 panel_browser->CloseWindow();
1489 } 1498 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698