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

Unified Diff: ios/web/public/user_agent_unittest.mm

Issue 2705293014: Created web::UserAgentType. (Closed)
Patch Set: rebase + compile fix Created 3 years, 10 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 | « ios/web/public/user_agent.mm ('k') | ios/web/public/web_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/web/public/user_agent_unittest.mm
diff --git a/ios/web/public/user_agent_unittest.mm b/ios/web/public/user_agent_unittest.mm
new file mode 100644
index 0000000000000000000000000000000000000000..04cbc1c27b56fca1cff06bed09311fc1f2544677
--- /dev/null
+++ b/ios/web/public/user_agent_unittest.mm
@@ -0,0 +1,33 @@
+// Copyright 2017 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.
+
+#import "ios/web/public/user_agent.h"
+
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace web {
+
+// Tests conversions between UserAgentType values and their descriptions
+TEST(UserAgentTest, UserAgentTypeDescription) {
+ const std::string kMobileDescription("MOBILE");
+ const std::string kDesktopDescription("DESKTOP");
+ const std::string kNoneDescription("NONE");
+ const std::string kInvalidDescription(
+ "not returned by GetUserAgentTypeDescription()");
+ EXPECT_EQ(kMobileDescription,
+ GetUserAgentTypeDescription(UserAgentType::MOBILE));
+ EXPECT_EQ(kDesktopDescription,
+ GetUserAgentTypeDescription(UserAgentType::DESKTOP));
+ EXPECT_EQ(kNoneDescription, GetUserAgentTypeDescription(UserAgentType::NONE));
+ EXPECT_EQ(UserAgentType::MOBILE,
+ GetUserAgentTypeWithDescription(kMobileDescription));
+ EXPECT_EQ(UserAgentType::DESKTOP,
+ GetUserAgentTypeWithDescription(kDesktopDescription));
+ EXPECT_EQ(UserAgentType::NONE,
+ GetUserAgentTypeWithDescription(kNoneDescription));
+ EXPECT_EQ(UserAgentType::NONE,
+ GetUserAgentTypeWithDescription(kInvalidDescription));
+}
+
+} // namespace web
« no previous file with comments | « ios/web/public/user_agent.mm ('k') | ios/web/public/web_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698