| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 29 matching lines...) Expand all Loading... |
| 40 #include "public/web/WebRemoteFrameClient.h" | 40 #include "public/web/WebRemoteFrameClient.h" |
| 41 #include "public/web/WebViewClient.h" | 41 #include "public/web/WebViewClient.h" |
| 42 #include "web/WebViewImpl.h" | 42 #include "web/WebViewImpl.h" |
| 43 #include "wtf/PassOwnPtr.h" | 43 #include "wtf/PassOwnPtr.h" |
| 44 #include <gmock/gmock.h> | 44 #include <gmock/gmock.h> |
| 45 #include <gtest/gtest.h> | 45 #include <gtest/gtest.h> |
| 46 #include <string> | 46 #include <string> |
| 47 | 47 |
| 48 namespace blink { | 48 namespace blink { |
| 49 | 49 |
| 50 class WebRemoteFrameImpl; |
| 51 |
| 50 namespace FrameTestHelpers { | 52 namespace FrameTestHelpers { |
| 51 | 53 |
| 52 class TestWebFrameClient; | 54 class TestWebFrameClient; |
| 53 | 55 |
| 54 // Loads a url into the specified WebFrame for testing purposes. Pumps any | 56 // Loads a url into the specified WebFrame for testing purposes. Pumps any |
| 55 // pending resource requests, as well as waiting for the threaded parser to | 57 // pending resource requests, as well as waiting for the threaded parser to |
| 56 // finish, before returning. | 58 // finish, before returning. |
| 57 void loadFrame(WebFrame*, const std::string& url); | 59 void loadFrame(WebFrame*, const std::string& url); |
| 58 // Same as above, but for WebFrame::loadHTMLString(). | 60 // Same as above, but for WebFrame::loadHTMLString(). |
| 59 void loadHTMLString(WebFrame*, const std::string& html, const WebURL& baseURL); | 61 void loadHTMLString(WebFrame*, const std::string& html, const WebURL& baseURL); |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 private: | 145 private: |
| 144 int m_loadsInProgress; | 146 int m_loadsInProgress; |
| 145 }; | 147 }; |
| 146 | 148 |
| 147 // Minimal implementation of WebRemoteFrameClient needed for unit tests that loa
d remote frames. Tests that load | 149 // Minimal implementation of WebRemoteFrameClient needed for unit tests that loa
d remote frames. Tests that load |
| 148 // frames and need further specialization of WebFrameClient behavior should subc
lass this. | 150 // frames and need further specialization of WebFrameClient behavior should subc
lass this. |
| 149 class TestWebRemoteFrameClient : public WebRemoteFrameClient { | 151 class TestWebRemoteFrameClient : public WebRemoteFrameClient { |
| 150 public: | 152 public: |
| 151 TestWebRemoteFrameClient(); | 153 TestWebRemoteFrameClient(); |
| 152 | 154 |
| 153 WebRemoteFrame* frame() const { return m_frame; } | 155 WebRemoteFrameImpl* frame() const { return m_frame; } |
| 154 | 156 |
| 155 // WebRemoteFrameClient overrides: | 157 // WebRemoteFrameClient overrides: |
| 156 void frameDetached(DetachType) override; | 158 void frameDetached(DetachType) override; |
| 157 void postMessageEvent( | 159 void postMessageEvent( |
| 158 WebLocalFrame* sourceFrame, | 160 WebLocalFrame* sourceFrame, |
| 159 WebRemoteFrame* targetFrame, | 161 WebRemoteFrame* targetFrame, |
| 160 WebSecurityOrigin targetOrigin, | 162 WebSecurityOrigin targetOrigin, |
| 161 WebDOMMessageEvent) override { } | 163 WebDOMMessageEvent) override { } |
| 162 | 164 |
| 163 private: | 165 private: |
| 164 WebRemoteFrame* const m_frame; | 166 WebRemoteFrameImpl* const m_frame; |
| 165 }; | 167 }; |
| 166 | 168 |
| 167 class TestWebViewClient : public WebViewClient { | 169 class TestWebViewClient : public WebViewClient { |
| 168 public: | 170 public: |
| 169 virtual ~TestWebViewClient() { } | 171 virtual ~TestWebViewClient() { } |
| 170 void initializeLayerTreeView() override; | 172 void initializeLayerTreeView() override; |
| 171 WebLayerTreeView* layerTreeView() override { return m_layerTreeView.get(); } | 173 WebLayerTreeView* layerTreeView() override { return m_layerTreeView.get(); } |
| 172 | 174 |
| 173 private: | 175 private: |
| 174 OwnPtr<WebLayerTreeView> m_layerTreeView; | 176 OwnPtr<WebLayerTreeView> m_layerTreeView; |
| 175 }; | 177 }; |
| 176 | 178 |
| 177 } // namespace FrameTestHelpers | 179 } // namespace FrameTestHelpers |
| 178 } // namespace blink | 180 } // namespace blink |
| 179 | 181 |
| 180 #endif // FrameTestHelpers_h | 182 #endif // FrameTestHelpers_h |
| OLD | NEW |