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

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

Issue 10694145: Remove browser::FindTabbedBrowser from old_panel_browsertest.cc by deleting the tests now that use … (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/panels/old_panel_browsertest.cc
===================================================================
--- chrome/browser/ui/panels/old_panel_browsertest.cc (revision 146182)
+++ chrome/browser/ui/panels/old_panel_browsertest.cc (working copy)
@@ -12,8 +12,8 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog.h"
#include "chrome/browser/ui/app_modal_dialogs/native_app_modal_dialog.h"
+#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_commands.h"
-#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_tabstrip.h"
#include "chrome/browser/ui/browser_window.h"
@@ -1410,61 +1410,6 @@
EXPECT_EQ(0, panel_manager->num_panels());
}
-// http://crbug.com/126381 - should find a better notification to wait
-// for resize completion. Bounds animation could happen for all sorts of
-// reasons.
-IN_PROC_BROWSER_TEST_F(OldPanelBrowserTest,
- DISABLED_CreateWithExistingContents) {
- PanelManager::GetInstance()->enable_auto_sizing(true);
-
- // Load contents into regular tabbed browser.
- GURL url(ui_test_utils::GetTestUrl(
- FilePath(kTestDir),
- FilePath(FILE_PATH_LITERAL("update-preferred-size.html"))));
- ui_test_utils::NavigateToURL(browser(), url);
- EXPECT_EQ(1, browser()->tab_count());
-
- Profile* profile = browser()->profile();
- CreatePanelParams params("PanelTest1", gfx::Rect(), SHOW_AS_ACTIVE);
- Panel* panel = CreatePanelWithParams(params);
- Browser* panel_browser = panel->browser();
- EXPECT_EQ(2U, BrowserList::size());
-
- // Swap tab contents over to the panel from the tabbed browser.
- TabContents* contents = browser()->tab_strip_model()->DetachTabContentsAt(0);
- panel_browser->tab_strip_model()->InsertTabContentsAt(
- 0, contents, TabStripModel::ADD_NONE);
- chrome::SelectNumberedTab(panel_browser, 0);
- EXPECT_EQ(contents, chrome::GetActiveTabContents(panel_browser));
- EXPECT_EQ(1, PanelManager::GetInstance()->num_panels());
-
- // Ensure that the tab contents were noticed by the panel by
- // verifying that the panel auto resizes correctly. (Panel
- // enables auto resizing when tab contents are detected.)
- int initial_width = panel->GetBounds().width();
- ui_test_utils::WindowedNotificationObserver enlarge(
- chrome::NOTIFICATION_PANEL_BOUNDS_ANIMATIONS_FINISHED,
- content::Source<Panel>(panel));
- EXPECT_TRUE(ui_test_utils::ExecuteJavaScript(
- chrome::GetActiveWebContents(panel_browser)->GetRenderViewHost(),
- std::wstring(),
- L"changeSize(50);"));
- enlarge.Wait();
- EXPECT_GT(panel->GetBounds().width(), initial_width);
-
- // Swapping tab contents back to the browser should close the panel.
- ui_test_utils::WindowedNotificationObserver signal(
- chrome::NOTIFICATION_PANEL_CLOSED,
- content::Source<Panel>(panel));
- chrome::ConvertPopupToTabbedBrowser(panel_browser);
- signal.Wait();
- EXPECT_EQ(0, PanelManager::GetInstance()->num_panels());
-
- Browser* tabbed_browser = browser::FindTabbedBrowser(profile, false);
- EXPECT_EQ(contents, chrome::GetActiveTabContents(tabbed_browser));
- tabbed_browser->window()->Close();
-}
-
IN_PROC_BROWSER_TEST_F(OldPanelBrowserTest, SizeClamping) {
// Using '0' sizes is equivalent of not providing sizes in API and causes
// minimum sizes to be applied to facilitate auto-sizing.
@@ -1587,175 +1532,3 @@
panel->Close();
}
-
-class OldPanelDownloadTest : public OldPanelBrowserTest {
- public:
- OldPanelDownloadTest() : OldPanelBrowserTest() { }
-
- // Creates a temporary directory for downloads that is auto-deleted
- // on destruction.
- bool CreateDownloadDirectory(Profile* profile) {
- bool created = downloads_directory_.CreateUniqueTempDir();
- if (!created)
- return false;
- profile->GetPrefs()->SetFilePath(
- prefs::kDownloadDefaultDirectory,
- downloads_directory_.path());
- return true;
- }
-
- protected:
- void SetUpOnMainThread() OVERRIDE {
- OldPanelBrowserTest::SetUpOnMainThread();
-
- BrowserThread::PostTask(
- BrowserThread::IO, FROM_HERE,
- base::Bind(&chrome_browser_net::SetUrlRequestMocksEnabled, true));
- }
-
- private:
- // Location of the downloads directory for download tests.
- ScopedTempDir downloads_directory_;
-};
-
-class DownloadObserver : public content::DownloadManager::Observer {
- public:
- explicit DownloadObserver(Profile* profile)
- : download_manager_(
- BrowserContext::GetDownloadManager(profile)),
- saw_download_(false),
- waiting_(false) {
- download_manager_->AddObserver(this);
- }
-
- ~DownloadObserver() {
- download_manager_->RemoveObserver(this);
- }
-
- void WaitForDownload() {
- if (!saw_download_) {
- waiting_ = true;
- ui_test_utils::RunMessageLoop();
- EXPECT_TRUE(saw_download_);
- waiting_ = false;
- }
- }
-
- // DownloadManager::Observer
- virtual void ModelChanged(DownloadManager* manager) {
- DCHECK_EQ(download_manager_, manager);
-
- std::vector<DownloadItem*> downloads;
- download_manager_->SearchDownloads(string16(), &downloads);
- if (downloads.empty())
- return;
-
- EXPECT_EQ(1U, downloads.size());
- downloads.front()->Cancel(false); // Don't actually need to download it.
-
- saw_download_ = true;
- EXPECT_TRUE(waiting_);
- MessageLoopForUI::current()->Quit();
- }
-
- private:
- DownloadManager* download_manager_;
- bool saw_download_;
- bool waiting_;
-};
-
-// Verify that the download shelf is opened in the existing tabbed browser
-// when a download is started in a Panel.
-IN_PROC_BROWSER_TEST_F(OldPanelDownloadTest, Download) {
- Profile* profile = browser()->profile();
- ASSERT_TRUE(CreateDownloadDirectory(profile));
- Browser* panel_browser = Browser::CreateWithParams(
- Browser::CreateParams::CreateForApp(
- Browser::TYPE_PANEL, "PanelTest", gfx::Rect(), profile));
- EXPECT_EQ(2U, BrowserList::size());
- ASSERT_FALSE(browser()->window()->IsDownloadShelfVisible());
- ASSERT_FALSE(panel_browser->window()->IsDownloadShelfVisible());
-
- scoped_ptr<DownloadObserver> observer(new DownloadObserver(profile));
- FilePath file(FILE_PATH_LITERAL("download-test1.lib"));
- GURL download_url(URLRequestMockHTTPJob::GetMockUrl(file));
- ui_test_utils::NavigateToURLWithDisposition(
- panel_browser,
- download_url,
- CURRENT_TAB,
- ui_test_utils::BROWSER_TEST_NONE);
- observer->WaitForDownload();
-
-#if defined(OS_CHROMEOS)
- // ChromeOS uses a download panel instead of a download shelf.
- EXPECT_EQ(3U, BrowserList::size());
- ASSERT_FALSE(browser()->window()->IsDownloadShelfVisible());
-
- std::set<Browser*> original_browsers;
- original_browsers.insert(browser());
- original_browsers.insert(panel_browser);
- Browser* added = ui_test_utils::GetBrowserNotInSet(original_browsers);
- ASSERT_TRUE(added->is_type_panel());
- ASSERT_FALSE(added->window()->IsDownloadShelfVisible());
-#else
- EXPECT_EQ(2U, BrowserList::size());
- ASSERT_TRUE(browser()->window()->IsDownloadShelfVisible());
-#endif
-
- EXPECT_EQ(1, browser()->tab_count());
- EXPECT_EQ(1, panel_browser->tab_count());
- ASSERT_FALSE(panel_browser->window()->IsDownloadShelfVisible());
-
- chrome::CloseWindow(panel_browser);
- chrome::CloseWindow(browser());
-}
-
-// See crbug 113779.
-#if defined(OS_MACOSX)
-#define MAYBE_DownloadNoTabbedBrowser DISABLED_DownloadNoTabbedBrowser
-#else
-#define MAYBE_DownloadNoTabbedBrowser DownloadNoTabbedBrowser
-#endif
-// Verify that a new tabbed browser is created to display a download
-// shelf when a download is started in a Panel and there is no existing
-// tabbed browser.
-IN_PROC_BROWSER_TEST_F(OldPanelDownloadTest, MAYBE_DownloadNoTabbedBrowser) {
- Profile* profile = browser()->profile();
- ASSERT_TRUE(CreateDownloadDirectory(profile));
- Browser* panel_browser = Browser::CreateWithParams(
- Browser::CreateParams::CreateForApp(
- Browser::TYPE_PANEL, "PanelTest", gfx::Rect(), profile));
- EXPECT_EQ(2U, BrowserList::size());
- ASSERT_FALSE(browser()->window()->IsDownloadShelfVisible());
- ASSERT_FALSE(panel_browser->window()->IsDownloadShelfVisible());
-
- ui_test_utils::WindowedNotificationObserver signal(
- chrome::NOTIFICATION_BROWSER_CLOSED,
- content::Source<Browser>(browser()));
- chrome::CloseWindow(browser());
- signal.Wait();
- ASSERT_EQ(1U, BrowserList::size());
- ASSERT_EQ(NULL, browser::FindTabbedBrowser(profile, false));
-
- scoped_ptr<DownloadObserver> observer(new DownloadObserver(profile));
- FilePath file(FILE_PATH_LITERAL("download-test1.lib"));
- GURL download_url(URLRequestMockHTTPJob::GetMockUrl(file));
- ui_test_utils::NavigateToURLWithDisposition(
- panel_browser,
- download_url,
- CURRENT_TAB,
- ui_test_utils::BROWSER_TEST_NONE);
- observer->WaitForDownload();
-
- EXPECT_EQ(2U, BrowserList::size());
-
- Browser* tabbed_browser = browser::FindTabbedBrowser(profile, false);
- EXPECT_EQ(1, tabbed_browser->tab_count());
- ASSERT_TRUE(tabbed_browser->window()->IsDownloadShelfVisible());
- chrome::CloseWindow(tabbed_browser);
-
- EXPECT_EQ(1, panel_browser->tab_count());
- ASSERT_FALSE(panel_browser->window()->IsDownloadShelfVisible());
-
- chrome::CloseWindow(panel_browser);
-}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698