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

Side by Side Diff: net/cookies/cookie_constants_unittest.cc

Issue 14113014: Adding Priority field to cookies. (Closed) Base URL: http://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync. Created 7 years, 8 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 unified diff | Download patch
OLDNEW
(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 TEST(CookieConstantsTest, TestCookiePriority) {
12 // Basic cases.
13 EXPECT_EQ("low", CookiePriorityToString(PRIORITY_LOW));
14 EXPECT_EQ("medium", CookiePriorityToString(PRIORITY_MEDIUM));
15 EXPECT_EQ("high", CookiePriorityToString(PRIORITY_HIGH));
16
17 EXPECT_EQ(PRIORITY_LOW, StringToCookiePriority("low"));
18 EXPECT_EQ(PRIORITY_MEDIUM, StringToCookiePriority("medium"));
19 EXPECT_EQ(PRIORITY_HIGH, StringToCookiePriority("high"));
20
21 // Case Insensitivity of StringToCookiePriority().
22 EXPECT_EQ(PRIORITY_LOW, StringToCookiePriority("LOW"));
23 EXPECT_EQ(PRIORITY_MEDIUM, StringToCookiePriority("Medium"));
24 EXPECT_EQ(PRIORITY_HIGH, StringToCookiePriority("hiGH"));
25
26 // Value of default priority.
27 EXPECT_EQ(PRIORITY_DEFAULT, PRIORITY_MEDIUM);
28
29 // Numeric values.
30 EXPECT_LT(PRIORITY_LOW, PRIORITY_MEDIUM);
31 EXPECT_LT(PRIORITY_MEDIUM, PRIORITY_HIGH);
32
33 // Unrecognized tokens are interpreted as PRIORITY_DEFAULT.
34 const char* bad_tokens[] = {"", "lo", "lowerest", "high ", " high", "0"};
35 for (size_t i = 0; i < arraysize(bad_tokens); ++i) {
36 EXPECT_EQ(PRIORITY_DEFAULT, StringToCookiePriority(bad_tokens[i]));
37 }
38 }
39
40 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698