OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "base/basictypes.h" | |
6 #include "net/cookies/cookie_constants.h" | |
7 #include "testing/gtest/include/gtest/gtest.h" | |
8 | |
9 namespace net { | |
10 | |
11 namespace { | |
12 | |
13 class CookieConstantsTest : public testing::Test { }; | |
erikwright (departed)
2013/04/16 20:25:55
This declaration has no effect and can be removed.
huangs
2013/04/16 20:33:41
Done. Also removed for ParsedCookieTest, which ha
| |
14 | |
15 } // namespace | |
16 | |
17 TEST(CookieConstantsTest, TestCookiePriority) { | |
18 // Basic cases. | |
19 EXPECT_EQ("low", CookiePriorityToString(PRIORITY_LOW)); | |
20 EXPECT_EQ("medium", CookiePriorityToString(PRIORITY_MEDIUM)); | |
21 EXPECT_EQ("high", CookiePriorityToString(PRIORITY_HIGH)); | |
22 | |
23 EXPECT_EQ(PRIORITY_LOW, StringToCookiePriority("low")); | |
24 EXPECT_EQ(PRIORITY_MEDIUM, StringToCookiePriority("medium")); | |
25 EXPECT_EQ(PRIORITY_HIGH, StringToCookiePriority("high")); | |
26 | |
27 // Case Insensitivity of StringToCookiePriority(). | |
28 EXPECT_EQ(PRIORITY_LOW, StringToCookiePriority("LOW")); | |
29 EXPECT_EQ(PRIORITY_MEDIUM, StringToCookiePriority("Medium")); | |
30 EXPECT_EQ(PRIORITY_HIGH, StringToCookiePriority("hiGH")); | |
31 | |
32 // Value of default priority. | |
33 EXPECT_EQ(PRIORITY_DEFAULT, PRIORITY_MEDIUM); | |
34 | |
35 // Numeric values. | |
36 EXPECT_LT(PRIORITY_LOW, PRIORITY_MEDIUM); | |
37 EXPECT_LT(PRIORITY_MEDIUM, PRIORITY_HIGH); | |
38 | |
39 // Unrecognized tokens are interpreted as PRIORITY_DEFAULT. | |
40 char* bad_tokens[] = {"", "lo", "lowerest", "high ", " high", "0"}; | |
41 for (int i = 0; i < arraysize(bad_tokens); ++i) { | |
42 EXPECT_EQ(PRIORITY_DEFAULT, StringToCookiePriority(bad_tokens[i])); | |
43 } | |
44 } | |
45 | |
46 } // namespace net | |
OLD | NEW |