| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/files/file_path.h" | 6 #include "base/files/file_path.h" |
| 7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 | 85 |
| 86 private: | 86 private: |
| 87 base::RunLoop close_loop_; | 87 base::RunLoop close_loop_; |
| 88 | 88 |
| 89 DISALLOW_COPY_AND_ASSIGN(CloseObserver); | 89 DISALLOW_COPY_AND_ASSIGN(CloseObserver); |
| 90 }; | 90 }; |
| 91 | 91 |
| 92 class PopupBlockerBrowserTest : public InProcessBrowserTest { | 92 class PopupBlockerBrowserTest : public InProcessBrowserTest { |
| 93 public: | 93 public: |
| 94 PopupBlockerBrowserTest() {} | 94 PopupBlockerBrowserTest() {} |
| 95 virtual ~PopupBlockerBrowserTest() {} | 95 ~PopupBlockerBrowserTest() override {} |
| 96 | 96 |
| 97 void SetUpOnMainThread() override { | 97 void SetUpOnMainThread() override { |
| 98 InProcessBrowserTest::SetUpOnMainThread(); | 98 InProcessBrowserTest::SetUpOnMainThread(); |
| 99 | 99 |
| 100 host_resolver()->AddRule("*", "127.0.0.1"); | 100 host_resolver()->AddRule("*", "127.0.0.1"); |
| 101 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 101 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
| 102 } | 102 } |
| 103 | 103 |
| 104 int GetBlockedContentsCount() { | 104 int GetBlockedContentsCount() { |
| 105 // Do a round trip to the renderer first to flush any in-flight IPCs to | 105 // Do a round trip to the renderer first to flush any in-flight IPCs to |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 479 | 479 |
| 480 // Verify that the renderer can't DOS the browser by creating arbitrarily many | 480 // Verify that the renderer can't DOS the browser by creating arbitrarily many |
| 481 // popups. | 481 // popups. |
| 482 IN_PROC_BROWSER_TEST_F(PopupBlockerBrowserTest, DenialOfService) { | 482 IN_PROC_BROWSER_TEST_F(PopupBlockerBrowserTest, DenialOfService) { |
| 483 GURL url(embedded_test_server()->GetURL("/popup_blocker/popup-dos.html")); | 483 GURL url(embedded_test_server()->GetURL("/popup_blocker/popup-dos.html")); |
| 484 ui_test_utils::NavigateToURL(browser(), url); | 484 ui_test_utils::NavigateToURL(browser(), url); |
| 485 ASSERT_EQ(25, GetBlockedContentsCount()); | 485 ASSERT_EQ(25, GetBlockedContentsCount()); |
| 486 } | 486 } |
| 487 | 487 |
| 488 } // namespace | 488 } // namespace |
| OLD | NEW |