| 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 } | 86 } |
| 87 | 87 |
| 88 void setUserAgentOverride(const WebString& userAgent) | 88 void setUserAgentOverride(const WebString& userAgent) |
| 89 { | 89 { |
| 90 return m_webFrameClient.setUserAgentOverride(userAgent); | 90 return m_webFrameClient.setUserAgentOverride(userAgent); |
| 91 } | 91 } |
| 92 | 92 |
| 93 const WebString userAgent() | 93 const WebString userAgent() |
| 94 { | 94 { |
| 95 // The test always returns the same user agent, regardless of the URL pa
ssed in. | 95 // The test always returns the same user agent, regardless of the URL pa
ssed in. |
| 96 WebCore::KURL dummyURL(WebCore::ParsedURLString, "about:blank"); | 96 blink::KURL dummyURL(blink::ParsedURLString, "about:blank"); |
| 97 WTF::CString userAgent = m_frameLoaderClientImpl->userAgent(dummyURL).ut
f8(); | 97 WTF::CString userAgent = m_frameLoaderClientImpl->userAgent(dummyURL).ut
f8(); |
| 98 return WebString::fromUTF8(userAgent.data(), userAgent.length()); | 98 return WebString::fromUTF8(userAgent.data(), userAgent.length()); |
| 99 } | 99 } |
| 100 | 100 |
| 101 protected: | 101 protected: |
| 102 TestWebFrameClient m_webFrameClient; | 102 TestWebFrameClient m_webFrameClient; |
| 103 FrameLoaderClientImpl* m_frameLoaderClientImpl; | 103 FrameLoaderClientImpl* m_frameLoaderClientImpl; |
| 104 WebView* m_webView; | 104 WebView* m_webView; |
| 105 WebFrame* m_mainFrame; | 105 WebFrame* m_mainFrame; |
| 106 }; | 106 }; |
| 107 | 107 |
| 108 TEST_F(FrameLoaderClientImplTest, UserAgentOverride) | 108 TEST_F(FrameLoaderClientImplTest, UserAgentOverride) |
| 109 { | 109 { |
| 110 const WebString defaultUserAgent = userAgent(); | 110 const WebString defaultUserAgent = userAgent(); |
| 111 const WebString override = WebString::fromUTF8("dummy override"); | 111 const WebString override = WebString::fromUTF8("dummy override"); |
| 112 | 112 |
| 113 // Override the user agent and make sure we get it back. | 113 // Override the user agent and make sure we get it back. |
| 114 setUserAgentOverride(override); | 114 setUserAgentOverride(override); |
| 115 EXPECT_TRUE(override.equals(userAgent())); | 115 EXPECT_TRUE(override.equals(userAgent())); |
| 116 | 116 |
| 117 // Remove the override and make sure we get the original back. | 117 // Remove the override and make sure we get the original back. |
| 118 setUserAgentOverride(WebString()); | 118 setUserAgentOverride(WebString()); |
| 119 EXPECT_TRUE(defaultUserAgent.equals(userAgent())); | 119 EXPECT_TRUE(defaultUserAgent.equals(userAgent())); |
| 120 } | 120 } |
| 121 | 121 |
| 122 } // namespace | 122 } // namespace |
| OLD | NEW |