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 |