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

Unified Diff: content/browser/renderer_host/input/non_blocking_event_browsertest.cc

Issue 1781133002: Change page size for NonBlockingEventBrowserTest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Refactored page height into a constant Created 4 years, 9 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/input/non_blocking_event_browsertest.cc
diff --git a/content/browser/renderer_host/input/non_blocking_event_browsertest.cc b/content/browser/renderer_host/input/non_blocking_event_browsertest.cc
index c68191409f965bfd46e1451acd38b6f2173ef165..eb424983f3f126e70cab5516b726975b76a28481 100644
--- a/content/browser/renderer_host/input/non_blocking_event_browsertest.cc
+++ b/content/browser/renderer_host/input/non_blocking_event_browsertest.cc
@@ -33,24 +33,29 @@ using blink::WebInputEvent;
namespace {
-const char kNonBlockingEventDataURL[] =
- "data:text/html;charset=utf-8,"
- "<!DOCTYPE html>"
- "<meta name='viewport' content='width=device-width'/>"
- "<style>"
- "html, body {"
- " margin: 0;"
- "}"
- ".spacer { height: 1000px; }"
- "</style>"
- "<div class=spacer></div>"
- "<script>"
- " document.addEventListener('wheel', function(e) { while(true) {} }, "
- "{'passive': true});"
- " document.addEventListener('touchstart', function(e) { while(true) {} }, "
- "{'passive': true});"
- " document.title='ready';"
- "</script>";
+// This value has to be larger than the height of the device this test is
+// executed on, otherwise the device will be unable to scroll thus failing
+// tests.
+const int kWebsiteHeight = 10000;
+
+const std::string kNonBlockingEventDataURL =
+ R"(data:text/html;charset=utf-8,
tdresser 2016/03/11 17:01:24 Sadly C++11 raw string literals aren't allowed in
+ <!DOCTYPE html>
+ <meta name='viewport' content='width=device-width'/>
+ <style>
+ html, body {
+ margin: 0;
+ }
+ .spacer { height: )" + std::to_string(kWebsiteHeight) + R"(px; }
+ </style>
+ <div class=spacer></div>
+ <script>
+ document.addEventListener('wheel', function(e) { while(true) {} },
+ {'passive': true});
+ document.addEventListener('touchstart', function(e) { while(true) {} },
+ {'passive': true});
+ document.title='ready';
+ </script>)";
} // namespace
@@ -72,7 +77,7 @@ class NonBlockingEventBrowserTest : public ContentBrowserTest {
protected:
void LoadURL() {
- const GURL data_url(kNonBlockingEventDataURL);
+ const GURL data_url(kNonBlockingEventDataURL.c_str());
NavigateToURL(shell(), data_url);
RenderWidgetHostImpl* host = GetWidgetHost();
@@ -110,7 +115,7 @@ class NonBlockingEventBrowserTest : public ContentBrowserTest {
int scrollHeight =
ExecuteScriptAndExtractInt("document.documentElement.scrollHeight");
- EXPECT_EQ(1000, scrollHeight);
+ EXPECT_EQ(kWebsiteHeight, scrollHeight);
scoped_refptr<FrameWatcher> frame_watcher(new FrameWatcher());
GetWidgetHost()->GetProcess()->AddFilter(frame_watcher.get());
@@ -135,7 +140,7 @@ class NonBlockingEventBrowserTest : public ContentBrowserTest {
int scrollHeight =
ExecuteScriptAndExtractInt("document.documentElement.scrollHeight");
- EXPECT_EQ(1000, scrollHeight);
+ EXPECT_EQ(kWebsiteHeight, scrollHeight);
scoped_refptr<FrameWatcher> frame_watcher(new FrameWatcher());
GetWidgetHost()->GetProcess()->AddFilter(frame_watcher.get());
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698