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

Unified Diff: components/test_runner/test_runner.cc

Issue 1571833002: Add popup layout tests with device scale factor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 | « components/html_viewer/web_test_delegate_impl.cc ('k') | components/test_runner/web_test_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/test_runner/test_runner.cc
diff --git a/components/test_runner/test_runner.cc b/components/test_runner/test_runner.cc
index 7511601c8fa5b0263ba168b7f165e4ac856758a2..e4e5877397c06b2262916aa931f2e8f57bcd46aa 100644
--- a/components/test_runner/test_runner.cc
+++ b/components/test_runner/test_runner.cc
@@ -8,8 +8,10 @@
#include <limits>
#include <utility>
+#include "base/command_line.h"
#include "base/logging.h"
#include "base/macros.h"
+#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "build/build_config.h"
#include "components/test_runner/mock_credential_manager_client.h"
@@ -56,6 +58,7 @@
#include "ui/gfx/geometry/rect_f.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/skia_util.h"
+#include "ui/gfx/switches.h"
#if defined(__linux__) || defined(ANDROID)
#include "third_party/WebKit/public/web/linux/WebFontRendering.h"
@@ -74,6 +77,18 @@ WebString V8StringToWebString(v8::Local<v8::String> v8_str) {
return WebString::fromUTF8(chars.get());
}
+double GetDefaultDeviceScaleFactor() {
+ base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
+ if (command_line->HasSwitch(switches::kForceDeviceScaleFactor)) {
+ double scale;
+ std::string value =
+ command_line->GetSwitchValueASCII(switches::kForceDeviceScaleFactor);
+ if (base::StringToDouble(value, &scale))
+ return scale;
+ }
+ return 1.f;
+}
+
class HostMethodTask : public WebMethodTask<TestRunner> {
public:
typedef void (TestRunner::*CallbackMethodType)();
@@ -1701,7 +1716,7 @@ void TestRunner::Reset() {
// Reset the default quota for each origin to 5MB
delegate_->SetDatabaseQuota(5 * 1024 * 1024);
delegate_->SetDeviceColorProfile("reset");
- delegate_->SetDeviceScaleFactor(1);
+ delegate_->SetDeviceScaleFactor(GetDefaultDeviceScaleFactor());
delegate_->SetAcceptAllCookies(false);
delegate_->SetLocale("");
delegate_->UseUnfortunateSynchronousResizeMode(false);
« no previous file with comments | « components/html_viewer/web_test_delegate_impl.cc ('k') | components/test_runner/web_test_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698