OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #include "base/test/expectations/expectation.h" | 5 #include "base/test/expectations/expectation.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 | 9 |
10 TEST(TestExpectationsFunctionsTest, ResultFromString) { | 10 TEST(TestExpectationsFunctionsTest, ResultFromString) { |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 EXPECT_EQ("", platform.variant); | 64 EXPECT_EQ("", platform.variant); |
65 | 65 |
66 EXPECT_TRUE(PlatformFromString("Linux-", &platform)); | 66 EXPECT_TRUE(PlatformFromString("Linux-", &platform)); |
67 EXPECT_EQ("Linux", platform.name); | 67 EXPECT_EQ("Linux", platform.name); |
68 EXPECT_EQ("", platform.variant); | 68 EXPECT_EQ("", platform.variant); |
69 | 69 |
70 EXPECT_FALSE(PlatformFromString("", &platform)); | 70 EXPECT_FALSE(PlatformFromString("", &platform)); |
71 } | 71 } |
72 | 72 |
73 TEST(TestExpectationsFunctionsTest, IsValidPlatform) { | 73 TEST(TestExpectationsFunctionsTest, IsValidPlatform) { |
74 const char* kValidPlatforms[] = { | 74 const char* const kValidPlatforms[] = { |
75 "Win", | 75 "Win", |
76 "Win-XP", | 76 "Win-XP", |
77 "Win-Vista", | 77 "Win-Vista", |
78 "Win-7", | 78 "Win-7", |
79 "Win-8", | 79 "Win-8", |
80 "Mac", | 80 "Mac", |
81 "Mac-10.6", | 81 "Mac-10.6", |
82 "Mac-10.7", | 82 "Mac-10.7", |
83 "Mac-10.8", | 83 "Mac-10.8", |
84 "Linux", | 84 "Linux", |
85 "Linux-32", | 85 "Linux-32", |
86 "Linux-64", | 86 "Linux-64", |
87 "ChromeOS", | 87 "ChromeOS", |
88 "iOS", | 88 "iOS", |
89 "Android", | 89 "Android", |
90 }; | 90 }; |
91 | 91 |
92 const char* kInvalidPlatforms[] = { | 92 const char* const kInvalidPlatforms[] = { |
93 "Solaris", | 93 "Solaris", |
94 "Plan9", | 94 "Plan9", |
95 }; | 95 }; |
96 | 96 |
97 for (size_t i = 0; i < arraysize(kValidPlatforms); ++i) { | 97 for (size_t i = 0; i < arraysize(kValidPlatforms); ++i) { |
98 test_expectations::Platform platform; | 98 test_expectations::Platform platform; |
99 EXPECT_TRUE(test_expectations::PlatformFromString( | 99 EXPECT_TRUE(test_expectations::PlatformFromString( |
100 kValidPlatforms[i], &platform)) << kValidPlatforms[i]; | 100 kValidPlatforms[i], &platform)) << kValidPlatforms[i]; |
101 } | 101 } |
102 | 102 |
103 for (size_t i = 0; i < arraysize(kInvalidPlatforms); ++i) { | 103 for (size_t i = 0; i < arraysize(kInvalidPlatforms); ++i) { |
104 test_expectations::Platform platform; | 104 test_expectations::Platform platform; |
105 EXPECT_FALSE(test_expectations::PlatformFromString( | 105 EXPECT_FALSE(test_expectations::PlatformFromString( |
106 kInvalidPlatforms[i], &platform)) << kInvalidPlatforms[i]; | 106 kInvalidPlatforms[i], &platform)) << kInvalidPlatforms[i]; |
107 } | 107 } |
108 } | 108 } |
109 | 109 |
110 TEST(TestExpectationsFunctionsTest, CurrentPlatform) { | 110 TEST(TestExpectationsFunctionsTest, CurrentPlatform) { |
111 test_expectations::Platform current = | 111 test_expectations::Platform current = |
112 test_expectations::GetCurrentPlatform(); | 112 test_expectations::GetCurrentPlatform(); |
113 EXPECT_FALSE(current.name.empty()); | 113 EXPECT_FALSE(current.name.empty()); |
114 } | 114 } |
115 | 115 |
116 TEST(TestExpectationsFunctionsTest, CurrentConfiguration) { | 116 TEST(TestExpectationsFunctionsTest, CurrentConfiguration) { |
117 test_expectations::Configuration current = | 117 test_expectations::Configuration current = |
118 test_expectations::GetCurrentConfiguration(); | 118 test_expectations::GetCurrentConfiguration(); |
119 EXPECT_NE(test_expectations::CONFIGURATION_UNSPECIFIED, current); | 119 EXPECT_NE(test_expectations::CONFIGURATION_UNSPECIFIED, current); |
120 } | 120 } |
OLD | NEW |