| OLD | NEW |
| 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 void TearDown() override { m_webView->close(); } | 80 void TearDown() override { m_webView->close(); } |
| 81 | 81 |
| 82 WebNavigationPolicy getNavigationPolicyWithMouseEvent( | 82 WebNavigationPolicy getNavigationPolicyWithMouseEvent( |
| 83 int modifiers, | 83 int modifiers, |
| 84 WebMouseEvent::Button button, | 84 WebMouseEvent::Button button, |
| 85 bool asPopup) { | 85 bool asPopup) { |
| 86 WebMouseEvent event(WebInputEvent::MouseUp, modifiers, | 86 WebMouseEvent event(WebInputEvent::MouseUp, modifiers, |
| 87 WebInputEvent::TimeStampForTesting); | 87 WebInputEvent::TimeStampForTesting); |
| 88 event.button = button; | 88 event.button = button; |
| 89 setCurrentInputEventForTest(&event); | 89 setCurrentInputEventForTest(&event); |
| 90 m_chromeClientImpl->setScrollbarsVisible(!asPopup); | 90 m_chromeClientImpl->setToolbarsVisible(!asPopup); |
| 91 m_chromeClientImpl->show(NavigationPolicyIgnore); | 91 m_chromeClientImpl->show(NavigationPolicyIgnore); |
| 92 setCurrentInputEventForTest(0); | 92 setCurrentInputEventForTest(0); |
| 93 return m_result; | 93 return m_result; |
| 94 } | 94 } |
| 95 | 95 |
| 96 bool isNavigationPolicyPopup() { | 96 bool isNavigationPolicyPopup() { |
| 97 m_chromeClientImpl->show(NavigationPolicyIgnore); | 97 m_chromeClientImpl->show(NavigationPolicyIgnore); |
| 98 return m_result == WebNavigationPolicyNewPopup; | 98 return m_result == WebNavigationPolicyNewPopup; |
| 99 } | 99 } |
| 100 | 100 |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 getNavigationPolicyWithMouseEvent(modifiers, button, asPopup)); | 204 getNavigationPolicyWithMouseEvent(modifiers, button, asPopup)); |
| 205 } | 205 } |
| 206 | 206 |
| 207 TEST_F(GetNavigationPolicyTest, NoToolbarsForcesPopup) { | 207 TEST_F(GetNavigationPolicyTest, NoToolbarsForcesPopup) { |
| 208 m_chromeClientImpl->setToolbarsVisible(false); | 208 m_chromeClientImpl->setToolbarsVisible(false); |
| 209 EXPECT_TRUE(isNavigationPolicyPopup()); | 209 EXPECT_TRUE(isNavigationPolicyPopup()); |
| 210 m_chromeClientImpl->setToolbarsVisible(true); | 210 m_chromeClientImpl->setToolbarsVisible(true); |
| 211 EXPECT_FALSE(isNavigationPolicyPopup()); | 211 EXPECT_FALSE(isNavigationPolicyPopup()); |
| 212 } | 212 } |
| 213 | 213 |
| 214 TEST_F(GetNavigationPolicyTest, NoStatusbarForcesPopup) { | 214 TEST_F(GetNavigationPolicyTest, NoStatusbarIsNotPopup) { |
| 215 m_chromeClientImpl->setStatusbarVisible(false); | 215 m_chromeClientImpl->setStatusbarVisible(false); |
| 216 EXPECT_TRUE(isNavigationPolicyPopup()); | 216 EXPECT_FALSE(isNavigationPolicyPopup()); |
| 217 m_chromeClientImpl->setStatusbarVisible(true); | 217 m_chromeClientImpl->setStatusbarVisible(true); |
| 218 EXPECT_FALSE(isNavigationPolicyPopup()); | 218 EXPECT_FALSE(isNavigationPolicyPopup()); |
| 219 } | 219 } |
| 220 | 220 |
| 221 TEST_F(GetNavigationPolicyTest, NoMenubarForcesPopup) { | 221 TEST_F(GetNavigationPolicyTest, NoMenubarIsNotPopup) { |
| 222 m_chromeClientImpl->setMenubarVisible(false); | 222 m_chromeClientImpl->setMenubarVisible(false); |
| 223 EXPECT_TRUE(isNavigationPolicyPopup()); | 223 EXPECT_FALSE(isNavigationPolicyPopup()); |
| 224 m_chromeClientImpl->setMenubarVisible(true); | 224 m_chromeClientImpl->setMenubarVisible(true); |
| 225 EXPECT_FALSE(isNavigationPolicyPopup()); | 225 EXPECT_FALSE(isNavigationPolicyPopup()); |
| 226 } | 226 } |
| 227 | 227 |
| 228 TEST_F(GetNavigationPolicyTest, NotResizableForcesPopup) { | 228 TEST_F(GetNavigationPolicyTest, NotResizableIsNotPopup) { |
| 229 m_chromeClientImpl->setResizable(false); | 229 m_chromeClientImpl->setResizable(false); |
| 230 EXPECT_TRUE(isNavigationPolicyPopup()); | 230 EXPECT_FALSE(isNavigationPolicyPopup()); |
| 231 m_chromeClientImpl->setResizable(true); | 231 m_chromeClientImpl->setResizable(true); |
| 232 EXPECT_FALSE(isNavigationPolicyPopup()); | 232 EXPECT_FALSE(isNavigationPolicyPopup()); |
| 233 } | 233 } |
| 234 | 234 |
| 235 class ViewCreatingClient : public FrameTestHelpers::TestWebViewClient { | 235 class ViewCreatingClient : public FrameTestHelpers::TestWebViewClient { |
| 236 public: | 236 public: |
| 237 WebView* createView(WebLocalFrame* opener, | 237 WebView* createView(WebLocalFrame* opener, |
| 238 const WebURLRequest&, | 238 const WebURLRequest&, |
| 239 const WebWindowFeatures&, | 239 const WebWindowFeatures&, |
| 240 const WebString& name, | 240 const WebString& name, |
| (...skipping 30 matching lines...) Expand all Loading... |
| 271 ScopedPageSuspender suspender; | 271 ScopedPageSuspender suspender; |
| 272 LocalFrame* frame = toWebLocalFrameImpl(m_mainFrame)->frame(); | 272 LocalFrame* frame = toWebLocalFrameImpl(m_mainFrame)->frame(); |
| 273 FrameLoadRequest request(frame->document()); | 273 FrameLoadRequest request(frame->document()); |
| 274 WindowFeatures features; | 274 WindowFeatures features; |
| 275 EXPECT_EQ(nullptr, | 275 EXPECT_EQ(nullptr, |
| 276 m_chromeClientImpl->createWindow(frame, request, features, | 276 m_chromeClientImpl->createWindow(frame, request, features, |
| 277 NavigationPolicyNewForegroundTab)); | 277 NavigationPolicyNewForegroundTab)); |
| 278 } | 278 } |
| 279 | 279 |
| 280 } // namespace blink | 280 } // namespace blink |
| OLD | NEW |