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

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

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

Powered by Google App Engine
This is Rietveld 408576698