OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "webkit/user_agent/user_agent.h" | 5 #include "webkit/user_agent/user_agent.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "googleurl/src/gurl.h" | 9 #include "googleurl/src/gurl.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
11 #include "webkit/tools/test_shell/test_shell_test.h" | |
12 | 11 |
13 namespace { | 12 namespace { |
14 | 13 |
15 class WebkitGlueUserAgentTest : public TestShellTest { | 14 typedef testing::Test WebkitGlueUserAgentTest; |
16 }; | |
17 | 15 |
18 bool IsSpoofedUserAgent(const std::string& user_agent) { | 16 bool IsSpoofedUserAgent(const std::string& user_agent) { |
19 return user_agent.find("TestShell") == std::string::npos; | 17 return user_agent.find("TestContentClient") == std::string::npos; |
20 } | 18 } |
21 | 19 |
22 TEST_F(WebkitGlueUserAgentTest, UserAgentSpoofingHack) { | 20 TEST_F(WebkitGlueUserAgentTest, UserAgentSpoofingHack) { |
23 enum Platform { | 21 enum Platform { |
24 NONE = 0, | 22 NONE = 0, |
25 MACOSX = 1, | 23 MACOSX = 1, |
26 WIN = 2, | 24 WIN = 2, |
27 OTHER = 4, | 25 OTHER = 4, |
28 }; | 26 }; |
29 | 27 |
(...skipping 18 matching lines...) Expand all Loading... |
48 #endif | 46 #endif |
49 | 47 |
50 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(expected); ++i) { | 48 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(expected); ++i) { |
51 EXPECT_EQ((expected[i].os_mask & os_bit) != 0, | 49 EXPECT_EQ((expected[i].os_mask & os_bit) != 0, |
52 IsSpoofedUserAgent( | 50 IsSpoofedUserAgent( |
53 webkit_glue::GetUserAgent(GURL(expected[i].url)))); | 51 webkit_glue::GetUserAgent(GURL(expected[i].url)))); |
54 } | 52 } |
55 } | 53 } |
56 | 54 |
57 } // namespace | 55 } // namespace |
OLD | NEW |