| 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 |
| 11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
| 12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
| 13 #include "webkit/glue/webdatasource.h" | 13 #include "webkit/glue/webdatasource.h" |
| 14 #include "webkit/glue/webkit_glue.h" | 14 #include "webkit/glue/webkit_glue.h" |
| 15 #include "webkit/glue/webframe.h" | 15 #include "webkit/glue/webframe.h" |
| 16 #include "webkit/glue/webview.h" | 16 #include "webkit/glue/webview.h" |
| 17 #include "webkit/tools/test_shell/test_shell_test.h" | 17 #include "webkit/tools/test_shell/test_shell_test.h" |
| 18 | 18 |
| 19 typedef TestShellTest IFrameRedirectTest; | 19 typedef TestShellTest IFrameRedirectTest; |
| 20 | 20 |
| 21 // Tests that loading a page in an iframe from javascript results in | 21 // Tests that loading a page in an iframe from javascript results in |
| 22 // a redirect from about:blank. | 22 // a redirect from about:blank. |
| 23 TEST_F(IFrameRedirectTest, Test) { | 23 TEST_F(IFrameRedirectTest, Test) { |
| 24 std::wstring iframes_data_dir_ = data_dir_; | 24 FilePath iframes_data_dir_ = data_dir_; |
| 25 | 25 iframes_data_dir_ = iframes_data_dir_.AppendASCII("test_shell"); |
| 26 file_util::AppendToPath(&iframes_data_dir_, L"test_shell"); | 26 iframes_data_dir_ = iframes_data_dir_.AppendASCII("iframe_redirect"); |
| 27 file_util::AppendToPath(&iframes_data_dir_, L"iframe_redirect"); | |
| 28 ASSERT_TRUE(file_util::PathExists(iframes_data_dir_)); | 27 ASSERT_TRUE(file_util::PathExists(iframes_data_dir_)); |
| 29 | 28 |
| 30 std::wstring test_url = GetTestURL(iframes_data_dir_, L"main.html"); | 29 std::wstring test_url = GetTestURL(iframes_data_dir_, "main.html"); |
| 31 | 30 |
| 32 test_shell_->LoadURL(test_url.c_str()); | 31 test_shell_->LoadURL(test_url.c_str()); |
| 33 test_shell_->WaitTestFinished(); | 32 test_shell_->WaitTestFinished(); |
| 34 | 33 |
| 35 WebFrame* iframe = test_shell_->webView()->GetFrameWithName(L"ifr"); | 34 WebFrame* iframe = test_shell_->webView()->GetFrameWithName(L"ifr"); |
| 36 ASSERT_TRUE(iframe != NULL); | 35 ASSERT_TRUE(iframe != NULL); |
| 37 WebDataSource* iframe_ds = iframe->GetDataSource(); | 36 WebDataSource* iframe_ds = iframe->GetDataSource(); |
| 38 ASSERT_TRUE(iframe_ds != NULL); | 37 ASSERT_TRUE(iframe_ds != NULL); |
| 39 const std::vector<GURL>& redirects = iframe_ds->GetRedirectChain(); | 38 const std::vector<GURL>& redirects = iframe_ds->GetRedirectChain(); |
| 40 ASSERT_FALSE(redirects.empty()); | 39 ASSERT_FALSE(redirects.empty()); |
| 41 ASSERT_TRUE(redirects[0] == GURL("about:blank")); | 40 ASSERT_TRUE(redirects[0] == GURL("about:blank")); |
| 42 } | 41 } |
| OLD | NEW |