OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #import "ios/web/public/user_agent.h" | 5 #import "ios/web/public/user_agent.h" |
6 | 6 |
7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
8 | 8 |
| 9 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 10 #error "This file requires ARC support." |
| 11 #endif |
| 12 |
9 namespace web { | 13 namespace web { |
10 | 14 |
11 // Tests conversions between UserAgentType values and their descriptions | 15 // Tests conversions between UserAgentType values and their descriptions |
12 TEST(UserAgentTest, UserAgentTypeDescription) { | 16 TEST(UserAgentTest, UserAgentTypeDescription) { |
13 const std::string kMobileDescription("MOBILE"); | 17 const std::string kMobileDescription("MOBILE"); |
14 const std::string kDesktopDescription("DESKTOP"); | 18 const std::string kDesktopDescription("DESKTOP"); |
15 const std::string kNoneDescription("NONE"); | 19 const std::string kNoneDescription("NONE"); |
16 const std::string kInvalidDescription( | 20 const std::string kInvalidDescription( |
17 "not returned by GetUserAgentTypeDescription()"); | 21 "not returned by GetUserAgentTypeDescription()"); |
18 EXPECT_EQ(kMobileDescription, | 22 EXPECT_EQ(kMobileDescription, |
19 GetUserAgentTypeDescription(UserAgentType::MOBILE)); | 23 GetUserAgentTypeDescription(UserAgentType::MOBILE)); |
20 EXPECT_EQ(kDesktopDescription, | 24 EXPECT_EQ(kDesktopDescription, |
21 GetUserAgentTypeDescription(UserAgentType::DESKTOP)); | 25 GetUserAgentTypeDescription(UserAgentType::DESKTOP)); |
22 EXPECT_EQ(kNoneDescription, GetUserAgentTypeDescription(UserAgentType::NONE)); | 26 EXPECT_EQ(kNoneDescription, GetUserAgentTypeDescription(UserAgentType::NONE)); |
23 EXPECT_EQ(UserAgentType::MOBILE, | 27 EXPECT_EQ(UserAgentType::MOBILE, |
24 GetUserAgentTypeWithDescription(kMobileDescription)); | 28 GetUserAgentTypeWithDescription(kMobileDescription)); |
25 EXPECT_EQ(UserAgentType::DESKTOP, | 29 EXPECT_EQ(UserAgentType::DESKTOP, |
26 GetUserAgentTypeWithDescription(kDesktopDescription)); | 30 GetUserAgentTypeWithDescription(kDesktopDescription)); |
27 EXPECT_EQ(UserAgentType::NONE, | 31 EXPECT_EQ(UserAgentType::NONE, |
28 GetUserAgentTypeWithDescription(kNoneDescription)); | 32 GetUserAgentTypeWithDescription(kNoneDescription)); |
29 EXPECT_EQ(UserAgentType::NONE, | 33 EXPECT_EQ(UserAgentType::NONE, |
30 GetUserAgentTypeWithDescription(kInvalidDescription)); | 34 GetUserAgentTypeWithDescription(kInvalidDescription)); |
31 } | 35 } |
32 | 36 |
33 } // namespace web | 37 } // namespace web |
OLD | NEW |