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

Unified Diff: chrome/browser/ui/panels/base_panel_browser_test.cc

Issue 8872044: Add test cases for panel overflow handling. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Final patch to land Created 9 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/panels/base_panel_browser_test.h ('k') | chrome/browser/ui/panels/panel_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/panels/base_panel_browser_test.cc
diff --git a/chrome/browser/ui/panels/base_panel_browser_test.cc b/chrome/browser/ui/panels/base_panel_browser_test.cc
index 0b662197c32f424d26f0aa27f6536b456ce779d2..8f3b6fb7691fc109329cff508f173977fdb7d7de 100644
--- a/chrome/browser/ui/panels/base_panel_browser_test.cc
+++ b/chrome/browser/ui/panels/base_panel_browser_test.cc
@@ -11,11 +11,13 @@
#include "base/memory/weak_ptr.h"
#include "base/message_loop.h"
#include "base/path_service.h"
+#include "base/string_number_conversions.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/panels/native_panel.h"
#include "chrome/browser/ui/panels/panel_manager.h"
+#include "chrome/browser/ui/panels/panel_mouse_watcher.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
@@ -152,7 +154,7 @@ void MockAutoHidingDesktopBarImpl::NotifyThicknessChange() {
}
bool ExistsPanel(Panel* panel) {
- const PanelManager::Panels& panels = PanelManager::GetInstance()->panels();
+ std::vector<Panel*> panels = PanelManager::GetInstance()->panels();
return find(panels.begin(), panels.end(), panel) != panels.end();
}
@@ -325,18 +327,21 @@ Panel* BasePanelBrowserTest::CreatePanelWithParams(
panel->ShowInactive();
#endif
}
- MessageLoopForUI::current()->RunAllPending();
- // More waiting, because gaining or losing focus may require inter-process
- // asynchronous communication, and it is not enough to just run the local
- // message loop to make sure this activity has completed.
- WaitForPanelActiveState(panel, params.show_flag);
- // On Linux, window size is not available right away and we should wait
- // before moving forward with the test.
- WaitForWindowSizeAvailable(panel);
+ if (params.wait_for_fully_created) {
+ MessageLoopForUI::current()->RunAllPending();
+ // More waiting, because gaining or losing focus may require inter-process
+ // asynchronous communication, and it is not enough to just run the local
+ // message loop to make sure this activity has completed.
+ WaitForPanelActiveState(panel, params.show_flag);
- // Wait for the bounds animations on creation to finish.
- WaitForBoundsAnimationFinished(panel);
+ // On Linux, window size is not available right away and we should wait
+ // before moving forward with the test.
+ WaitForWindowSizeAvailable(panel);
+
+ // Wait for the bounds animations on creation to finish.
+ WaitForBoundsAnimationFinished(panel);
+ }
return panel;
}
@@ -383,3 +388,25 @@ scoped_refptr<Extension> BasePanelBrowserTest::CreateExtension(
OnExtensionInstalled(extension.get(), false, StringOrdinal());
return extension;
}
+
+void BasePanelBrowserTest::CloseWindowAndWait(Browser* browser) {
+ // Closing a browser window may involve several async tasks. Need to use
+ // message pump and wait for the notification.
+ size_t browser_count = BrowserList::size();
+ ui_test_utils::WindowedNotificationObserver signal(
+ chrome::NOTIFICATION_BROWSER_CLOSED,
+ content::Source<Browser>(browser));
+ browser->CloseWindow();
+ signal.Wait();
+ // Now we have one less browser instance.
+ EXPECT_EQ(browser_count - 1, BrowserList::size());
+}
+
+void BasePanelBrowserTest::MoveMouse(const gfx::Point& position) {
+ PanelManager::GetInstance()->mouse_watcher()->NotifyMouseMovement(position);
+}
+
+std::string BasePanelBrowserTest::MakePanelName(int index) {
+ std::string panel_name("Panel");
+ return panel_name + base::IntToString(index);
+}
« no previous file with comments | « chrome/browser/ui/panels/base_panel_browser_test.h ('k') | chrome/browser/ui/panels/panel_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698