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

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

Issue 9015022: Replace most of Browser::GetSelectedTabContents calls into Browser::GetSelectedWebContents. I've ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 8 years, 11 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) 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/utf_string_conversions.h" 6 #include "base/utf_string_conversions.h"
7 #include "chrome/browser/browser_process.h" 7 #include "chrome/browser/browser_process.h"
8 #include "chrome/browser/download/download_service.h" 8 #include "chrome/browser/download/download_service.h"
9 #include "chrome/browser/download/download_service_factory.h" 9 #include "chrome/browser/download/download_service_factory.h"
10 #include "chrome/browser/net/url_request_mock_util.h" 10 #include "chrome/browser/net/url_request_mock_util.h"
(...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after
808 FilePath(FILE_PATH_LITERAL("update-preferred-size.html")))); 808 FilePath(FILE_PATH_LITERAL("update-preferred-size.html"))));
809 params.url = url; 809 params.url = url;
810 Panel* panel = CreatePanelWithParams(params); 810 Panel* panel = CreatePanelWithParams(params);
811 811
812 // Expand the test page. 812 // Expand the test page.
813 gfx::Rect initial_bounds = panel->GetBounds(); 813 gfx::Rect initial_bounds = panel->GetBounds();
814 ui_test_utils::WindowedNotificationObserver enlarge( 814 ui_test_utils::WindowedNotificationObserver enlarge(
815 chrome::NOTIFICATION_PANEL_BOUNDS_ANIMATIONS_FINISHED, 815 chrome::NOTIFICATION_PANEL_BOUNDS_ANIMATIONS_FINISHED,
816 content::Source<Panel>(panel)); 816 content::Source<Panel>(panel));
817 EXPECT_TRUE(ui_test_utils::ExecuteJavaScript( 817 EXPECT_TRUE(ui_test_utils::ExecuteJavaScript(
818 panel->browser()->GetSelectedTabContents()->GetRenderViewHost(), 818 panel->browser()->GetSelectedWebContents()->GetRenderViewHost(),
819 std::wstring(), 819 std::wstring(),
820 L"changeSize(50);")); 820 L"changeSize(50);"));
821 enlarge.Wait(); 821 enlarge.Wait();
822 gfx::Rect bounds_on_grow = panel->GetBounds(); 822 gfx::Rect bounds_on_grow = panel->GetBounds();
823 EXPECT_GT(bounds_on_grow.width(), initial_bounds.width()); 823 EXPECT_GT(bounds_on_grow.width(), initial_bounds.width());
824 EXPECT_EQ(bounds_on_grow.height(), initial_bounds.height()); 824 EXPECT_EQ(bounds_on_grow.height(), initial_bounds.height());
825 825
826 // Shrink the test page. 826 // Shrink the test page.
827 ui_test_utils::WindowedNotificationObserver shrink( 827 ui_test_utils::WindowedNotificationObserver shrink(
828 chrome::NOTIFICATION_PANEL_BOUNDS_ANIMATIONS_FINISHED, 828 chrome::NOTIFICATION_PANEL_BOUNDS_ANIMATIONS_FINISHED,
829 content::Source<Panel>(panel)); 829 content::Source<Panel>(panel));
830 EXPECT_TRUE(ui_test_utils::ExecuteJavaScript( 830 EXPECT_TRUE(ui_test_utils::ExecuteJavaScript(
831 panel->browser()->GetSelectedTabContents()->GetRenderViewHost(), 831 panel->browser()->GetSelectedWebContents()->GetRenderViewHost(),
832 std::wstring(), 832 std::wstring(),
833 L"changeSize(-30);")); 833 L"changeSize(-30);"));
834 shrink.Wait(); 834 shrink.Wait();
835 gfx::Rect bounds_on_shrink = panel->GetBounds(); 835 gfx::Rect bounds_on_shrink = panel->GetBounds();
836 EXPECT_LT(bounds_on_shrink.width(), bounds_on_grow.width()); 836 EXPECT_LT(bounds_on_shrink.width(), bounds_on_grow.width());
837 EXPECT_GT(bounds_on_shrink.width(), initial_bounds.width()); 837 EXPECT_GT(bounds_on_shrink.width(), initial_bounds.width());
838 EXPECT_EQ(bounds_on_shrink.height(), initial_bounds.height()); 838 EXPECT_EQ(bounds_on_shrink.height(), initial_bounds.height());
839 839
840 panel->Close(); 840 panel->Close();
841 } 841 }
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after
1470 EXPECT_EQ(1, PanelManager::GetInstance()->num_panels()); 1470 EXPECT_EQ(1, PanelManager::GetInstance()->num_panels());
1471 1471
1472 // Ensure that the tab contents were noticed by the panel by 1472 // Ensure that the tab contents were noticed by the panel by
1473 // verifying that the panel auto resizes correctly. (Panel 1473 // verifying that the panel auto resizes correctly. (Panel
1474 // enables auto resizing when tab contents are detected.) 1474 // enables auto resizing when tab contents are detected.)
1475 int initial_width = panel->GetBounds().width(); 1475 int initial_width = panel->GetBounds().width();
1476 ui_test_utils::WindowedNotificationObserver enlarge( 1476 ui_test_utils::WindowedNotificationObserver enlarge(
1477 chrome::NOTIFICATION_PANEL_BOUNDS_ANIMATIONS_FINISHED, 1477 chrome::NOTIFICATION_PANEL_BOUNDS_ANIMATIONS_FINISHED,
1478 content::Source<Panel>(panel)); 1478 content::Source<Panel>(panel));
1479 EXPECT_TRUE(ui_test_utils::ExecuteJavaScript( 1479 EXPECT_TRUE(ui_test_utils::ExecuteJavaScript(
1480 panel_browser->GetSelectedTabContents()->GetRenderViewHost(), 1480 panel_browser->GetSelectedWebContents()->GetRenderViewHost(),
1481 std::wstring(), 1481 std::wstring(),
1482 L"changeSize(50);")); 1482 L"changeSize(50);"));
1483 enlarge.Wait(); 1483 enlarge.Wait();
1484 EXPECT_GT(panel->GetBounds().width(), initial_width); 1484 EXPECT_GT(panel->GetBounds().width(), initial_width);
1485 1485
1486 // Swapping tab contents back to the browser should close the panel. 1486 // Swapping tab contents back to the browser should close the panel.
1487 ui_test_utils::WindowedNotificationObserver signal( 1487 ui_test_utils::WindowedNotificationObserver signal(
1488 chrome::NOTIFICATION_BROWSER_CLOSED, 1488 chrome::NOTIFICATION_BROWSER_CLOSED,
1489 content::Source<Browser>(panel_browser)); 1489 content::Source<Browser>(panel_browser));
1490 panel_browser->ConvertPopupToTabbedBrowser(); 1490 panel_browser->ConvertPopupToTabbedBrowser();
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1536 Panel* panel = CreatePanelWithParams(params); 1536 Panel* panel = CreatePanelWithParams(params);
1537 1537
1538 int initial_width = panel->GetBounds().width(); 1538 int initial_width = panel->GetBounds().width();
1539 int initial_height = panel->GetBounds().height(); 1539 int initial_height = panel->GetBounds().height();
1540 1540
1541 // Inject some HTML content into the panel. 1541 // Inject some HTML content into the panel.
1542 ui_test_utils::WindowedNotificationObserver enlarge( 1542 ui_test_utils::WindowedNotificationObserver enlarge(
1543 chrome::NOTIFICATION_PANEL_BOUNDS_ANIMATIONS_FINISHED, 1543 chrome::NOTIFICATION_PANEL_BOUNDS_ANIMATIONS_FINISHED,
1544 content::Source<Panel>(panel)); 1544 content::Source<Panel>(panel));
1545 EXPECT_TRUE(ui_test_utils::ExecuteJavaScript( 1545 EXPECT_TRUE(ui_test_utils::ExecuteJavaScript(
1546 panel->browser()->GetSelectedTabContents()->GetRenderViewHost(), 1546 panel->browser()->GetSelectedWebContents()->GetRenderViewHost(),
1547 std::wstring(), 1547 std::wstring(),
1548 L"document.body.innerHTML =" 1548 L"document.body.innerHTML ="
1549 L"'<nobr>line of text and a <button>Button</button>';")); 1549 L"'<nobr>line of text and a <button>Button</button>';"));
1550 enlarge.Wait(); 1550 enlarge.Wait();
1551 1551
1552 // The panel should have become larger in both dimensions (the minimums 1552 // The panel should have become larger in both dimensions (the minimums
1553 // has to be set to be smaller then a simple 1-line content, so the autosize 1553 // has to be set to be smaller then a simple 1-line content, so the autosize
1554 // can work correctly. 1554 // can work correctly.
1555 EXPECT_GT(panel->GetBounds().width(), initial_width); 1555 EXPECT_GT(panel->GetBounds().width(), initial_width);
1556 EXPECT_GT(panel->GetBounds().height(), initial_height); 1556 EXPECT_GT(panel->GetBounds().height(), initial_height);
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
1887 // position when tall panel brings up its titlebar. 1887 // position when tall panel brings up its titlebar.
1888 CloseWindowAndWait(panel1->browser()); 1888 CloseWindowAndWait(panel1->browser());
1889 EXPECT_EQ(balloon_bottom_after_tall_panel_titlebar_up, 1889 EXPECT_EQ(balloon_bottom_after_tall_panel_titlebar_up,
1890 GetBalloonBottomPosition(balloon)); 1890 GetBalloonBottomPosition(balloon));
1891 1891
1892 // Closing the remaining tall panel should move the notification balloon back 1892 // Closing the remaining tall panel should move the notification balloon back
1893 // to its original position. 1893 // to its original position.
1894 CloseWindowAndWait(panel2->browser()); 1894 CloseWindowAndWait(panel2->browser());
1895 EXPECT_EQ(original_balloon_bottom, GetBalloonBottomPosition(balloon)); 1895 EXPECT_EQ(original_balloon_bottom, GetBalloonBottomPosition(balloon));
1896 } 1896 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/panels/panel_browser_frame_view.cc ('k') | chrome/browser/ui/pdf/pdf_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698