Index: chrome/browser/ui/zoom/zoom_controller_browsertest.cc |
diff --git a/chrome/browser/ui/zoom/zoom_controller_browsertest.cc b/chrome/browser/ui/zoom/zoom_controller_browsertest.cc |
index 378739ded0521611e497585fce043baaab1f2a21..45a70e25e540b3144dce53d22788a8660e361bc3 100644 |
--- a/chrome/browser/ui/zoom/zoom_controller_browsertest.cc |
+++ b/chrome/browser/ui/zoom/zoom_controller_browsertest.cc |
@@ -6,8 +6,10 @@ |
#include "base/prefs/pref_service.h" |
#include "base/process/kill.h" |
+#include "chrome/browser/chrome_notification_types.h" |
#include "chrome/browser/profiles/profile.h" |
#include "chrome/browser/ui/browser.h" |
+#include "chrome/browser/ui/browser_commands.h" |
#include "chrome/browser/ui/tabs/tab_strip_model.h" |
#include "chrome/browser/ui/webui/signin/login_ui_test_utils.h" |
#include "chrome/browser/ui/zoom/chrome_zoom_level_prefs.h" |
@@ -17,6 +19,8 @@ |
#include "components/signin/core/common/profile_management_switches.h" |
#include "content/public/browser/host_zoom_map.h" |
#include "content/public/browser/navigation_entry.h" |
+#include "content/public/browser/notification_service.h" |
+#include "content/public/browser/notification_types.h" |
#include "content/public/browser/render_process_host.h" |
#include "content/public/browser/render_view_host.h" |
#include "content/public/browser/web_contents.h" |
@@ -168,6 +172,61 @@ IN_PROC_BROWSER_TEST_F(ZoomControllerBrowserTest, ErrorPagesCanZoom) { |
EXPECT_FLOAT_EQ(new_zoom_level, zoom_controller->GetZoomLevel()); |
} |
+IN_PROC_BROWSER_TEST_F(ZoomControllerBrowserTest, |
+ ErrorPagesCanZoomAfterTabRestore) { |
+ GURL url("http://kjfhkjsdf.com"); |
Charlie Reis
2015/02/13 21:38:37
Let's add a comment saying this is meant to cause
wjmaclean
2015/02/17 20:39:14
Done.
|
+ |
+ TabStripModel* tab_strip = browser()->tab_strip_model(); |
+ ASSERT_TRUE(tab_strip); |
+ |
+ ui_test_utils::NavigateToURLWithDisposition( |
+ browser(), url, NEW_FOREGROUND_TAB, |
+ ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
+ { |
+ content::WebContents* web_contents = tab_strip->GetActiveWebContents(); |
+ |
+ EXPECT_EQ( |
+ content::PAGE_TYPE_ERROR, |
+ web_contents->GetController().GetLastCommittedEntry()->GetPageType()); |
+ |
+ content::WebContentsDestroyedWatcher destroyed_watcher(web_contents); |
+ tab_strip->CloseWebContentsAt(tab_strip->active_index(), |
+ TabStripModel::CLOSE_CREATE_HISTORICAL_TAB); |
+ destroyed_watcher.Wait(); |
+ } |
+ EXPECT_EQ(1, tab_strip->count()); |
+ |
+ content::WindowedNotificationObserver tab_added_observer( |
Charlie Reis
2015/02/13 21:38:36
Can we use content::WebContentsAddedObserver plus
wjmaclean
2015/02/17 20:39:14
Done.
|
+ chrome::NOTIFICATION_TAB_PARENTED, |
+ content::NotificationService::AllSources()); |
+ content::WindowedNotificationObserver tab_loaded_observer( |
+ content::NOTIFICATION_LOAD_STOP, |
+ content::NotificationService::AllSources()); |
+ |
+ chrome::RestoreTab(browser()); |
+ |
+ tab_added_observer.Wait(); |
+ tab_loaded_observer.Wait(); |
+ EXPECT_EQ(2, tab_strip->count()); |
+ |
+ content::WebContents* web_contents = tab_strip->GetActiveWebContents(); |
+ |
+ EXPECT_EQ( |
+ content::PAGE_TYPE_ERROR, |
+ web_contents->GetController().GetLastCommittedEntry()->GetPageType()); |
+ |
+ ZoomController* zoom_controller = |
+ ZoomController::FromWebContents(web_contents); |
+ |
+ double old_zoom_level = zoom_controller->GetZoomLevel(); |
+ double new_zoom_level = old_zoom_level + 0.5; |
+ |
+ // The following attempt to change the zoom level for an error page should |
+ // fail. |
+ zoom_controller->SetZoomLevel(new_zoom_level); |
+ EXPECT_FLOAT_EQ(new_zoom_level, zoom_controller->GetZoomLevel()); |
+} |
+ |
IN_PROC_BROWSER_TEST_F(ZoomControllerBrowserTest, Observe) { |
content::WebContents* web_contents = |
browser()->tab_strip_model()->GetActiveWebContents(); |