Index: third_party/WebKit/Source/web/tests/ChromeClientImplTest.cpp |
diff --git a/third_party/WebKit/Source/web/tests/ChromeClientImplTest.cpp b/third_party/WebKit/Source/web/tests/ChromeClientImplTest.cpp |
index 2b9b3a5aa448d92c60abb7fc789f0d932246ccbf..5e7e0600508ccc1642404a074e97e7f0367c87ad 100644 |
--- a/third_party/WebKit/Source/web/tests/ChromeClientImplTest.cpp |
+++ b/third_party/WebKit/Source/web/tests/ChromeClientImplTest.cpp |
@@ -64,177 +64,6 @@ class TestWebViewClient : public FrameTestHelpers::TestWebViewClient { |
} // anonymous namespace |
-class GetNavigationPolicyTest : public testing::Test { |
- public: |
- GetNavigationPolicyTest() |
- : result_(kWebNavigationPolicyIgnore), web_view_client_(&result_) {} |
- |
- protected: |
- void SetUp() override { |
- web_view_ = static_cast<WebViewBase*>( |
- WebViewBase::Create(&web_view_client_, kWebPageVisibilityStateVisible)); |
- web_view_->SetMainFrame(WebLocalFrame::Create( |
- WebTreeScopeType::kDocument, &web_frame_client_, nullptr, nullptr)); |
- chrome_client_impl_ = |
- ToChromeClientImpl(&web_view_->GetPage()->GetChromeClient()); |
- result_ = kWebNavigationPolicyIgnore; |
- } |
- |
- void TearDown() override { web_view_->Close(); } |
- |
- WebNavigationPolicy GetNavigationPolicyWithMouseEvent( |
- int modifiers, |
- WebMouseEvent::Button button, |
- bool as_popup) { |
- WebMouseEvent event(WebInputEvent::kMouseUp, modifiers, |
- WebInputEvent::kTimeStampForTesting); |
- event.button = button; |
- web_view_->SetCurrentInputEventForTest(&event); |
- chrome_client_impl_->SetToolbarsVisible(!as_popup); |
- chrome_client_impl_->Show(kNavigationPolicyIgnore); |
- web_view_->SetCurrentInputEventForTest(0); |
- return result_; |
- } |
- |
- bool IsNavigationPolicyPopup() { |
- chrome_client_impl_->Show(kNavigationPolicyIgnore); |
- return result_ == kWebNavigationPolicyNewPopup; |
- } |
- |
- protected: |
- WebNavigationPolicy result_; |
- TestWebViewClient web_view_client_; |
- WebViewBase* web_view_; |
- FrameTestHelpers::TestWebFrameClient web_frame_client_; |
- Persistent<ChromeClientImpl> chrome_client_impl_; |
-}; |
- |
-TEST_F(GetNavigationPolicyTest, LeftClick) { |
- int modifiers = 0; |
- WebMouseEvent::Button button = WebMouseEvent::Button::kLeft; |
- bool as_popup = false; |
- EXPECT_EQ(kWebNavigationPolicyNewForegroundTab, |
- GetNavigationPolicyWithMouseEvent(modifiers, button, as_popup)); |
-} |
- |
-TEST_F(GetNavigationPolicyTest, LeftClickPopup) { |
- int modifiers = 0; |
- WebMouseEvent::Button button = WebMouseEvent::Button::kLeft; |
- bool as_popup = true; |
- EXPECT_EQ(kWebNavigationPolicyNewPopup, |
- GetNavigationPolicyWithMouseEvent(modifiers, button, as_popup)); |
-} |
- |
-TEST_F(GetNavigationPolicyTest, ShiftLeftClick) { |
- int modifiers = WebInputEvent::kShiftKey; |
- WebMouseEvent::Button button = WebMouseEvent::Button::kLeft; |
- bool as_popup = false; |
- EXPECT_EQ(kWebNavigationPolicyNewWindow, |
- GetNavigationPolicyWithMouseEvent(modifiers, button, as_popup)); |
-} |
- |
-TEST_F(GetNavigationPolicyTest, ShiftLeftClickPopup) { |
- int modifiers = WebInputEvent::kShiftKey; |
- WebMouseEvent::Button button = WebMouseEvent::Button::kLeft; |
- bool as_popup = true; |
- EXPECT_EQ(kWebNavigationPolicyNewPopup, |
- GetNavigationPolicyWithMouseEvent(modifiers, button, as_popup)); |
-} |
- |
-TEST_F(GetNavigationPolicyTest, ControlOrMetaLeftClick) { |
-#if OS(MACOSX) |
- int modifiers = WebInputEvent::kMetaKey; |
-#else |
- int modifiers = WebInputEvent::kControlKey; |
-#endif |
- WebMouseEvent::Button button = WebMouseEvent::Button::kLeft; |
- bool as_popup = false; |
- EXPECT_EQ(kWebNavigationPolicyNewBackgroundTab, |
- GetNavigationPolicyWithMouseEvent(modifiers, button, as_popup)); |
-} |
- |
-TEST_F(GetNavigationPolicyTest, ControlOrMetaLeftClickPopup) { |
-#if OS(MACOSX) |
- int modifiers = WebInputEvent::kMetaKey; |
-#else |
- int modifiers = WebInputEvent::kControlKey; |
-#endif |
- WebMouseEvent::Button button = WebMouseEvent::Button::kLeft; |
- bool as_popup = true; |
- EXPECT_EQ(kWebNavigationPolicyNewBackgroundTab, |
- GetNavigationPolicyWithMouseEvent(modifiers, button, as_popup)); |
-} |
- |
-TEST_F(GetNavigationPolicyTest, ControlOrMetaAndShiftLeftClick) { |
-#if OS(MACOSX) |
- int modifiers = WebInputEvent::kMetaKey; |
-#else |
- int modifiers = WebInputEvent::kControlKey; |
-#endif |
- modifiers |= WebInputEvent::kShiftKey; |
- WebMouseEvent::Button button = WebMouseEvent::Button::kLeft; |
- bool as_popup = false; |
- EXPECT_EQ(kWebNavigationPolicyNewForegroundTab, |
- GetNavigationPolicyWithMouseEvent(modifiers, button, as_popup)); |
-} |
- |
-TEST_F(GetNavigationPolicyTest, ControlOrMetaAndShiftLeftClickPopup) { |
-#if OS(MACOSX) |
- int modifiers = WebInputEvent::kMetaKey; |
-#else |
- int modifiers = WebInputEvent::kControlKey; |
-#endif |
- modifiers |= WebInputEvent::kShiftKey; |
- WebMouseEvent::Button button = WebMouseEvent::Button::kLeft; |
- bool as_popup = true; |
- EXPECT_EQ(kWebNavigationPolicyNewForegroundTab, |
- GetNavigationPolicyWithMouseEvent(modifiers, button, as_popup)); |
-} |
- |
-TEST_F(GetNavigationPolicyTest, MiddleClick) { |
- int modifiers = 0; |
- bool as_popup = false; |
- WebMouseEvent::Button button = WebMouseEvent::Button::kMiddle; |
- EXPECT_EQ(kWebNavigationPolicyNewBackgroundTab, |
- GetNavigationPolicyWithMouseEvent(modifiers, button, as_popup)); |
-} |
- |
-TEST_F(GetNavigationPolicyTest, MiddleClickPopup) { |
- int modifiers = 0; |
- bool as_popup = true; |
- WebMouseEvent::Button button = WebMouseEvent::Button::kMiddle; |
- EXPECT_EQ(kWebNavigationPolicyNewBackgroundTab, |
- GetNavigationPolicyWithMouseEvent(modifiers, button, as_popup)); |
-} |
- |
-TEST_F(GetNavigationPolicyTest, NoToolbarsForcesPopup) { |
- chrome_client_impl_->SetToolbarsVisible(false); |
- EXPECT_TRUE(IsNavigationPolicyPopup()); |
- chrome_client_impl_->SetToolbarsVisible(true); |
- EXPECT_FALSE(IsNavigationPolicyPopup()); |
-} |
- |
-TEST_F(GetNavigationPolicyTest, NoStatusbarIsNotPopup) { |
- chrome_client_impl_->SetStatusbarVisible(false); |
- EXPECT_FALSE(IsNavigationPolicyPopup()); |
- chrome_client_impl_->SetStatusbarVisible(true); |
- EXPECT_FALSE(IsNavigationPolicyPopup()); |
-} |
- |
-TEST_F(GetNavigationPolicyTest, NoMenubarIsNotPopup) { |
- chrome_client_impl_->SetMenubarVisible(false); |
- EXPECT_FALSE(IsNavigationPolicyPopup()); |
- chrome_client_impl_->SetMenubarVisible(true); |
- EXPECT_FALSE(IsNavigationPolicyPopup()); |
-} |
- |
-TEST_F(GetNavigationPolicyTest, NotResizableIsNotPopup) { |
- chrome_client_impl_->SetResizable(false); |
- EXPECT_FALSE(IsNavigationPolicyPopup()); |
- chrome_client_impl_->SetResizable(true); |
- EXPECT_FALSE(IsNavigationPolicyPopup()); |
-} |
- |
class ViewCreatingClient : public FrameTestHelpers::TestWebViewClient { |
public: |
WebView* CreateView(WebLocalFrame* opener, |
@@ -275,7 +104,7 @@ TEST_F(CreateWindowTest, CreateWindowFromSuspendedPage) { |
ScopedPageSuspender suspender; |
LocalFrame* frame = ToWebLocalFrameBase(main_frame_)->GetFrame(); |
FrameLoadRequest request(frame->GetDocument()); |
- WindowFeatures features; |
+ WebWindowFeatures features; |
EXPECT_EQ(nullptr, |
chrome_client_impl_->CreateWindow( |
frame, request, features, kNavigationPolicyNewForegroundTab)); |