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

Unified Diff: content/browser/site_per_process_browsertest.cc

Issue 2300463002: Add observers for DIP scale change. (Closed)
Patch Set: Update the fix Created 4 years, 2 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
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 5d97b9dac3cc0f19b87f9e05a5c03e1d5c7505e1..9e5e6b65455afaf2949715ee13ce2eb3536f94e7 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