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

Unified Diff: content/browser/site_per_process_browsertest.cc

Issue 2300463002: Add observers for DIP scale change. (Closed)
Patch Set: Attempt to fix unit test 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..119743f534870d7314b1a5f12956f4107b17040a 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
Tima Vaisburd 2016/10/25 01:51:43 Actually I'm not sure about this, maybe we need to
+ // 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)
+ SitePerProcessHighDPIBrowserTest::kDeviceScaleFactor;
+#else
+ GetFrameDeviceScaleFactor(web_contents());
+#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