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

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

Issue 2389493002: Revert of Require WebLocalFrame to be created with a non-null client (Closed)
Patch Set: Created 4 years, 2 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) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 GetNavigationPolicyTest() 70 GetNavigationPolicyTest()
71 : m_result(WebNavigationPolicyIgnore) 71 : m_result(WebNavigationPolicyIgnore)
72 , m_webViewClient(&m_result) 72 , m_webViewClient(&m_result)
73 { 73 {
74 } 74 }
75 75
76 protected: 76 protected:
77 void SetUp() override 77 void SetUp() override
78 { 78 {
79 m_webView = toWebViewImpl(WebView::create(&m_webViewClient, WebPageVisib ilityStateVisible)); 79 m_webView = toWebViewImpl(WebView::create(&m_webViewClient, WebPageVisib ilityStateVisible));
80 m_webView->setMainFrame(WebLocalFrame::create(WebTreeScopeType::Document , &m_webFrameClient)); 80 m_mainFrame = WebLocalFrame::create(WebTreeScopeType::Document, &m_webFr ameClient);
81 m_webView->setMainFrame(m_mainFrame);
81 m_chromeClientImpl = toChromeClientImpl(&m_webView->page()->chromeClient ()); 82 m_chromeClientImpl = toChromeClientImpl(&m_webView->page()->chromeClient ());
82 m_result = WebNavigationPolicyIgnore; 83 m_result = WebNavigationPolicyIgnore;
83 } 84 }
84 85
85 void TearDown() override 86 void TearDown() override
86 { 87 {
87 m_webView->close(); 88 m_webView->close();
89 m_mainFrame->close();
88 } 90 }
89 91
90 WebNavigationPolicy getNavigationPolicyWithMouseEvent(int modifiers, WebMous eEvent::Button button, bool asPopup) 92 WebNavigationPolicy getNavigationPolicyWithMouseEvent(int modifiers, WebMous eEvent::Button button, bool asPopup)
91 { 93 {
92 WebMouseEvent event; 94 WebMouseEvent event;
93 event.modifiers = modifiers; 95 event.modifiers = modifiers;
94 event.type = WebInputEvent::MouseUp; 96 event.type = WebInputEvent::MouseUp;
95 event.button = button; 97 event.button = button;
96 setCurrentInputEventForTest(&event); 98 setCurrentInputEventForTest(&event);
97 m_chromeClientImpl->setScrollbarsVisible(!asPopup); 99 m_chromeClientImpl->setScrollbarsVisible(!asPopup);
98 m_chromeClientImpl->show(NavigationPolicyIgnore); 100 m_chromeClientImpl->show(NavigationPolicyIgnore);
99 setCurrentInputEventForTest(0); 101 setCurrentInputEventForTest(0);
100 return m_result; 102 return m_result;
101 } 103 }
102 104
103 bool isNavigationPolicyPopup() 105 bool isNavigationPolicyPopup()
104 { 106 {
105 m_chromeClientImpl->show(NavigationPolicyIgnore); 107 m_chromeClientImpl->show(NavigationPolicyIgnore);
106 return m_result == WebNavigationPolicyNewPopup; 108 return m_result == WebNavigationPolicyNewPopup;
107 } 109 }
108 110
109 protected: 111 protected:
110 WebNavigationPolicy m_result; 112 WebNavigationPolicy m_result;
111 TestWebViewClient m_webViewClient; 113 TestWebViewClient m_webViewClient;
112 WebViewImpl* m_webView; 114 WebViewImpl* m_webView;
115 WebFrame* m_mainFrame;
113 FrameTestHelpers::TestWebFrameClient m_webFrameClient; 116 FrameTestHelpers::TestWebFrameClient m_webFrameClient;
114 Persistent<ChromeClientImpl> m_chromeClientImpl; 117 Persistent<ChromeClientImpl> m_chromeClientImpl;
115 }; 118 };
116 119
117 TEST_F(GetNavigationPolicyTest, LeftClick) 120 TEST_F(GetNavigationPolicyTest, LeftClick)
118 { 121 {
119 int modifiers = 0; 122 int modifiers = 0;
120 WebMouseEvent::Button button = WebMouseEvent::Button::Left; 123 WebMouseEvent::Button button = WebMouseEvent::Button::Left;
121 bool asPopup = false; 124 bool asPopup = false;
122 EXPECT_EQ(WebNavigationPolicyNewForegroundTab, 125 EXPECT_EQ(WebNavigationPolicyNewForegroundTab,
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 { 274 {
272 m_webView = toWebViewImpl(WebView::create(&m_webViewClient, WebPageVisib ilityStateVisible)); 275 m_webView = toWebViewImpl(WebView::create(&m_webViewClient, WebPageVisib ilityStateVisible));
273 m_mainFrame = WebLocalFrame::create(WebTreeScopeType::Document, &m_webFr ameClient); 276 m_mainFrame = WebLocalFrame::create(WebTreeScopeType::Document, &m_webFr ameClient);
274 m_webView->setMainFrame(m_mainFrame); 277 m_webView->setMainFrame(m_mainFrame);
275 m_chromeClientImpl = toChromeClientImpl(&m_webView->page()->chromeClient ()); 278 m_chromeClientImpl = toChromeClientImpl(&m_webView->page()->chromeClient ());
276 } 279 }
277 280
278 void TearDown() override 281 void TearDown() override
279 { 282 {
280 m_webView->close(); 283 m_webView->close();
284 m_mainFrame->close();
281 } 285 }
282 286
283 ViewCreatingClient m_webViewClient; 287 ViewCreatingClient m_webViewClient;
284 WebViewImpl* m_webView; 288 WebViewImpl* m_webView;
285 WebLocalFrame* m_mainFrame; 289 WebFrame* m_mainFrame;
286 FrameTestHelpers::TestWebFrameClient m_webFrameClient; 290 FrameTestHelpers::TestWebFrameClient m_webFrameClient;
287 Persistent<ChromeClientImpl> m_chromeClientImpl; 291 Persistent<ChromeClientImpl> m_chromeClientImpl;
288 }; 292 };
289 293
290 TEST_F(CreateWindowTest, CreateWindowFromDeferredPage) 294 TEST_F(CreateWindowTest, CreateWindowFromDeferredPage)
291 { 295 {
292 m_webView->page()->setDefersLoading(true); 296 m_webView->page()->setDefersLoading(true);
293 LocalFrame* frame = toWebLocalFrameImpl(m_mainFrame)->frame(); 297 LocalFrame* frame = toWebLocalFrameImpl(m_mainFrame)->frame();
294 FrameLoadRequest request(frame->document()); 298 FrameLoadRequest request(frame->document());
295 WindowFeatures features; 299 WindowFeatures features;
296 EXPECT_EQ(nullptr, m_chromeClientImpl->createWindow(frame, request, features , NavigationPolicyNewForegroundTab)); 300 EXPECT_EQ(nullptr, m_chromeClientImpl->createWindow(frame, request, features , NavigationPolicyNewForegroundTab));
297 m_webView->page()->setDefersLoading(false); 301 m_webView->page()->setDefersLoading(false);
298 } 302 }
299 303
300 } // namespace blink 304 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebLocalFrameImpl.cpp ('k') | third_party/WebKit/Source/web/tests/FrameLoaderClientImplTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698