[email protected] | 871dc68 | 2012-06-11 19:35:33 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
[email protected] | 4af886ca | 2012-04-07 00:05:11 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
3 | // found in the LICENSE file. | ||||
4 | |||||
[email protected] | 5799981 | 2013-02-24 05:40:52 | [diff] [blame] | 5 | #include "base/files/file_path.h" |
[email protected] | 112158af | 2013-06-07 23:46:18 | [diff] [blame] | 6 | #include "base/strings/utf_string_conversions.h" |
[email protected] | 4af886ca | 2012-04-07 00:05:11 | [diff] [blame] | 7 | #include "chrome/browser/ui/browser.h" |
[email protected] | cc87237 | 2013-01-28 21:57:07 | [diff] [blame] | 8 | #include "chrome/browser/ui/tabs/tab_strip_model.h" |
[email protected] | 4af886ca | 2012-04-07 00:05:11 | [diff] [blame] | 9 | #include "chrome/test/base/in_process_browser_test.h" |
10 | #include "chrome/test/base/ui_test_utils.h" | ||||
11 | #include "content/public/browser/web_contents.h" | ||||
[email protected] | 761fa470 | 2013-07-02 15:25:15 | [diff] [blame] | 12 | #include "url/gurl.h" |
[email protected] | 4af886ca | 2012-04-07 00:05:11 | [diff] [blame] | 13 | |
14 | class IFrameTest : public InProcessBrowserTest { | ||||
15 | protected: | ||||
16 | void NavigateAndVerifyTitle(const char* file, const char* page_title) { | ||||
17 | GURL url = ui_test_utils::GetTestUrl( | ||||
[email protected] | 650b2d5 | 2013-02-10 03:41:45 | [diff] [blame] | 18 | base::FilePath(), base::FilePath().AppendASCII(file)); |
[email protected] | 4af886ca | 2012-04-07 00:05:11 | [diff] [blame] | 19 | |
20 | ui_test_utils::NavigateToURL(browser(), url); | ||||
[email protected] | 0433872 | 2013-12-24 23:18:05 | [diff] [blame^] | 21 | EXPECT_EQ(base::ASCIIToUTF16(page_title), |
[email protected] | cc87237 | 2013-01-28 21:57:07 | [diff] [blame] | 22 | browser()->tab_strip_model()->GetActiveWebContents()->GetTitle()); |
[email protected] | 4af886ca | 2012-04-07 00:05:11 | [diff] [blame] | 23 | } |
24 | }; | ||||
25 | |||||
26 | IN_PROC_BROWSER_TEST_F(IFrameTest, Crash) { | ||||
27 | NavigateAndVerifyTitle("iframe.html", "iframe test"); | ||||
28 | } | ||||
29 | |||||
30 | IN_PROC_BROWSER_TEST_F(IFrameTest, InEmptyFrame) { | ||||
31 | NavigateAndVerifyTitle("iframe_in_empty_frame.html", "iframe test"); | ||||
32 | } |