| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "app/l10n_util.h" | 5 #include "app/l10n_util.h" |
| 6 #include "base/file_path.h" | 6 #include "base/file_path.h" |
| 7 #include "base/platform_thread.h" | 7 #include "base/platform_thread.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "chrome/common/url_constants.h" | 9 #include "chrome/common/url_constants.h" |
| 10 #include "chrome/test/automation/tab_proxy.h" | 10 #include "chrome/test/automation/tab_proxy.h" |
| (...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 // visible. | 490 // visible. |
| 491 scoped_refptr<HTTPTestServer> server = | 491 scoped_refptr<HTTPTestServer> server = |
| 492 HTTPTestServer::CreateServer(kDocRoot, NULL); | 492 HTTPTestServer::CreateServer(kDocRoot, NULL); |
| 493 ASSERT_TRUE(NULL != server.get()); | 493 ASSERT_TRUE(NULL != server.get()); |
| 494 | 494 |
| 495 ASSERT_TRUE(tab_->NavigateToURL(server->TestServerPage( | 495 ASSERT_TRUE(tab_->NavigateToURL(server->TestServerPage( |
| 496 "files/session_history/replace.html?no-title.html"))); | 496 "files/session_history/replace.html?no-title.html"))); |
| 497 EXPECT_EQ(L"", GetTabTitle()); | 497 EXPECT_EQ(L"", GetTabTitle()); |
| 498 } | 498 } |
| 499 | 499 |
| 500 TEST_F(SessionHistoryTest, HistorySearchXSS) { | 500 // This test is flaky. See bug 22111. |
| 501 TEST_F(SessionHistoryTest, FLAKY_HistorySearchXSS) { |
| 501 // about:blank should be loaded first. | 502 // about:blank should be loaded first. |
| 502 ASSERT_FALSE(tab_->GoBack()); | 503 ASSERT_FALSE(tab_->GoBack()); |
| 503 EXPECT_EQ(L"", GetTabTitle()); | 504 EXPECT_EQ(L"", GetTabTitle()); |
| 504 | 505 |
| 505 GURL url(std::string(chrome::kChromeUIHistoryURL) + | 506 GURL url(std::string(chrome::kChromeUIHistoryURL) + |
| 506 "#q=%3Cimg%20src%3Dx%3Ax%20onerror%3D%22document.title%3D'XSS'%22%3E"); | 507 "#q=%3Cimg%20src%3Dx%3Ax%20onerror%3D%22document.title%3D'XSS'%22%3E"); |
| 507 ASSERT_TRUE(tab_->NavigateToURL(url)); | 508 ASSERT_TRUE(tab_->NavigateToURL(url)); |
| 508 // Mainly, this is to ensure we send a synchronous message to the renderer | 509 // Mainly, this is to ensure we send a synchronous message to the renderer |
| 509 // so that we're not susceptible (less susceptible?) to a race condition. | 510 // so that we're not susceptible (less susceptible?) to a race condition. |
| 510 // Should a race condition ever trigger, it won't result in flakiness. | 511 // Should a race condition ever trigger, it won't result in flakiness. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 524 | 525 |
| 525 ASSERT_TRUE(tab_->NavigateToURL(GURL( | 526 ASSERT_TRUE(tab_->NavigateToURL(GURL( |
| 526 "javascript:void(frames[0].navigate())"))); | 527 "javascript:void(frames[0].navigate())"))); |
| 527 EXPECT_EQ(L"foo", GetTabTitle()); | 528 EXPECT_EQ(L"foo", GetTabTitle()); |
| 528 | 529 |
| 529 ASSERT_TRUE(tab_->GoBack()); | 530 ASSERT_TRUE(tab_->GoBack()); |
| 530 EXPECT_EQ(L"Default Title", GetTabTitle()); | 531 EXPECT_EQ(L"Default Title", GetTabTitle()); |
| 531 } | 532 } |
| 532 | 533 |
| 533 } // namespace | 534 } // namespace |
| OLD | NEW |