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 |