| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/macros.h" | 6 #include "base/macros.h" |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 #include "content/public/test/browser_test_utils.h" | 31 #include "content/public/test/browser_test_utils.h" |
| 32 #include "extensions/browser/api/web_request/web_request_api.h" | 32 #include "extensions/browser/api/web_request/web_request_api.h" |
| 33 #include "extensions/browser/blocked_action_type.h" | 33 #include "extensions/browser/blocked_action_type.h" |
| 34 #include "extensions/browser/extension_system.h" | 34 #include "extensions/browser/extension_system.h" |
| 35 #include "extensions/common/extension_builder.h" | 35 #include "extensions/common/extension_builder.h" |
| 36 #include "extensions/common/features/feature.h" | 36 #include "extensions/common/features/feature.h" |
| 37 #include "extensions/test/extension_test_message_listener.h" | 37 #include "extensions/test/extension_test_message_listener.h" |
| 38 #include "extensions/test/result_catcher.h" | 38 #include "extensions/test/result_catcher.h" |
| 39 #include "net/dns/mock_host_resolver.h" | 39 #include "net/dns/mock_host_resolver.h" |
| 40 #include "net/test/embedded_test_server/embedded_test_server.h" | 40 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 41 #include "net/test/test_data_directory.h" |
| 41 #include "third_party/WebKit/public/web/WebInputEvent.h" | 42 #include "third_party/WebKit/public/web/WebInputEvent.h" |
| 42 | 43 |
| 43 using content::WebContents; | 44 using content::WebContents; |
| 44 | 45 |
| 45 namespace extensions { | 46 namespace extensions { |
| 46 | 47 |
| 47 namespace { | 48 namespace { |
| 48 | 49 |
| 49 class CancelLoginDialog : public content::NotificationObserver { | 50 class CancelLoginDialog : public content::NotificationObserver { |
| 50 public: | 51 public: |
| (...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 624 TabHelper::FromWebContents(web_contents)->active_tab_permission_granter(); | 625 TabHelper::FromWebContents(web_contents)->active_tab_permission_granter(); |
| 625 ASSERT_TRUE(granter); | 626 ASSERT_TRUE(granter); |
| 626 granter->RevokeForTesting(); | 627 granter->RevokeForTesting(); |
| 627 base::RunLoop().RunUntilIdle(); | 628 base::RunLoop().RunUntilIdle(); |
| 628 PerformXhrInFrame(main_frame, kHost, port, kXhrPath); | 629 PerformXhrInFrame(main_frame, kHost, port, kXhrPath); |
| 629 EXPECT_EQ(xhr_count, | 630 EXPECT_EQ(xhr_count, |
| 630 GetWebRequestCountFromBackgroundPage(extension, profile())); | 631 GetWebRequestCountFromBackgroundPage(extension, profile())); |
| 631 EXPECT_EQ(BLOCKED_ACTION_WEB_REQUEST, runner->GetBlockedActions(extension)); | 632 EXPECT_EQ(BLOCKED_ACTION_WEB_REQUEST, runner->GetBlockedActions(extension)); |
| 632 } | 633 } |
| 633 | 634 |
| 635 // Test that the webRequest events are dispatched for the WebSocket handshake |
| 636 // requests. |
| 637 IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest, WebSocketRequest) { |
| 638 ASSERT_TRUE(StartEmbeddedTestServer()); |
| 639 ASSERT_TRUE(StartWebSocketServer(net::GetWebSocketTestDataDirectory())); |
| 640 ASSERT_TRUE(RunExtensionSubtest("webrequest", "test_websocket.html")) |
| 641 << message_; |
| 642 } |
| 643 |
| 634 } // namespace extensions | 644 } // namespace extensions |
| OLD | NEW |