| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/test_runner/test_runner.h" | 5 #include "components/test_runner/test_runner.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| 11 #include "base/command_line.h" |
| 11 #include "base/logging.h" | 12 #include "base/logging.h" |
| 12 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/strings/string_number_conversions.h" |
| 13 #include "base/strings/stringprintf.h" | 15 #include "base/strings/stringprintf.h" |
| 14 #include "build/build_config.h" | 16 #include "build/build_config.h" |
| 15 #include "components/test_runner/mock_credential_manager_client.h" | 17 #include "components/test_runner/mock_credential_manager_client.h" |
| 16 #include "components/test_runner/mock_web_speech_recognizer.h" | 18 #include "components/test_runner/mock_web_speech_recognizer.h" |
| 17 #include "components/test_runner/test_interfaces.h" | 19 #include "components/test_runner/test_interfaces.h" |
| 18 #include "components/test_runner/test_preferences.h" | 20 #include "components/test_runner/test_preferences.h" |
| 19 #include "components/test_runner/web_content_settings.h" | 21 #include "components/test_runner/web_content_settings.h" |
| 20 #include "components/test_runner/web_test_delegate.h" | 22 #include "components/test_runner/web_test_delegate.h" |
| 21 #include "components/test_runner/web_test_proxy.h" | 23 #include "components/test_runner/web_test_proxy.h" |
| 22 #include "gin/arguments.h" | 24 #include "gin/arguments.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 49 #include "third_party/WebKit/public/web/WebSerializedScriptValue.h" | 51 #include "third_party/WebKit/public/web/WebSerializedScriptValue.h" |
| 50 #include "third_party/WebKit/public/web/WebSettings.h" | 52 #include "third_party/WebKit/public/web/WebSettings.h" |
| 51 #include "third_party/WebKit/public/web/WebSurroundingText.h" | 53 #include "third_party/WebKit/public/web/WebSurroundingText.h" |
| 52 #include "third_party/WebKit/public/web/WebView.h" | 54 #include "third_party/WebKit/public/web/WebView.h" |
| 53 #include "third_party/skia/include/core/SkBitmap.h" | 55 #include "third_party/skia/include/core/SkBitmap.h" |
| 54 #include "third_party/skia/include/core/SkCanvas.h" | 56 #include "third_party/skia/include/core/SkCanvas.h" |
| 55 #include "ui/gfx/geometry/rect.h" | 57 #include "ui/gfx/geometry/rect.h" |
| 56 #include "ui/gfx/geometry/rect_f.h" | 58 #include "ui/gfx/geometry/rect_f.h" |
| 57 #include "ui/gfx/geometry/size.h" | 59 #include "ui/gfx/geometry/size.h" |
| 58 #include "ui/gfx/skia_util.h" | 60 #include "ui/gfx/skia_util.h" |
| 61 #include "ui/gfx/switches.h" |
| 59 | 62 |
| 60 #if defined(__linux__) || defined(ANDROID) | 63 #if defined(__linux__) || defined(ANDROID) |
| 61 #include "third_party/WebKit/public/web/linux/WebFontRendering.h" | 64 #include "third_party/WebKit/public/web/linux/WebFontRendering.h" |
| 62 #endif | 65 #endif |
| 63 | 66 |
| 64 using namespace blink; | 67 using namespace blink; |
| 65 | 68 |
| 66 namespace test_runner { | 69 namespace test_runner { |
| 67 | 70 |
| 68 namespace { | 71 namespace { |
| (...skipping 1625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1694 | 1697 |
| 1695 WebSecurityPolicy::resetOriginAccessWhitelists(); | 1698 WebSecurityPolicy::resetOriginAccessWhitelists(); |
| 1696 #if defined(__linux__) || defined(ANDROID) | 1699 #if defined(__linux__) || defined(ANDROID) |
| 1697 WebFontRendering::setSubpixelPositioning(false); | 1700 WebFontRendering::setSubpixelPositioning(false); |
| 1698 #endif | 1701 #endif |
| 1699 | 1702 |
| 1700 if (delegate_) { | 1703 if (delegate_) { |
| 1701 // Reset the default quota for each origin to 5MB | 1704 // Reset the default quota for each origin to 5MB |
| 1702 delegate_->SetDatabaseQuota(5 * 1024 * 1024); | 1705 delegate_->SetDatabaseQuota(5 * 1024 * 1024); |
| 1703 delegate_->SetDeviceColorProfile("reset"); | 1706 delegate_->SetDeviceColorProfile("reset"); |
| 1704 delegate_->SetDeviceScaleFactor(1); | 1707 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 1708 double scale = 1; |
| 1709 if (command_line->HasSwitch(switches::kForceDeviceScaleFactor)) { |
| 1710 std::string value = |
| 1711 command_line->GetSwitchValueASCII(switches::kForceDeviceScaleFactor); |
| 1712 if (!base::StringToDouble(value, &scale)) |
| 1713 scale = 1; |
| 1714 } |
| 1715 delegate_->SetDeviceScaleFactor(scale); |
| 1705 delegate_->SetAcceptAllCookies(false); | 1716 delegate_->SetAcceptAllCookies(false); |
| 1706 delegate_->SetLocale(""); | 1717 delegate_->SetLocale(""); |
| 1707 delegate_->UseUnfortunateSynchronousResizeMode(false); | 1718 delegate_->UseUnfortunateSynchronousResizeMode(false); |
| 1708 delegate_->DisableAutoResizeMode(WebSize()); | 1719 delegate_->DisableAutoResizeMode(WebSize()); |
| 1709 delegate_->DeleteAllCookies(); | 1720 delegate_->DeleteAllCookies(); |
| 1710 delegate_->ResetScreenOrientation(); | 1721 delegate_->ResetScreenOrientation(); |
| 1711 delegate_->SetBluetoothMockDataSet(""); | 1722 delegate_->SetBluetoothMockDataSet(""); |
| 1712 delegate_->ClearGeofencingMockProvider(); | 1723 delegate_->ClearGeofencingMockProvider(); |
| 1713 delegate_->ResetPermissions(); | 1724 delegate_->ResetPermissions(); |
| 1714 ResetBatteryStatus(); | 1725 ResetBatteryStatus(); |
| (...skipping 1464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3179 } | 3190 } |
| 3180 | 3191 |
| 3181 void TestRunner::DidLosePointerLockInternal() { | 3192 void TestRunner::DidLosePointerLockInternal() { |
| 3182 bool was_locked = pointer_locked_; | 3193 bool was_locked = pointer_locked_; |
| 3183 pointer_locked_ = false; | 3194 pointer_locked_ = false; |
| 3184 if (was_locked) | 3195 if (was_locked) |
| 3185 web_view_->didLosePointerLock(); | 3196 web_view_->didLosePointerLock(); |
| 3186 } | 3197 } |
| 3187 | 3198 |
| 3188 } // namespace test_runner | 3199 } // namespace test_runner |
| OLD | NEW |