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

Unified Diff: content/browser/site_per_process_browsertest.cc

Issue 2122023002: Cross-process frames should be notified of device scale factor changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Version of patch without second test. Created 4 years, 4 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 31d3eb2b16bbf54d7d5268e919f6cc5ae5f30524..cfbfbdeadbf98fc9e1b8e65878bb4581904c2ce7 100644
--- a/content/browser/site_per_process_browsertest.cc
+++ b/content/browser/site_per_process_browsertest.cc
@@ -61,6 +61,7 @@
#include "third_party/WebKit/public/web/WebInputEvent.h"
#include "third_party/WebKit/public/web/WebSandboxFlags.h"
#include "ui/display/display_switches.h"
+#include "ui/display/screen.h"
#include "ui/events/event.h"
#include "ui/events/event_utils.h"
#include "ui/gfx/geometry/point.h"
@@ -589,13 +590,16 @@ void SitePerProcessBrowserTest::SetUpOnMainThread() {
class SitePerProcessHighDPIBrowserTest : public SitePerProcessBrowserTest {
public:
+ const double kDeviceScaleFactor = 2.0;
+
SitePerProcessHighDPIBrowserTest() {}
protected:
void SetUpCommandLine(base::CommandLine* command_line) override {
SitePerProcessBrowserTest::SetUpCommandLine(command_line);
- command_line->AppendSwitchASCII(switches::kForceDeviceScaleFactor,
- base::StringPrintf("2"));
+ command_line->AppendSwitchASCII(
+ switches::kForceDeviceScaleFactor,
+ base::StringPrintf("%f", kDeviceScaleFactor));
}
};
@@ -613,6 +617,30 @@ class SitePerProcessIgnoreCertErrorsBrowserTest
}
};
+double GetFrameDeviceScaleFactor(const ToRenderFrameHost& adapter) {
+ double device_scale_factor;
+ const char kGetFrameDeviceScaleFactor[] =
+ "window.domAutomationController.send(window.devicePixelRatio);";
+ EXPECT_TRUE(ExecuteScriptAndExtractDouble(adapter, kGetFrameDeviceScaleFactor,
+ &device_scale_factor));
+ return device_scale_factor;
+}
+
+IN_PROC_BROWSER_TEST_F(SitePerProcessHighDPIBrowserTest,
+ SubframeLoadsWithCorrectDeviceScaleFactor) {
+ GURL main_url(embedded_test_server()->GetURL(
+ "a.com", "/cross_site_iframe_factory.html?a(b)"));
+ NavigateToURL(shell(), main_url);
+
+ EXPECT_EQ(SitePerProcessHighDPIBrowserTest::kDeviceScaleFactor,
+ GetFrameDeviceScaleFactor(web_contents()));
+
+ FrameTreeNode* root = web_contents()->GetFrameTree()->root();
+ FrameTreeNode* child = root->child_at(0);
+ EXPECT_EQ(SitePerProcessHighDPIBrowserTest::kDeviceScaleFactor,
+ GetFrameDeviceScaleFactor(child));
+}
+
// Ensure that navigating subframes in --site-per-process mode works and the
// correct documents are committed.
#if defined(OS_WIN)
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_mus.cc ('k') | content/browser/web_contents/web_contents_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698