summaryrefslogtreecommitdiffstats
path: root/rlz/lib/lib_values_unittest.cc
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-21 14:10:52 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-21 14:10:52 +0000
commit0a5e34a5386fa254a3b133f0a5f7667f1f790f67 (patch)
treed1dd0e80264f900004c56ad5ce6b56efea0bec49 /rlz/lib/lib_values_unittest.cc
parentb049c382ff842f546e2bcc261ce23438bc8764bf (diff)
downloadchromium_src-0a5e34a5386fa254a3b133f0a5f7667f1f790f67.zip
chromium_src-0a5e34a5386fa254a3b133f0a5f7667f1f790f67.tar.gz
chromium_src-0a5e34a5386fa254a3b133f0a5f7667f1f790f67.tar.bz2
Check-in rlz code to src\rlz from http://code.google.com/p/rlz/.
Review URL: https://chromiumcodereview.appspot.com/10597002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@143381 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'rlz/lib/lib_values_unittest.cc')
-rw-r--r--rlz/lib/lib_values_unittest.cc61
1 files changed, 61 insertions, 0 deletions
diff --git a/rlz/lib/lib_values_unittest.cc b/rlz/lib/lib_values_unittest.cc
new file mode 100644
index 0000000..7e8fa83
--- /dev/null
+++ b/rlz/lib/lib_values_unittest.cc
@@ -0,0 +1,61 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "rlz/lib/lib_values.h"
+
+#include "base/logging.h"
+#include "rlz/lib/assert.h"
+#include "testing/gmock/include/gmock/gmock.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+TEST(LibValuesUnittest, GetAccessPointFromName) {
+ rlz_lib::SetExpectedAssertion("GetAccessPointFromName: point is NULL");
+ EXPECT_FALSE(rlz_lib::GetAccessPointFromName("", NULL));
+ rlz_lib::SetExpectedAssertion("");
+
+ rlz_lib::AccessPoint point;
+ EXPECT_FALSE(rlz_lib::GetAccessPointFromName(NULL, &point));
+ EXPECT_EQ(rlz_lib::NO_ACCESS_POINT, point);
+
+ EXPECT_TRUE(rlz_lib::GetAccessPointFromName("", &point));
+ EXPECT_EQ(rlz_lib::NO_ACCESS_POINT, point);
+
+ EXPECT_FALSE(rlz_lib::GetAccessPointFromName("i1", &point));
+ EXPECT_EQ(rlz_lib::NO_ACCESS_POINT, point);
+
+ EXPECT_TRUE(rlz_lib::GetAccessPointFromName("I7", &point));
+ EXPECT_EQ(rlz_lib::IE_DEFAULT_SEARCH, point);
+
+ EXPECT_TRUE(rlz_lib::GetAccessPointFromName("T4", &point));
+ EXPECT_EQ(rlz_lib::IETB_SEARCH_BOX, point);
+
+ EXPECT_FALSE(rlz_lib::GetAccessPointFromName("T4 ", &point));
+ EXPECT_EQ(rlz_lib::NO_ACCESS_POINT, point);
+}
+
+
+TEST(LibValuesUnittest, GetEventFromName) {
+ rlz_lib::SetExpectedAssertion("GetEventFromName: event is NULL");
+ EXPECT_FALSE(rlz_lib::GetEventFromName("", NULL));
+ rlz_lib::SetExpectedAssertion("");
+
+ rlz_lib::Event event;
+ EXPECT_FALSE(rlz_lib::GetEventFromName(NULL, &event));
+ EXPECT_EQ(rlz_lib::INVALID_EVENT, event);
+
+ EXPECT_TRUE(rlz_lib::GetEventFromName("", &event));
+ EXPECT_EQ(rlz_lib::INVALID_EVENT, event);
+
+ EXPECT_FALSE(rlz_lib::GetEventFromName("i1", &event));
+ EXPECT_EQ(rlz_lib::INVALID_EVENT, event);
+
+ EXPECT_TRUE(rlz_lib::GetEventFromName("I", &event));
+ EXPECT_EQ(rlz_lib::INSTALL, event);
+
+ EXPECT_TRUE(rlz_lib::GetEventFromName("F", &event));
+ EXPECT_EQ(rlz_lib::FIRST_SEARCH, event);
+
+ EXPECT_FALSE(rlz_lib::GetEventFromName("F ", &event));
+ EXPECT_EQ(rlz_lib::INVALID_EVENT, event);
+}