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
3 // found in the LICENSE file.
5 #include "webkit/common/user_agent/user_agent.h"
9 #include "testing/gtest/include/gtest/gtest.h"
14 typedef testing::Test WebkitGlueUserAgentTest
;
16 bool IsSpoofedUserAgent(const std::string
& user_agent
) {
17 return user_agent
.find("TestContentClient") == std::string::npos
;
20 TEST_F(WebkitGlueUserAgentTest
, UserAgentSpoofingHack
) {
33 Expected expected
[] = {
34 { "http://wwww.google.com", NONE
},
35 { "http://www.microsoft.com/getsilverlight", MACOSX
},
36 { "http://downloads.yahoo.co.jp/docs/silverlight/", MACOSX
},
37 { "http://gyao.yahoo.co.jp/", MACOSX
},
38 { "http://promotion.shopping.yahoo.co.jp/", WIN
},
40 #if defined(OS_MACOSX)
48 for (size_t i
= 0; i
< ARRAYSIZE_UNSAFE(expected
); ++i
) {
49 EXPECT_EQ((expected
[i
].os_mask
& os_bit
) != 0,
51 webkit_glue::GetUserAgent(GURL(expected
[i
].url
))));