| 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 : FakeWebPlugin(frame, params) | 86 : FakeWebPlugin(frame, params) |
| 87 { | 87 { |
| 88 m_testClient = testClient; | 88 m_testClient = testClient; |
| 89 } | 89 } |
| 90 | 90 |
| 91 bool hasSelection() const override { return true; } | 91 bool hasSelection() const override { return true; } |
| 92 WebString selectionAsText() const override { return WebString("x"); } | 92 WebString selectionAsText() const override { return WebString("x"); } |
| 93 WebString selectionAsMarkup() const override { return WebString("y"); } | 93 WebString selectionAsMarkup() const override { return WebString("y"); } |
| 94 bool supportsPaginatedPrint() override { return true; } | 94 bool supportsPaginatedPrint() override { return true; } |
| 95 int printBegin(const WebPrintParams& printParams) override { return 1; } | 95 int printBegin(const WebPrintParams& printParams) override { return 1; } |
| 96 void printPage(int pageNumber, WebCanvas*, bool unused) override; | 96 void printPage(int pageNumber, WebCanvas*) override; |
| 97 private: | 97 private: |
| 98 TestPluginWebFrameClient* m_testClient; | 98 TestPluginWebFrameClient* m_testClient; |
| 99 }; | 99 }; |
| 100 | 100 |
| 101 class TestPluginWebFrameClient : public FrameTestHelpers::TestWebFrameClient { | 101 class TestPluginWebFrameClient : public FrameTestHelpers::TestWebFrameClient { |
| 102 WebPlugin* createPlugin(WebLocalFrame* frame, const WebPluginParams& params)
override | 102 WebPlugin* createPlugin(WebLocalFrame* frame, const WebPluginParams& params)
override |
| 103 { | 103 { |
| 104 if (params.mimeType == WebString::fromUTF8("application/x-webkit-test-we
bplugin")) | 104 if (params.mimeType == WebString::fromUTF8("application/x-webkit-test-we
bplugin")) |
| 105 return new TestPlugin(frame, params, this); | 105 return new TestPlugin(frame, params, this); |
| 106 if (params.mimeType == WebString::fromUTF8("application/pdf")) | 106 if (params.mimeType == WebString::fromUTF8("application/pdf")) |
| 107 return new TestPlugin(frame, params, this); | 107 return new TestPlugin(frame, params, this); |
| 108 return WebFrameClient::createPlugin(frame, params); | 108 return WebFrameClient::createPlugin(frame, params); |
| 109 } | 109 } |
| 110 | 110 |
| 111 public: | 111 public: |
| 112 void onPrintPage() { m_printedPage = true; } | 112 void onPrintPage() { m_printedPage = true; } |
| 113 bool printedAtLeastOnePage() { return m_printedPage; } | 113 bool printedAtLeastOnePage() { return m_printedPage; } |
| 114 | 114 |
| 115 private: | 115 private: |
| 116 bool m_printedPage = false; | 116 bool m_printedPage = false; |
| 117 }; | 117 }; |
| 118 | 118 |
| 119 void TestPlugin::printPage(int pageNumber, WebCanvas* canvas, bool unused) | 119 void TestPlugin::printPage(int pageNumber, WebCanvas* canvas) |
| 120 { | 120 { |
| 121 ASSERT(m_testClient); | 121 ASSERT(m_testClient); |
| 122 m_testClient->onPrintPage(); | 122 m_testClient->onPrintPage(); |
| 123 } | 123 } |
| 124 | 124 |
| 125 WebPluginContainer* getWebPluginContainer(WebView* webView, const WebString& id) | 125 WebPluginContainer* getWebPluginContainer(WebView* webView, const WebString& id) |
| 126 { | 126 { |
| 127 WebElement element = webView->mainFrame()->document().getElementById(id); | 127 WebElement element = webView->mainFrame()->document().getElementById(id); |
| 128 return element.pluginContainer(); | 128 return element.pluginContainer(); |
| 129 } | 129 } |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 WebRect rect = pluginContainerImpl->element().boundsInViewportSpace(); | 375 WebRect rect = pluginContainerImpl->element().boundsInViewportSpace(); |
| 376 EXPECT_TRUE(pluginContainerImpl->isRectTopmost(rect)); | 376 EXPECT_TRUE(pluginContainerImpl->isRectTopmost(rect)); |
| 377 | 377 |
| 378 // Cause the plugin's frame to be detached. | 378 // Cause the plugin's frame to be detached. |
| 379 webViewHelper.reset(); | 379 webViewHelper.reset(); |
| 380 | 380 |
| 381 EXPECT_FALSE(pluginContainerImpl->isRectTopmost(rect)); | 381 EXPECT_FALSE(pluginContainerImpl->isRectTopmost(rect)); |
| 382 } | 382 } |
| 383 | 383 |
| 384 } // namespace blink | 384 } // namespace blink |
| OLD | NEW |