| 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/common/user_agent/user_agent.h" | 5 #include "webkit/common/user_agent/user_agent.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "googleurl/src/gurl.h" | |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 #include "url/gurl.h" |
| 11 | 11 |
| 12 namespace { | 12 namespace { |
| 13 | 13 |
| 14 typedef testing::Test WebkitGlueUserAgentTest; | 14 typedef testing::Test WebkitGlueUserAgentTest; |
| 15 | 15 |
| 16 bool IsSpoofedUserAgent(const std::string& user_agent) { | 16 bool IsSpoofedUserAgent(const std::string& user_agent) { |
| 17 return user_agent.find("TestContentClient") == std::string::npos; | 17 return user_agent.find("TestContentClient") == std::string::npos; |
| 18 } | 18 } |
| 19 | 19 |
| 20 TEST_F(WebkitGlueUserAgentTest, UserAgentSpoofingHack) { | 20 TEST_F(WebkitGlueUserAgentTest, UserAgentSpoofingHack) { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 46 #endif | 46 #endif |
| 47 | 47 |
| 48 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(expected); ++i) { | 48 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(expected); ++i) { |
| 49 EXPECT_EQ((expected[i].os_mask & os_bit) != 0, | 49 EXPECT_EQ((expected[i].os_mask & os_bit) != 0, |
| 50 IsSpoofedUserAgent( | 50 IsSpoofedUserAgent( |
| 51 webkit_glue::GetUserAgent(GURL(expected[i].url)))); | 51 webkit_glue::GetUserAgent(GURL(expected[i].url)))); |
| 52 } | 52 } |
| 53 } | 53 } |
| 54 | 54 |
| 55 } // namespace | 55 } // namespace |
| OLD | NEW |