| 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 <utility> | 5 #include <utility> |
| 6 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 | 289 |
| 290 // http://crbug.com/22111 (linux), http://crbug.com/530246 (win) | 290 // http://crbug.com/22111 (linux), http://crbug.com/530246 (win) |
| 291 #if defined(OS_LINUX) || defined(OS_WIN) | 291 #if defined(OS_LINUX) || defined(OS_WIN) |
| 292 #define MAYBE_HistorySearchXSS DISABLED_HistorySearchXSS | 292 #define MAYBE_HistorySearchXSS DISABLED_HistorySearchXSS |
| 293 #else | 293 #else |
| 294 #define MAYBE_HistorySearchXSS HistorySearchXSS | 294 #define MAYBE_HistorySearchXSS HistorySearchXSS |
| 295 #endif | 295 #endif |
| 296 IN_PROC_BROWSER_TEST_F(HistoryBrowserTest, MAYBE_HistorySearchXSS) { | 296 IN_PROC_BROWSER_TEST_F(HistoryBrowserTest, MAYBE_HistorySearchXSS) { |
| 297 // TODO(tsergeant): Enable this test on MD History once it is possible to pass | 297 // TODO(tsergeant): Enable this test on MD History once it is possible to pass |
| 298 // in a query via URL (crbug.com/619799). | 298 // in a query via URL (crbug.com/619799). |
| 299 MdHistoryUI::DisableForTesting(); | 299 MdHistoryUI::SetEnabledForTesting(false); |
| 300 | 300 |
| 301 GURL url(std::string(chrome::kChromeUIHistoryURL) + | 301 GURL url(std::string(chrome::kChromeUIHistoryURL) + |
| 302 "#q=%3Cimg%20src%3Dx%3Ax%20onerror%3D%22document.title%3D'XSS'%22%3E"); | 302 "#q=%3Cimg%20src%3Dx%3Ax%20onerror%3D%22document.title%3D'XSS'%22%3E"); |
| 303 ui_test_utils::NavigateToURL(browser(), url); | 303 ui_test_utils::NavigateToURL(browser(), url); |
| 304 // Mainly, this is to ensure we send a synchronous message to the renderer | 304 // Mainly, this is to ensure we send a synchronous message to the renderer |
| 305 // so that we're not susceptible (less susceptible?) to a race condition. | 305 // so that we're not susceptible (less susceptible?) to a race condition. |
| 306 // Should a race condition ever trigger, it won't result in flakiness. | 306 // Should a race condition ever trigger, it won't result in flakiness. |
| 307 int num = ui_test_utils::FindInPage( | 307 int num = ui_test_utils::FindInPage( |
| 308 browser()->tab_strip_model()->GetActiveWebContents(), | 308 browser()->tab_strip_model()->GetActiveWebContents(), |
| 309 base::ASCIIToUTF16("<img"), true, | 309 base::ASCIIToUTF16("<img"), true, |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 | 541 |
| 542 content::WebContents* active_web_contents = | 542 content::WebContents* active_web_contents = |
| 543 browser()->tab_strip_model()->GetActiveWebContents(); | 543 browser()->tab_strip_model()->GetActiveWebContents(); |
| 544 ASSERT_EQ(web_contents, active_web_contents); | 544 ASSERT_EQ(web_contents, active_web_contents); |
| 545 ASSERT_EQ(history_url, active_web_contents->GetURL()); | 545 ASSERT_EQ(history_url, active_web_contents->GetURL()); |
| 546 | 546 |
| 547 content::WebContents* second_tab = | 547 content::WebContents* second_tab = |
| 548 browser()->tab_strip_model()->GetWebContentsAt(1); | 548 browser()->tab_strip_model()->GetWebContentsAt(1); |
| 549 ASSERT_NE(history_url, second_tab->GetURL()); | 549 ASSERT_NE(history_url, second_tab->GetURL()); |
| 550 } | 550 } |
| OLD | NEW |