Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(402)

Side by Side Diff: webkit/glue/iframe_redirect_unittest.cc

Issue 164225: Switch to WebFrame from the WebKit API.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/glue/glue_util.cc ('k') | webkit/glue/image_resource_fetcher.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/api/public/WebDataSource.h" 13 #include "webkit/api/public/WebDataSource.h"
14 #include "webkit/api/public/WebFrame.h"
14 #include "webkit/api/public/WebURL.h" 15 #include "webkit/api/public/WebURL.h"
15 #include "webkit/api/public/WebVector.h" 16 #include "webkit/api/public/WebVector.h"
16 #include "webkit/glue/webkit_glue.h" 17 #include "webkit/glue/webkit_glue.h"
17 #include "webkit/glue/webframe.h"
18 #include "webkit/glue/webview.h" 18 #include "webkit/glue/webview.h"
19 #include "webkit/tools/test_shell/test_shell_test.h" 19 #include "webkit/tools/test_shell/test_shell_test.h"
20 20
21 using WebKit::WebDataSource; 21 using WebKit::WebDataSource;
22 using WebKit::WebFrame;
22 using WebKit::WebURL; 23 using WebKit::WebURL;
23 using WebKit::WebVector; 24 using WebKit::WebVector;
24 25
25 typedef TestShellTest IFrameRedirectTest; 26 typedef TestShellTest IFrameRedirectTest;
26 27
27 // Tests that loading a page in an iframe from javascript results in 28 // Tests that loading a page in an iframe from javascript results in
28 // a redirect from about:blank. 29 // a redirect from about:blank.
29 TEST_F(IFrameRedirectTest, Test) { 30 TEST_F(IFrameRedirectTest, Test) {
30 FilePath iframes_data_dir_ = data_dir_; 31 FilePath iframes_data_dir_ = data_dir_;
31 iframes_data_dir_ = iframes_data_dir_.AppendASCII("test_shell"); 32 iframes_data_dir_ = iframes_data_dir_.AppendASCII("test_shell");
32 iframes_data_dir_ = iframes_data_dir_.AppendASCII("iframe_redirect"); 33 iframes_data_dir_ = iframes_data_dir_.AppendASCII("iframe_redirect");
33 ASSERT_TRUE(file_util::PathExists(iframes_data_dir_)); 34 ASSERT_TRUE(file_util::PathExists(iframes_data_dir_));
34 35
35 std::wstring test_url = GetTestURL(iframes_data_dir_, "main.html"); 36 std::wstring test_url = GetTestURL(iframes_data_dir_, "main.html");
36 37
37 test_shell_->LoadURL(test_url.c_str()); 38 test_shell_->LoadURL(test_url.c_str());
38 test_shell_->WaitTestFinished(); 39 test_shell_->WaitTestFinished();
39 40
40 WebFrame* iframe = test_shell_->webView()->GetFrameWithName(L"ifr"); 41 WebFrame* iframe = test_shell_->webView()->GetFrameWithName(L"ifr");
41 ASSERT_TRUE(iframe != NULL); 42 ASSERT_TRUE(iframe != NULL);
42 WebDataSource* iframe_ds = iframe->GetDataSource(); 43 WebDataSource* iframe_ds = iframe->dataSource();
43 ASSERT_TRUE(iframe_ds != NULL); 44 ASSERT_TRUE(iframe_ds != NULL);
44 WebVector<WebURL> redirects; 45 WebVector<WebURL> redirects;
45 iframe_ds->redirectChain(redirects); 46 iframe_ds->redirectChain(redirects);
46 ASSERT_FALSE(redirects.isEmpty()); 47 ASSERT_FALSE(redirects.isEmpty());
47 ASSERT_TRUE(GURL(redirects[0]) == GURL("about:blank")); 48 ASSERT_TRUE(GURL(redirects[0]) == GURL("about:blank"));
48 } 49 }
OLDNEW
« no previous file with comments | « webkit/glue/glue_util.cc ('k') | webkit/glue/image_resource_fetcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698