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

Unified Diff: chrome/browser/extensions/api/web_request/web_request_apitest.cc

Issue 2449913002: Support WebSocket in WebRequest API. (Closed)
Patch Set: git cl format 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
Index: chrome/browser/extensions/api/web_request/web_request_apitest.cc
diff --git a/chrome/browser/extensions/api/web_request/web_request_apitest.cc b/chrome/browser/extensions/api/web_request/web_request_apitest.cc
index b22bf14c7caeb9aed7bbc5cdb042f6e9401172f3..9c020f87a67d6669f26d4c4bb15a19034a955e8f 100644
--- a/chrome/browser/extensions/api/web_request/web_request_apitest.cc
+++ b/chrome/browser/extensions/api/web_request/web_request_apitest.cc
@@ -39,6 +39,7 @@
#include "extensions/test/result_catcher.h"
#include "net/dns/mock_host_resolver.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
+#include "net/test/test_data_directory.h"
#include "third_party/WebKit/public/platform/WebInputEvent.h"
using content::WebContents;
@@ -653,4 +654,23 @@ IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest,
EXPECT_EQ(BLOCKED_ACTION_WEB_REQUEST, runner->GetBlockedActions(extension));
}
+// Test that the webRequest events are dispatched for the WebSocket handshake
+// requests.
+IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest, WebSocketRequest) {
+ ASSERT_TRUE(StartEmbeddedTestServer());
+ ASSERT_TRUE(StartWebSocketServer(net::GetWebSocketTestDataDirectory()));
+ ASSERT_TRUE(RunExtensionSubtest("webrequest", "test_websocket.html"))
+ << message_;
+}
+
+// Test that the webRequest events are dispatched for the WebSocket handshake
+// requests when authenrication is requested by server.
+IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest,
+ WebSocketRequestAuthRequired) {
+ ASSERT_TRUE(StartEmbeddedTestServer());
+ ASSERT_TRUE(StartWebSocketServer(net::GetWebSocketTestDataDirectory(), true));
+ ASSERT_TRUE(RunExtensionSubtest("webrequest", "test_websocket_auth.html"))
+ << message_;
+}
+
} // namespace extensions
« no previous file with comments | « chrome/browser/extensions/api/web_request/web_request_api_unittest.cc ('k') | chrome/browser/extensions/extension_apitest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698