Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / extensions / shell / common / shell_content_client_unittest.cc
blobba1540b68c20b8a613d9cdbfe4efbb5ff497c23d
1 // Copyright 2014 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 "extensions/shell/common/shell_content_client.h"
7 #include <string>
9 #include "base/strings/pattern.h"
10 #include "base/strings/string_util.h"
11 #include "testing/gtest/include/gtest/gtest.h"
13 typedef testing::Test ShellContentClientTest;
15 namespace extensions {
17 // Tests that the app_shell user agent looks like a Chrome user agent.
18 TEST_F(ShellContentClientTest, UserAgentFormat) {
19 ShellContentClient client;
20 std::string user_agent = client.GetUserAgent();
22 // Must start with the usual Mozilla-compatibility string.
23 EXPECT_TRUE(base::StartsWith(user_agent, "Mozilla/5.0",
24 base::CompareCase::INSENSITIVE_ASCII))
25 << user_agent;
27 // Must contain a substring like "Chrome/1.2.3.4".
28 EXPECT_TRUE(base::MatchPattern(user_agent, "*Chrome/*.*.*.*")) << user_agent;
31 } // namespace extensions