| 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/file_path.h" | 6 #include "base/file_path.h" |
| 7 #include "base/platform_thread.h" | |
| 8 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 9 #include "chrome/test/ui/ui_test.h" | 8 #include "chrome/test/ui/ui_test.h" |
| 10 #include "net/base/net_util.h" | 9 #include "net/base/net_util.h" |
| 11 | 10 |
| 12 class IFrameTest : public UITest { | 11 class IFrameTest : public UITest { |
| 13 protected: | 12 protected: |
| 14 void NavigateAndVerifyTitle(const char* url, const wchar_t* page_title) { | 13 void NavigateAndVerifyTitle(const char* url, const wchar_t* page_title) { |
| 15 FilePath test_file(test_data_directory_); | 14 FilePath test_file(test_data_directory_); |
| 16 test_file = test_file.AppendASCII(url); | 15 test_file = test_file.AppendASCII(url); |
| 17 | 16 |
| 18 NavigateToURL(net::FilePathToFileURL(test_file)); | 17 NavigateToURL(net::FilePathToFileURL(test_file)); |
| 19 // The browser lazily updates the title. | |
| 20 PlatformThread::Sleep(sleep_timeout_ms()); | |
| 21 | |
| 22 // Make sure the navigation succeeded. | |
| 23 EXPECT_EQ(std::wstring(page_title), GetActiveTabTitle()); | 18 EXPECT_EQ(std::wstring(page_title), GetActiveTabTitle()); |
| 24 | |
| 25 // UITest will check if this crashed. | |
| 26 } | 19 } |
| 27 }; | 20 }; |
| 28 | 21 |
| 29 TEST_F(IFrameTest, Crash) { | 22 TEST_F(IFrameTest, Crash) { |
| 30 NavigateAndVerifyTitle("iframe.html", L"iframe test"); | 23 NavigateAndVerifyTitle("iframe.html", L"iframe test"); |
| 31 } | 24 } |
| 32 | 25 |
| 33 TEST_F(IFrameTest, InEmptyFrame) { | 26 TEST_F(IFrameTest, InEmptyFrame) { |
| 34 NavigateAndVerifyTitle("iframe_in_empty_frame.html", L"iframe test"); | 27 NavigateAndVerifyTitle("iframe_in_empty_frame.html", L"iframe test"); |
| 35 } | 28 } |
| OLD | NEW |