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

Unified Diff: content/browser/site_per_process_browsertest.cc

Issue 2300463002: Add observers for DIP scale change. (Closed)
Patch Set: Rebased to master Created 4 years, 1 month 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
Index: content/browser/site_per_process_browsertest.cc
diff --git a/content/browser/site_per_process_browsertest.cc b/content/browser/site_per_process_browsertest.cc
index 55a2ab9ccfdf381c510fc51fe2d1ba762dbe1398..e51fd5bfde6ce6cbb3403744a6774525bfc41a5b 100644
--- a/content/browser/site_per_process_browsertest.cc
+++ b/content/browser/site_per_process_browsertest.cc
@@ -626,13 +626,23 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessHighDPIBrowserTest,
"a.com", "/cross_site_iframe_factory.html?a(b)"));
NavigateToURL(shell(), main_url);
- EXPECT_EQ(SitePerProcessHighDPIBrowserTest::kDeviceScaleFactor,
- GetFrameDeviceScaleFactor(web_contents()));
+ // On Android forcing device scale factor does not work for tests, therefore
+ // we ensure that make frame and iframe have the same DIP scale there, but
+ // not necessarily kDeviceScaleFactor.
+ const double expected_dip_scale =
+#if defined(OS_ANDROID)
+ GetFrameDeviceScaleFactor(web_contents());
+#else
+ SitePerProcessHighDPIBrowserTest::kDeviceScaleFactor;
+#endif
+
+ EXPECT_EQ(expected_dip_scale, GetFrameDeviceScaleFactor(web_contents()));
FrameTreeNode* root = web_contents()->GetFrameTree()->root();
+ ASSERT_EQ(1U, root->child_count());
+
FrameTreeNode* child = root->child_at(0);
- EXPECT_EQ(SitePerProcessHighDPIBrowserTest::kDeviceScaleFactor,
- GetFrameDeviceScaleFactor(child));
+ EXPECT_EQ(expected_dip_scale, GetFrameDeviceScaleFactor(child));
}
// Ensure that navigating subframes in --site-per-process mode works and the

Powered by Google App Engine
This is Rietveld 408576698