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

Side by Side Diff: rlz/lib/lib_values_unittest.cc

Issue 239053004: Use invalid value for GetAccessPointName for CHROME_IOS_RESERVED (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adding unittests Created 6 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
« no previous file with comments | « rlz/lib/lib_values.cc ('k') | rlz/lib/rlz_lib.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "rlz/lib/lib_values.h" 5 #include "rlz/lib/lib_values.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "rlz/lib/assert.h" 8 #include "rlz/lib/assert.h"
9 #include "testing/gmock/include/gmock/gmock.h" 9 #include "testing/gmock/include/gmock/gmock.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 14 matching lines...) Expand all
25 EXPECT_EQ(rlz_lib::NO_ACCESS_POINT, point); 25 EXPECT_EQ(rlz_lib::NO_ACCESS_POINT, point);
26 26
27 EXPECT_TRUE(rlz_lib::GetAccessPointFromName("I7", &point)); 27 EXPECT_TRUE(rlz_lib::GetAccessPointFromName("I7", &point));
28 EXPECT_EQ(rlz_lib::IE_DEFAULT_SEARCH, point); 28 EXPECT_EQ(rlz_lib::IE_DEFAULT_SEARCH, point);
29 29
30 EXPECT_TRUE(rlz_lib::GetAccessPointFromName("T4", &point)); 30 EXPECT_TRUE(rlz_lib::GetAccessPointFromName("T4", &point));
31 EXPECT_EQ(rlz_lib::IETB_SEARCH_BOX, point); 31 EXPECT_EQ(rlz_lib::IETB_SEARCH_BOX, point);
32 32
33 EXPECT_FALSE(rlz_lib::GetAccessPointFromName("T4 ", &point)); 33 EXPECT_FALSE(rlz_lib::GetAccessPointFromName("T4 ", &point));
34 EXPECT_EQ(rlz_lib::NO_ACCESS_POINT, point); 34 EXPECT_EQ(rlz_lib::NO_ACCESS_POINT, point);
35
36 for (int ap = rlz_lib::NO_ACCESS_POINT + 1;
37 ap < rlz_lib::LAST_ACCESS_POINT; ++ap) {
38 rlz_lib::AccessPoint point = static_cast<rlz_lib::AccessPoint>(ap);
39 EXPECT_TRUE(GetAccessPointName(point) != NULL);
40 }
35 } 41 }
36 42
37
38 TEST(LibValuesUnittest, GetEventFromName) { 43 TEST(LibValuesUnittest, GetEventFromName) {
39 rlz_lib::SetExpectedAssertion("GetEventFromName: event is NULL"); 44 rlz_lib::SetExpectedAssertion("GetEventFromName: event is NULL");
40 EXPECT_FALSE(rlz_lib::GetEventFromName("", NULL)); 45 EXPECT_FALSE(rlz_lib::GetEventFromName("", NULL));
41 rlz_lib::SetExpectedAssertion(""); 46 rlz_lib::SetExpectedAssertion("");
42 47
43 rlz_lib::Event event; 48 rlz_lib::Event event;
44 EXPECT_FALSE(rlz_lib::GetEventFromName(NULL, &event)); 49 EXPECT_FALSE(rlz_lib::GetEventFromName(NULL, &event));
45 EXPECT_EQ(rlz_lib::INVALID_EVENT, event); 50 EXPECT_EQ(rlz_lib::INVALID_EVENT, event);
46 51
47 EXPECT_TRUE(rlz_lib::GetEventFromName("", &event)); 52 EXPECT_TRUE(rlz_lib::GetEventFromName("", &event));
48 EXPECT_EQ(rlz_lib::INVALID_EVENT, event); 53 EXPECT_EQ(rlz_lib::INVALID_EVENT, event);
49 54
50 EXPECT_FALSE(rlz_lib::GetEventFromName("i1", &event)); 55 EXPECT_FALSE(rlz_lib::GetEventFromName("i1", &event));
51 EXPECT_EQ(rlz_lib::INVALID_EVENT, event); 56 EXPECT_EQ(rlz_lib::INVALID_EVENT, event);
52 57
53 EXPECT_TRUE(rlz_lib::GetEventFromName("I", &event)); 58 EXPECT_TRUE(rlz_lib::GetEventFromName("I", &event));
54 EXPECT_EQ(rlz_lib::INSTALL, event); 59 EXPECT_EQ(rlz_lib::INSTALL, event);
55 60
56 EXPECT_TRUE(rlz_lib::GetEventFromName("F", &event)); 61 EXPECT_TRUE(rlz_lib::GetEventFromName("F", &event));
57 EXPECT_EQ(rlz_lib::FIRST_SEARCH, event); 62 EXPECT_EQ(rlz_lib::FIRST_SEARCH, event);
58 63
59 EXPECT_FALSE(rlz_lib::GetEventFromName("F ", &event)); 64 EXPECT_FALSE(rlz_lib::GetEventFromName("F ", &event));
60 EXPECT_EQ(rlz_lib::INVALID_EVENT, event); 65 EXPECT_EQ(rlz_lib::INVALID_EVENT, event);
61 } 66 }
OLDNEW
« no previous file with comments | « rlz/lib/lib_values.cc ('k') | rlz/lib/rlz_lib.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698