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

Unified Diff: third_party/WebKit/Source/web/tests/ActiveConnectionThrottlingTest.cpp

Issue 2696483003: [scheduler] Plumb websocket information to scheduler (Closed)
Patch Set: Created 3 years, 10 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 | « third_party/WebKit/Source/web/BUILD.gn ('k') | third_party/WebKit/public/platform/WebViewScheduler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/web/tests/ActiveConnectionThrottlingTest.cpp
diff --git a/third_party/WebKit/Source/web/tests/ActiveConnectionThrottlingTest.cpp b/third_party/WebKit/Source/web/tests/ActiveConnectionThrottlingTest.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..96488cd940e44f2ceb373d9120dada9512455a3e
--- /dev/null
+++ b/third_party/WebKit/Source/web/tests/ActiveConnectionThrottlingTest.cpp
@@ -0,0 +1,32 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code if governed by a BSD-style license that can be
+// found in LICENSE file.
+
+#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/WebKit/public/platform/WebViewScheduler.h"
+#include "web/WebViewImpl.h"
+#include "web/tests/sim/SimRequest.h"
+#include "web/tests/sim/SimTest.h"
+
+using testing::_;
+
+namespace blink {
+
+class ActiveConnectionThrottlingTest : public SimTest {};
+
+TEST_F(ActiveConnectionThrottlingTest, WebSocketStopsThrottling) {
+ SimRequest mainResource("https://example.com/", "text/html");
+
+ loadURL("https://example.com/");
+
+ EXPECT_FALSE(webView().scheduler()->hasActiveConnectionForTest());
+
+ mainResource.complete(
+ "(<script>"
+ " var socket = new WebSocket(\"ws://www.example.com/websocket\");"
+ "</script>)");
+
+ EXPECT_TRUE(webView().scheduler()->hasActiveConnectionForTest());
+}
+
+} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/web/BUILD.gn ('k') | third_party/WebKit/public/platform/WebViewScheduler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698