summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/core/testing/sim/sim_test.cc
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2018-08-28 15:28:34 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2018-08-28 13:54:51 +0000
commit2a19c63448c84c1805fb1a585c3651318bb86ca7 (patch)
treeeb17888e8531aa6ee5e85721bd553b832a7e5156 /chromium/third_party/blink/renderer/core/testing/sim/sim_test.cc
parentb014812705fc80bff0a5c120dfcef88f349816dc (diff)
downloadqtwebengine-chromium-2a19c63448c84c1805fb1a585c3651318bb86ca7.tar.gz
BASELINE: Update Chromium to 69.0.3497.70
Change-Id: I2b7b56e4e7a8b26656930def0d4575dc32b900a0 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/third_party/blink/renderer/core/testing/sim/sim_test.cc')
-rw-r--r--chromium/third_party/blink/renderer/core/testing/sim/sim_test.cc24
1 files changed, 22 insertions, 2 deletions
diff --git a/chromium/third_party/blink/renderer/core/testing/sim/sim_test.cc b/chromium/third_party/blink/renderer/core/testing/sim/sim_test.cc
index c80387d53cd..b816ca7ff90 100644
--- a/chromium/third_party/blink/renderer/core/testing/sim/sim_test.cc
+++ b/chromium/third_party/blink/renderer/core/testing/sim/sim_test.cc
@@ -4,7 +4,9 @@
#include "third_party/blink/renderer/core/testing/sim/sim_test.h"
+#include "content/test/test_blink_web_unit_test_support.h"
#include "third_party/blink/public/platform/web_cache.h"
+#include "third_party/blink/public/web/web_navigation_timings.h"
#include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/core/exported/web_view_impl.h"
#include "third_party/blink/renderer/core/frame/local_dom_window.h"
@@ -15,7 +17,9 @@
namespace blink {
-SimTest::SimTest() : web_view_client_(compositor_), web_frame_client_(*this) {
+SimTest::SimTest()
+ : web_view_client_(compositor_.layer_tree_view()),
+ web_frame_client_(*this) {
Document::SetThreadedParsingEnabledForTesting(false);
// Use the mock theme to get more predictable code paths, this also avoids
// the OS callbacks in ScrollAnimatorMac which can schedule frames
@@ -25,6 +29,13 @@ SimTest::SimTest() : web_view_client_(compositor_), web_frame_client_(*this) {
// in the middle of a test.
LayoutTestSupport::SetMockThemeEnabledForTest(true);
ScrollbarTheme::SetMockScrollbarsEnabled(true);
+ // Threaded animations are usually enabled for blink. However these tests use
+ // synchronous compositing, which can not run threaded animations.
+ bool was_threaded_animation_enabled =
+ content::TestBlinkWebUnitTestSupport::SetThreadedAnimationEnabled(false);
+ // If this fails, we'd be resetting IsThreadedAnimationEnabled() to the wrong
+ // thing in the destructor.
+ DCHECK(was_threaded_animation_enabled);
}
SimTest::~SimTest() {
@@ -34,6 +45,7 @@ SimTest::~SimTest() {
Document::SetThreadedParsingEnabledForTesting(true);
LayoutTestSupport::SetMockThemeEnabledForTest(false);
ScrollbarTheme::SetMockScrollbarsEnabled(false);
+ content::TestBlinkWebUnitTestSupport::SetThreadedAnimationEnabled(true);
WebCache::Clear();
}
@@ -47,7 +59,9 @@ void SimTest::SetUp() {
void SimTest::LoadURL(const String& url) {
WebURLRequest request{KURL(url)};
- WebView().MainFrameImpl()->LoadRequest(request);
+ WebView().MainFrameImpl()->CommitNavigation(
+ request, WebFrameLoadType::kStandard, WebHistoryItem(), false,
+ base::UnguessableToken::Create(), nullptr, WebNavigationTimings());
}
LocalDOMWindow& SimTest::Window() {
@@ -78,6 +92,12 @@ SimCompositor& SimTest::Compositor() {
return compositor_;
}
+void SimTest::SetEffectiveConnectionTypeForTesting(
+ WebEffectiveConnectionType effective_connection_type) {
+ web_frame_client_.SetEffectiveConnectionTypeForTesting(
+ effective_connection_type);
+}
+
void SimTest::AddConsoleMessage(const String& message) {
console_messages_.push_back(message);
}