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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 #include "wtf/text/WTFString.h" | 43 #include "wtf/text/WTFString.h" |
44 | 44 |
45 #include <gtest/gtest.h> | 45 #include <gtest/gtest.h> |
46 | 46 |
47 using namespace blink; | 47 using namespace blink; |
48 | 48 |
49 namespace { | 49 namespace { |
50 | 50 |
51 class TestWebFrameClient : public WebFrameClient { | 51 class TestWebFrameClient : public WebFrameClient { |
52 public: | 52 public: |
53 WebString userAgentOverride(WebLocalFrame* frame, const WebURL& url) OVERRID
E | 53 WebString userAgentOverride(WebLocalFrame* frame, const WebURL& url) overrid
e |
54 { | 54 { |
55 if (m_userAgentOverride.isEmpty()) | 55 if (m_userAgentOverride.isEmpty()) |
56 return WebString(); | 56 return WebString(); |
57 | 57 |
58 return m_userAgentOverride; | 58 return m_userAgentOverride; |
59 } | 59 } |
60 | 60 |
61 void setUserAgentOverride(const WebString& userAgent) | 61 void setUserAgentOverride(const WebString& userAgent) |
62 { | 62 { |
63 m_userAgentOverride = userAgent; | 63 m_userAgentOverride = userAgent; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 // Override the user agent and make sure we get it back. | 115 // Override the user agent and make sure we get it back. |
116 setUserAgentOverride(override); | 116 setUserAgentOverride(override); |
117 EXPECT_TRUE(override.equals(userAgent())); | 117 EXPECT_TRUE(override.equals(userAgent())); |
118 | 118 |
119 // Remove the override and make sure we get the original back. | 119 // Remove the override and make sure we get the original back. |
120 setUserAgentOverride(WebString()); | 120 setUserAgentOverride(WebString()); |
121 EXPECT_TRUE(defaultUserAgent.equals(userAgent())); | 121 EXPECT_TRUE(defaultUserAgent.equals(userAgent())); |
122 } | 122 } |
123 | 123 |
124 } // namespace | 124 } // namespace |
OLD | NEW |