| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 | 54 |
| 55 void show(WebNavigationPolicy policy) override | 55 void show(WebNavigationPolicy policy) override |
| 56 { | 56 { |
| 57 *m_target = policy; | 57 *m_target = policy; |
| 58 } | 58 } |
| 59 | 59 |
| 60 private: | 60 private: |
| 61 WebNavigationPolicy* m_target; | 61 WebNavigationPolicy* m_target; |
| 62 }; | 62 }; |
| 63 | 63 |
| 64 class TestWebFrameClient : public WebFrameClient { | |
| 65 public: | |
| 66 ~TestWebFrameClient() override { } | |
| 67 }; | |
| 68 | |
| 69 } // anonymous namespace | 64 } // anonymous namespace |
| 70 | 65 |
| 71 class GetNavigationPolicyTest : public testing::Test { | 66 class GetNavigationPolicyTest : public testing::Test { |
| 72 public: | 67 public: |
| 73 GetNavigationPolicyTest() | 68 GetNavigationPolicyTest() |
| 74 : m_result(WebNavigationPolicyIgnore) | 69 : m_result(WebNavigationPolicyIgnore) |
| 75 , m_webViewClient(&m_result) | 70 , m_webViewClient(&m_result) |
| 76 { | 71 { |
| 77 } | 72 } |
| 78 | 73 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 109 { | 104 { |
| 110 m_chromeClientImpl->show(NavigationPolicyIgnore); | 105 m_chromeClientImpl->show(NavigationPolicyIgnore); |
| 111 return m_result == WebNavigationPolicyNewPopup; | 106 return m_result == WebNavigationPolicyNewPopup; |
| 112 } | 107 } |
| 113 | 108 |
| 114 protected: | 109 protected: |
| 115 WebNavigationPolicy m_result; | 110 WebNavigationPolicy m_result; |
| 116 TestWebViewClient m_webViewClient; | 111 TestWebViewClient m_webViewClient; |
| 117 WebViewImpl* m_webView; | 112 WebViewImpl* m_webView; |
| 118 WebFrame* m_mainFrame; | 113 WebFrame* m_mainFrame; |
| 119 TestWebFrameClient m_webFrameClient; | 114 FrameTestHelpers::TestWebFrameClient m_webFrameClient; |
| 120 Persistent<ChromeClientImpl> m_chromeClientImpl; | 115 Persistent<ChromeClientImpl> m_chromeClientImpl; |
| 121 }; | 116 }; |
| 122 | 117 |
| 123 TEST_F(GetNavigationPolicyTest, LeftClick) | 118 TEST_F(GetNavigationPolicyTest, LeftClick) |
| 124 { | 119 { |
| 125 int modifiers = 0; | 120 int modifiers = 0; |
| 126 WebMouseEvent::Button button = WebMouseEvent::ButtonLeft; | 121 WebMouseEvent::Button button = WebMouseEvent::ButtonLeft; |
| 127 bool asPopup = false; | 122 bool asPopup = false; |
| 128 EXPECT_EQ(WebNavigationPolicyNewForegroundTab, | 123 EXPECT_EQ(WebNavigationPolicyNewForegroundTab, |
| 129 getNavigationPolicyWithMouseEvent(modifiers, button, asPopup)); | 124 getNavigationPolicyWithMouseEvent(modifiers, button, asPopup)); |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 | 249 |
| 255 TEST_F(GetNavigationPolicyTest, NotResizableForcesPopup) | 250 TEST_F(GetNavigationPolicyTest, NotResizableForcesPopup) |
| 256 { | 251 { |
| 257 m_chromeClientImpl->setResizable(false); | 252 m_chromeClientImpl->setResizable(false); |
| 258 EXPECT_TRUE(isNavigationPolicyPopup()); | 253 EXPECT_TRUE(isNavigationPolicyPopup()); |
| 259 m_chromeClientImpl->setResizable(true); | 254 m_chromeClientImpl->setResizable(true); |
| 260 EXPECT_FALSE(isNavigationPolicyPopup()); | 255 EXPECT_FALSE(isNavigationPolicyPopup()); |
| 261 } | 256 } |
| 262 | 257 |
| 263 } // namespace blink | 258 } // namespace blink |
| OLD | NEW |