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

Side by Side Diff: third_party/WebKit/Source/web/tests/WebFrameTest.cpp

Issue 2837593002: Nuked WebFrameImplBase. (Closed)
Patch Set: Replaced non-null params with refs. Created 3 years, 7 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 8699 matching lines...) Expand 10 before | Expand all | Expand 10 after
8710 // FIXME: Refactor some of this logic into WebViewHelper to make it easier to 8710 // FIXME: Refactor some of this logic into WebViewHelper to make it easier to
8711 // write tests with a top-level remote frame. 8711 // write tests with a top-level remote frame.
8712 FrameTestHelpers::TestWebViewClient view_client; 8712 FrameTestHelpers::TestWebViewClient view_client;
8713 FrameTestHelpers::TestWebRemoteFrameClient remote_client; 8713 FrameTestHelpers::TestWebRemoteFrameClient remote_client;
8714 WebView* view = WebView::Create(&view_client, kWebPageVisibilityStateVisible); 8714 WebView* view = WebView::Create(&view_client, kWebPageVisibilityStateVisible);
8715 view->SetMainFrame(remote_client.GetFrame()); 8715 view->SetMainFrame(remote_client.GetFrame());
8716 WebLocalFrame* child_frame = 8716 WebLocalFrame* child_frame =
8717 FrameTestHelpers::CreateLocalChild(view->MainFrame()->ToWebRemoteFrame()); 8717 FrameTestHelpers::CreateLocalChild(view->MainFrame()->ToWebRemoteFrame());
8718 8718
8719 // Purposely keep the LocalFrame alive so it's the last thing to be destroyed. 8719 // Purposely keep the LocalFrame alive so it's the last thing to be destroyed.
8720 Persistent<Frame> child_core_frame = child_frame->ToImplBase()->GetFrame(); 8720 Persistent<Frame> child_core_frame = WebFrame::ToCoreFrame(*child_frame);
8721 view->Close(); 8721 view->Close();
8722 child_core_frame.Clear(); 8722 child_core_frame.Clear();
8723 } 8723 }
8724 8724
8725 class WebFrameSwapTest : public WebFrameTest { 8725 class WebFrameSwapTest : public WebFrameTest {
8726 protected: 8726 protected:
8727 WebFrameSwapTest() { 8727 WebFrameSwapTest() {
8728 RegisterMockedHttpURLLoad("frame-a-b-c.html"); 8728 RegisterMockedHttpURLLoad("frame-a-b-c.html");
8729 RegisterMockedHttpURLLoad("subframe-a.html"); 8729 RegisterMockedHttpURLLoad("subframe-a.html");
8730 RegisterMockedHttpURLLoad("subframe-b.html"); 8730 RegisterMockedHttpURLLoad("subframe-b.html");
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after
9405 main_window->open(destination.GetString(), "frame1", "", main_window, 9405 main_window->open(destination.GetString(), "frame1", "", main_window,
9406 main_window); 9406 main_window);
9407 ASSERT_FALSE(remote_client.LastRequest().IsNull()); 9407 ASSERT_FALSE(remote_client.LastRequest().IsNull());
9408 EXPECT_EQ(remote_client.LastRequest().Url(), WebURL(destination)); 9408 EXPECT_EQ(remote_client.LastRequest().Url(), WebURL(destination));
9409 9409
9410 // Pointing a named frame to an empty URL should just return a reference to 9410 // Pointing a named frame to an empty URL should just return a reference to
9411 // the frame's window without navigating it. 9411 // the frame's window without navigating it.
9412 DOMWindow* result = 9412 DOMWindow* result =
9413 main_window->open("", "frame1", "", main_window, main_window); 9413 main_window->open("", "frame1", "", main_window, main_window);
9414 EXPECT_EQ(remote_client.LastRequest().Url(), WebURL(destination)); 9414 EXPECT_EQ(remote_client.LastRequest().Url(), WebURL(destination));
9415 EXPECT_EQ(result, remote_frame->ToImplBase()->GetFrame()->DomWindow()); 9415 EXPECT_EQ(result, WebFrame::ToCoreFrame(*remote_frame)->DomWindow());
9416 9416
9417 Reset(); 9417 Reset();
9418 } 9418 }
9419 9419
9420 class RemoteWindowCloseClient : public FrameTestHelpers::TestWebViewClient { 9420 class RemoteWindowCloseClient : public FrameTestHelpers::TestWebViewClient {
9421 public: 9421 public:
9422 RemoteWindowCloseClient() : closed_(false) {} 9422 RemoteWindowCloseClient() : closed_(false) {}
9423 9423
9424 void CloseWidgetSoon() override { closed_ = true; } 9424 void CloseWidgetSoon() override { closed_ = true; }
9425 9425
(...skipping 12 matching lines...) Expand all
9438 FrameTestHelpers::TestWebRemoteFrameClient frame_client; 9438 FrameTestHelpers::TestWebRemoteFrameClient frame_client;
9439 WebRemoteFrameImpl* web_remote_frame = frame_client.GetFrame(); 9439 WebRemoteFrameImpl* web_remote_frame = frame_client.GetFrame();
9440 9440
9441 WebView* view = WebView::Create(&view_client, kWebPageVisibilityStateVisible); 9441 WebView* view = WebView::Create(&view_client, kWebPageVisibilityStateVisible);
9442 view->SetMainFrame(web_remote_frame); 9442 view->SetMainFrame(web_remote_frame);
9443 view->MainFrame()->SetOpener(main_web_view.WebView()->MainFrame()); 9443 view->MainFrame()->SetOpener(main_web_view.WebView()->MainFrame());
9444 web_remote_frame->SetReplicatedOrigin( 9444 web_remote_frame->SetReplicatedOrigin(
9445 WebSecurityOrigin::CreateFromString("http://127.0.0.1")); 9445 WebSecurityOrigin::CreateFromString("http://127.0.0.1"));
9446 9446
9447 LocalFrame* local_frame = ToLocalFrame( 9447 LocalFrame* local_frame = ToLocalFrame(
9448 main_web_view.WebView()->MainFrame()->ToImplBase()->GetFrame()); 9448 WebFrame::ToCoreFrame(*main_web_view.WebView()->MainFrame()));
9449 RemoteFrame* remote_frame = web_remote_frame->GetFrame(); 9449 RemoteFrame* remote_frame = web_remote_frame->GetFrame();
9450 9450
9451 // Attempt to close the window, which should fail as it isn't opened 9451 // Attempt to close the window, which should fail as it isn't opened
9452 // by a script. 9452 // by a script.
9453 remote_frame->DomWindow()->close(local_frame->GetDocument()); 9453 remote_frame->DomWindow()->close(local_frame->GetDocument());
9454 EXPECT_FALSE(view_client.Closed()); 9454 EXPECT_FALSE(view_client.Closed());
9455 9455
9456 // Marking it as opened by a script should now allow it to be closed. 9456 // Marking it as opened by a script should now allow it to be closed.
9457 remote_frame->GetPage()->SetOpenedByDOM(); 9457 remote_frame->GetPage()->SetOpenedByDOM();
9458 remote_frame->DomWindow()->close(local_frame->GetDocument()); 9458 remote_frame->DomWindow()->close(local_frame->GetDocument());
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
9935 // Prepare a page with a remote main frame. 9935 // Prepare a page with a remote main frame.
9936 FrameTestHelpers::TestWebViewClient view_client; 9936 FrameTestHelpers::TestWebViewClient view_client;
9937 FrameTestHelpers::TestWebRemoteFrameClient remote_client; 9937 FrameTestHelpers::TestWebRemoteFrameClient remote_client;
9938 WebView* view = WebView::Create(&view_client, kWebPageVisibilityStateVisible); 9938 WebView* view = WebView::Create(&view_client, kWebPageVisibilityStateVisible);
9939 view->SetMainFrame(remote_client.GetFrame()); 9939 view->SetMainFrame(remote_client.GetFrame());
9940 WebRemoteFrame* remote_root = view->MainFrame()->ToWebRemoteFrame(); 9940 WebRemoteFrame* remote_root = view->MainFrame()->ToWebRemoteFrame();
9941 remote_root->SetReplicatedOrigin(SecurityOrigin::CreateUnique()); 9941 remote_root->SetReplicatedOrigin(SecurityOrigin::CreateUnique());
9942 9942
9943 // Check that ScopedPageSuspender properly triggers deferred loading for 9943 // Check that ScopedPageSuspender properly triggers deferred loading for
9944 // the current Page. 9944 // the current Page.
9945 Page* page = remote_root->ToImplBase()->GetFrame()->GetPage(); 9945 Page* page = WebFrame::ToCoreFrame(*remote_root)->GetPage();
9946 EXPECT_FALSE(page->Suspended()); 9946 EXPECT_FALSE(page->Suspended());
9947 { 9947 {
9948 ScopedPageSuspender suspender; 9948 ScopedPageSuspender suspender;
9949 EXPECT_TRUE(page->Suspended()); 9949 EXPECT_TRUE(page->Suspended());
9950 } 9950 }
9951 EXPECT_FALSE(page->Suspended()); 9951 EXPECT_FALSE(page->Suspended());
9952 9952
9953 // Repeat this for a page with a local child frame, and ensure that the 9953 // Repeat this for a page with a local child frame, and ensure that the
9954 // child frame's loads are also suspended. 9954 // child frame's loads are also suspended.
9955 WebLocalFrame* web_local_child = 9955 WebLocalFrame* web_local_child =
(...skipping 2043 matching lines...) Expand 10 before | Expand all | Expand 10 after
11999 11999
12000 // Failing the original child frame navigation and trying to render fallback 12000 // Failing the original child frame navigation and trying to render fallback
12001 // content shouldn't crash. It should return NoLoadInProgress. This is so the 12001 // content shouldn't crash. It should return NoLoadInProgress. This is so the
12002 // caller won't attempt to replace the correctly empty frame with an error 12002 // caller won't attempt to replace the correctly empty frame with an error
12003 // page. 12003 // page.
12004 EXPECT_EQ(WebLocalFrame::NoLoadInProgress, 12004 EXPECT_EQ(WebLocalFrame::NoLoadInProgress,
12005 child->MaybeRenderFallbackContent(WebURLError())); 12005 child->MaybeRenderFallbackContent(WebURLError()));
12006 } 12006 }
12007 12007
12008 } // namespace blink 12008 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/tests/TouchActionTest.cpp ('k') | third_party/WebKit/public/web/WebFrame.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698