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

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

Issue 10536094: TabContentsWrapper -> TabContents, part 44. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 6 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
« no previous file with comments | « chrome/browser/ui/panels/panel_browser_window.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/bind.h" 5 #include "base/bind.h"
6 #include "base/utf_string_conversions.h" 6 #include "base/utf_string_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/browser_prefs.h" 10 #include "chrome/browser/prefs/browser_prefs.h"
(...skipping 1389 matching lines...) Expand 10 before | Expand all | Expand 10 after
1400 ui_test_utils::NavigateToURL(browser(), url); 1400 ui_test_utils::NavigateToURL(browser(), url);
1401 EXPECT_EQ(1, browser()->tab_count()); 1401 EXPECT_EQ(1, browser()->tab_count());
1402 1402
1403 Profile* profile = browser()->profile(); 1403 Profile* profile = browser()->profile();
1404 CreatePanelParams params("PanelTest1", gfx::Rect(), SHOW_AS_ACTIVE); 1404 CreatePanelParams params("PanelTest1", gfx::Rect(), SHOW_AS_ACTIVE);
1405 Panel* panel = CreatePanelWithParams(params); 1405 Panel* panel = CreatePanelWithParams(params);
1406 Browser* panel_browser = panel->browser(); 1406 Browser* panel_browser = panel->browser();
1407 EXPECT_EQ(2U, BrowserList::size()); 1407 EXPECT_EQ(2U, BrowserList::size());
1408 1408
1409 // Swap tab contents over to the panel from the tabbed browser. 1409 // Swap tab contents over to the panel from the tabbed browser.
1410 TabContentsWrapper* contents = 1410 TabContents* contents = browser()->tab_strip_model()->DetachTabContentsAt(0);
1411 browser()->tab_strip_model()->DetachTabContentsAt(0);
1412 panel_browser->tab_strip_model()->InsertTabContentsAt( 1411 panel_browser->tab_strip_model()->InsertTabContentsAt(
1413 0, contents, TabStripModel::ADD_NONE); 1412 0, contents, TabStripModel::ADD_NONE);
1414 panel_browser->SelectNumberedTab(0); 1413 panel_browser->SelectNumberedTab(0);
1415 EXPECT_EQ(contents, panel_browser->GetSelectedTabContentsWrapper()); 1414 EXPECT_EQ(contents, panel_browser->GetActiveTabContents());
1416 EXPECT_EQ(1, PanelManager::GetInstance()->num_panels()); 1415 EXPECT_EQ(1, PanelManager::GetInstance()->num_panels());
1417 1416
1418 // Ensure that the tab contents were noticed by the panel by 1417 // Ensure that the tab contents were noticed by the panel by
1419 // verifying that the panel auto resizes correctly. (Panel 1418 // verifying that the panel auto resizes correctly. (Panel
1420 // enables auto resizing when tab contents are detected.) 1419 // enables auto resizing when tab contents are detected.)
1421 int initial_width = panel->GetBounds().width(); 1420 int initial_width = panel->GetBounds().width();
1422 ui_test_utils::WindowedNotificationObserver enlarge( 1421 ui_test_utils::WindowedNotificationObserver enlarge(
1423 chrome::NOTIFICATION_PANEL_BOUNDS_ANIMATIONS_FINISHED, 1422 chrome::NOTIFICATION_PANEL_BOUNDS_ANIMATIONS_FINISHED,
1424 content::Source<Panel>(panel)); 1423 content::Source<Panel>(panel));
1425 EXPECT_TRUE(ui_test_utils::ExecuteJavaScript( 1424 EXPECT_TRUE(ui_test_utils::ExecuteJavaScript(
1426 panel_browser->GetSelectedWebContents()->GetRenderViewHost(), 1425 panel_browser->GetActiveWebContents()->GetRenderViewHost(),
1427 std::wstring(), 1426 std::wstring(),
1428 L"changeSize(50);")); 1427 L"changeSize(50);"));
1429 enlarge.Wait(); 1428 enlarge.Wait();
1430 EXPECT_GT(panel->GetBounds().width(), initial_width); 1429 EXPECT_GT(panel->GetBounds().width(), initial_width);
1431 1430
1432 // Swapping tab contents back to the browser should close the panel. 1431 // Swapping tab contents back to the browser should close the panel.
1433 ui_test_utils::WindowedNotificationObserver signal( 1432 ui_test_utils::WindowedNotificationObserver signal(
1434 chrome::NOTIFICATION_PANEL_CLOSED, 1433 chrome::NOTIFICATION_PANEL_CLOSED,
1435 content::Source<Panel>(panel)); 1434 content::Source<Panel>(panel));
1436 panel_browser->ConvertPopupToTabbedBrowser(); 1435 panel_browser->ConvertPopupToTabbedBrowser();
1437 signal.Wait(); 1436 signal.Wait();
1438 EXPECT_EQ(0, PanelManager::GetInstance()->num_panels()); 1437 EXPECT_EQ(0, PanelManager::GetInstance()->num_panels());
1439 1438
1440 Browser* tabbed_browser = browser::FindTabbedBrowser(profile, false); 1439 Browser* tabbed_browser = browser::FindTabbedBrowser(profile, false);
1441 EXPECT_EQ(contents, tabbed_browser->GetSelectedTabContentsWrapper()); 1440 EXPECT_EQ(contents, tabbed_browser->GetActiveTabContents());
1442 tabbed_browser->window()->Close(); 1441 tabbed_browser->window()->Close();
1443 } 1442 }
1444 1443
1445 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, SizeClamping) { 1444 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, SizeClamping) {
1446 // Using '0' sizes is equivalent of not providing sizes in API and causes 1445 // Using '0' sizes is equivalent of not providing sizes in API and causes
1447 // minimum sizes to be applied to facilitate auto-sizing. 1446 // minimum sizes to be applied to facilitate auto-sizing.
1448 CreatePanelParams params("Panel", gfx::Rect(), SHOW_AS_ACTIVE); 1447 CreatePanelParams params("Panel", gfx::Rect(), SHOW_AS_ACTIVE);
1449 Panel* panel = CreatePanelWithParams(params); 1448 Panel* panel = CreatePanelWithParams(params);
1450 EXPECT_EQ(panel->min_size().width(), panel->GetBounds().width()); 1449 EXPECT_EQ(panel->min_size().width(), panel->GetBounds().width());
1451 EXPECT_EQ(panel->min_size().height(), panel->GetBounds().height()); 1450 EXPECT_EQ(panel->min_size().height(), panel->GetBounds().height());
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
1729 Browser* tabbed_browser = browser::FindTabbedBrowser(profile, false); 1728 Browser* tabbed_browser = browser::FindTabbedBrowser(profile, false);
1730 EXPECT_EQ(1, tabbed_browser->tab_count()); 1729 EXPECT_EQ(1, tabbed_browser->tab_count());
1731 ASSERT_TRUE(tabbed_browser->window()->IsDownloadShelfVisible()); 1730 ASSERT_TRUE(tabbed_browser->window()->IsDownloadShelfVisible());
1732 tabbed_browser->CloseWindow(); 1731 tabbed_browser->CloseWindow();
1733 1732
1734 EXPECT_EQ(1, panel_browser->tab_count()); 1733 EXPECT_EQ(1, panel_browser->tab_count());
1735 ASSERT_FALSE(panel_browser->window()->IsDownloadShelfVisible()); 1734 ASSERT_FALSE(panel_browser->window()->IsDownloadShelfVisible());
1736 1735
1737 panel_browser->CloseWindow(); 1736 panel_browser->CloseWindow();
1738 } 1737 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/panels/panel_browser_window.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698