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

Unified Diff: chrome/browser/ui/zoom/zoom_controller_browsertest.cc

Issue 917043004: Mark error pages as such on Ctrl-Shift-T reload. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments. Created 5 years, 10 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 | content/browser/frame_host/navigation_controller_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..a16336c125e40764868b95e18c7e609680992261 100644
--- a/chrome/browser/ui/zoom/zoom_controller_browsertest.cc
+++ b/chrome/browser/ui/zoom/zoom_controller_browsertest.cc
@@ -8,6 +8,7 @@
#include "base/process/kill.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"
@@ -168,6 +169,57 @@ IN_PROC_BROWSER_TEST_F(ZoomControllerBrowserTest, ErrorPagesCanZoom) {
EXPECT_FLOAT_EQ(new_zoom_level, zoom_controller->GetZoomLevel());
}
+IN_PROC_BROWSER_TEST_F(ZoomControllerBrowserTest,
+ ErrorPagesCanZoomAfterTabRestore) {
+ // This url is meant to cause a network error page to be loaded.
+ // Tests can't reach the network, so this test should continue
+ // to work even if the domain listed is someday registered.
+ GURL url("http://kjfhkjsdf.com");
+
+ 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::WebContentsAddedObserver new_web_contents_observer;
+ chrome::RestoreTab(browser());
+ content::WebContents* web_contents =
+ new_web_contents_observer.GetWebContents();
+ content::WaitForLoadStop(web_contents);
+
+ EXPECT_EQ(2, tab_strip->count());
+
+ 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();
« no previous file with comments | « no previous file | content/browser/frame_host/navigation_controller_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698