Commit 083ceb97 authored by Alexander Timin's avatar Alexander Timin Committed by Commit Bot

[scheduler] Deflake BackgroundRenderersAreThrottled test.

R=skyostil@chromium.org
BUG=874497

Change-Id: Ia5546b2600b2502e3a5fa00c6631810af377d0de
Reviewed-on: https://chromium-review.googlesource.com/1181027Reviewed-by: default avatarSami Kyöstilä <skyostil@chromium.org>
Commit-Queue: Alexander Timin <altimin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#584431}
parent 8663895c
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "third_party/blink/renderer/platform/testing/unit_test_helpers.h" #include "third_party/blink/renderer/platform/testing/unit_test_helpers.h"
using testing::ElementsAre; using testing::ElementsAre;
using testing::AnyOf;
namespace blink { namespace blink {
...@@ -59,8 +60,7 @@ TEST_F(DisableBackgroundThrottlingIsRespectedTest, ...@@ -59,8 +60,7 @@ TEST_F(DisableBackgroundThrottlingIsRespectedTest,
class BackgroundRendererThrottlingTest : public SimTest {}; class BackgroundRendererThrottlingTest : public SimTest {};
TEST_F(BackgroundRendererThrottlingTest, TEST_F(BackgroundRendererThrottlingTest, BackgroundRenderersAreThrottled) {
DISABLED_BackgroundRenderersAreThrottled) {
SimRequest main_resource("https://example.com/", "text/html"); SimRequest main_resource("https://example.com/", "text/html");
LoadURL("https://example.com/"); LoadURL("https://example.com/");
...@@ -72,7 +72,7 @@ TEST_F(BackgroundRendererThrottlingTest, ...@@ -72,7 +72,7 @@ TEST_F(BackgroundRendererThrottlingTest,
" console.log('called f');" " console.log('called f');"
" setTimeout(f, 10, repetitions - 1);" " setTimeout(f, 10, repetitions - 1);"
" }" " }"
" setTimeout(f, 10, 3);" " setTimeout(f, 10, 50);"
"</script>)"); "</script>)");
Platform::Current() Platform::Current()
...@@ -81,12 +81,12 @@ TEST_F(BackgroundRendererThrottlingTest, ...@@ -81,12 +81,12 @@ TEST_F(BackgroundRendererThrottlingTest,
->GetWebMainThreadSchedulerForTest() ->GetWebMainThreadSchedulerForTest()
->SetRendererBackgrounded(true); ->SetRendererBackgrounded(true);
// Make sure that we run a task once a second. // Make sure that we run no more than one task a second.
for (int i = 0; i < 3; ++i) { test::RunDelayedTasks(TimeDelta::FromMilliseconds(3000));
test::RunDelayedTasks(TimeDelta::FromSeconds(1)); EXPECT_THAT(
EXPECT_THAT(ConsoleMessages(), ElementsAre("called f")); ConsoleMessages(),
ConsoleMessages().clear(); AnyOf(ElementsAre("called f", "called f", "called f"),
} ElementsAre("called f", "called f", "called f", "called f")));
} }
} // namespace blink } // namespace blink
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment