Chromium Code Reviews| 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()); |