Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(134)

Unified Diff: extensions/shell/common/shell_content_client_unittest.cc

Issue 505403003: app_shell: Add version number in user agent (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « extensions/shell/common/shell_content_client.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/shell/common/shell_content_client_unittest.cc
diff --git a/extensions/shell/common/shell_content_client_unittest.cc b/extensions/shell/common/shell_content_client_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..237d2dc9d29b06f57459fcaf6dc70aefb4ccf991
--- /dev/null
+++ b/extensions/shell/common/shell_content_client_unittest.cc
@@ -0,0 +1,28 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "extensions/shell/common/shell_content_client.h"
+
+#include <string>
+
+#include "base/strings/string_util.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+typedef testing::Test ShellContentClientTest;
+
+namespace extensions {
+
+// Tests that the app_shell user agent looks like a Chrome user agent.
+TEST_F(ShellContentClientTest, UserAgentFormat) {
+ ShellContentClient client;
+ std::string user_agent = client.GetUserAgent();
+
+ // Must start with the usual Mozilla-compatibility string.
+ EXPECT_TRUE(StartsWithASCII(user_agent, "Mozilla/5.0", false)) << user_agent;
+
+ // Must contain a substring like "Chrome/1.2.3.4".
+ EXPECT_TRUE(MatchPattern(user_agent, "*Chrome/*.*.*.*")) << user_agent;
+}
+
+} // namespace extensions
« no previous file with comments | « extensions/shell/common/shell_content_client.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698