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/user_agent/user_agent.h"
9 #include "googleurl/src/gurl.h"
10 #include "testing/gtest/include/gtest/gtest.h"
11 #include "webkit/tools/test_shell/test_shell_test.h"
15 class WebkitGlueUserAgentTest
: public TestShellTest
{
18 bool IsSpoofedUserAgent(const std::string
& user_agent
) {
19 return user_agent
.find("TestShell") == std::string::npos
;
22 TEST_F(WebkitGlueUserAgentTest
, UserAgentSpoofingHack
) {
35 Expected expected
[] = {
36 { "http://wwww.google.com", NONE
},
37 { "http://www.microsoft.com/getsilverlight", MACOSX
},
38 { "http://headlines.yahoo.co.jp/videonews/", MACOSX
| WIN
},
39 { "http://downloads.yahoo.co.jp/docs/silverlight/", MACOSX
},
40 { "http://gyao.yahoo.co.jp/", MACOSX
},
41 { "http://weather.yahoo.co.jp/weather/zoomradar/", WIN
},
42 { "http://promotion.shopping.yahoo.co.jp/", WIN
},
43 { "http://pokemon.kids.yahoo.co.jp", WIN
},
45 #if defined(OS_MACOSX)
53 for (size_t i
= 0; i
< ARRAYSIZE_UNSAFE(expected
); ++i
) {
54 EXPECT_EQ((expected
[i
].os_mask
& os_bit
) != 0,
56 webkit_glue::GetUserAgent(GURL(expected
[i
].url
))));