| 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 "config.h" | 5 #include "config.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #undef LOG | 9 #undef LOG |
| 10 | 10 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 typedef TestShellTest IFrameRedirectTest; | 28 typedef TestShellTest IFrameRedirectTest; |
| 29 | 29 |
| 30 // Tests that loading a page in an iframe from javascript results in | 30 // Tests that loading a page in an iframe from javascript results in |
| 31 // a redirect from about:blank. | 31 // a redirect from about:blank. |
| 32 TEST_F(IFrameRedirectTest, Test) { | 32 TEST_F(IFrameRedirectTest, Test) { |
| 33 FilePath iframes_data_dir_ = data_dir_; | 33 FilePath iframes_data_dir_ = data_dir_; |
| 34 iframes_data_dir_ = iframes_data_dir_.AppendASCII("test_shell"); | 34 iframes_data_dir_ = iframes_data_dir_.AppendASCII("test_shell"); |
| 35 iframes_data_dir_ = iframes_data_dir_.AppendASCII("iframe_redirect"); | 35 iframes_data_dir_ = iframes_data_dir_.AppendASCII("iframe_redirect"); |
| 36 ASSERT_TRUE(file_util::PathExists(iframes_data_dir_)); | 36 ASSERT_TRUE(file_util::PathExists(iframes_data_dir_)); |
| 37 | 37 |
| 38 std::wstring test_url = GetTestURL(iframes_data_dir_, "main.html"); | 38 GURL test_url = GetTestURL(iframes_data_dir_, "main.html"); |
| 39 | 39 |
| 40 test_shell_->LoadURL(test_url.c_str()); | 40 test_shell_->LoadURL(test_url); |
| 41 test_shell_->WaitTestFinished(); | 41 test_shell_->WaitTestFinished(); |
| 42 | 42 |
| 43 WebFrame* iframe = | 43 WebFrame* iframe = |
| 44 test_shell_->webView()->GetFrameWithName(WebString::fromUTF8("ifr")); | 44 test_shell_->webView()->GetFrameWithName(WebString::fromUTF8("ifr")); |
| 45 ASSERT_TRUE(iframe != NULL); | 45 ASSERT_TRUE(iframe != NULL); |
| 46 WebDataSource* iframe_ds = iframe->dataSource(); | 46 WebDataSource* iframe_ds = iframe->dataSource(); |
| 47 ASSERT_TRUE(iframe_ds != NULL); | 47 ASSERT_TRUE(iframe_ds != NULL); |
| 48 WebVector<WebURL> redirects; | 48 WebVector<WebURL> redirects; |
| 49 iframe_ds->redirectChain(redirects); | 49 iframe_ds->redirectChain(redirects); |
| 50 ASSERT_FALSE(redirects.isEmpty()); | 50 ASSERT_FALSE(redirects.isEmpty()); |
| 51 ASSERT_TRUE(GURL(redirects[0]) == GURL("about:blank")); | 51 ASSERT_TRUE(GURL(redirects[0]) == GURL("about:blank")); |
| 52 } | 52 } |
| OLD | NEW |