| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 void TearDown() override | 79 void TearDown() override |
| 80 { | 80 { |
| 81 m_webView->close(); | 81 m_webView->close(); |
| 82 m_mainFrame->close(); | 82 m_mainFrame->close(); |
| 83 } | 83 } |
| 84 | 84 |
| 85 WebString userAgent() | 85 WebString userAgent() |
| 86 { | 86 { |
| 87 // The test always returns the same user agent, regardless of the URL pa
ssed in. | 87 // The test always returns the same user agent, regardless of the URL pa
ssed in. |
| 88 KURL dummyURL(ParsedURLString, "about:blank"); | 88 KURL dummyURL(ParsedURLString, "about:blank"); |
| 89 WTF::CString userAgent = frameLoaderClientImpl().userAgent(dummyURL).utf
8(); | 89 WTF::CString userAgent = frameLoaderClient().userAgent(dummyURL).utf8(); |
| 90 return WebString::fromUTF8(userAgent.data(), userAgent.length()); | 90 return WebString::fromUTF8(userAgent.data(), userAgent.length()); |
| 91 } | 91 } |
| 92 | 92 |
| 93 WebLocalFrameImpl* mainFrame() { return toWebLocalFrameImpl(m_webView->mainF
rame()); } | 93 WebLocalFrameImpl* mainFrame() { return toWebLocalFrameImpl(m_webView->mainF
rame()); } |
| 94 Document& document() { return *toWebLocalFrameImpl(m_mainFrame)->frame()->do
cument(); } | 94 Document& document() { return *toWebLocalFrameImpl(m_mainFrame)->frame()->do
cument(); } |
| 95 MockWebFrameClient& webFrameClient() { return m_webFrameClient; } | 95 MockWebFrameClient& webFrameClient() { return m_webFrameClient; } |
| 96 FrameLoaderClient& frameLoaderClient() { return frameLoaderClientImpl(); } | 96 FrameLoaderClient& frameLoaderClient() { return *toFrameLoaderClientImpl(toW
ebLocalFrameImpl(m_webView->mainFrame())->frame()->loader().client()); } |
| 97 FrameLoaderClientImpl& frameLoaderClientImpl() { return *toFrameLoaderClient
Impl(toWebLocalFrameImpl(m_webView->mainFrame())->frame()->loader().client()); } | |
| 98 | 97 |
| 99 private: | 98 private: |
| 100 MockWebFrameClient m_webFrameClient; | 99 MockWebFrameClient m_webFrameClient; |
| 101 WebView* m_webView; | 100 WebView* m_webView; |
| 102 WebFrame* m_mainFrame; | 101 WebFrame* m_mainFrame; |
| 103 }; | 102 }; |
| 104 | 103 |
| 105 TEST_F(FrameLoaderClientImplTest, UserAgentOverride) | 104 TEST_F(FrameLoaderClientImplTest, UserAgentOverride) |
| 106 { | 105 { |
| 107 const WebString defaultUserAgent = userAgent(); | 106 const WebString defaultUserAgent = userAgent(); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 EXPECT_CALL(webFrameClient(), createPluginPlaceholder(mainFrame(), _)) | 140 EXPECT_CALL(webFrameClient(), createPluginPlaceholder(mainFrame(), _)) |
| 142 .WillOnce(Return(nullptr)); | 141 .WillOnce(Return(nullptr)); |
| 143 OwnPtrWillBeRawPtr<PluginPlaceholder> pluginPlaceholder = frameLoaderCli
ent().createPluginPlaceholder( | 142 OwnPtrWillBeRawPtr<PluginPlaceholder> pluginPlaceholder = frameLoaderCli
ent().createPluginPlaceholder( |
| 144 document(), url, paramNames, paramValues, mimeType, loadManually); | 143 document(), url, paramNames, paramValues, mimeType, loadManually); |
| 145 ASSERT_FALSE(pluginPlaceholder); | 144 ASSERT_FALSE(pluginPlaceholder); |
| 146 } | 145 } |
| 147 } | 146 } |
| 148 | 147 |
| 149 } // namespace | 148 } // namespace |
| 150 } // namespace blink | 149 } // namespace blink |
| OLD | NEW |