Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: test/RegistryTest.cpp

Issue 5171515343503360: Issue #41 - Bring method of determining IE version up to date (Closed)
Patch Set: reformatted Created July 26, 2014, 3:52 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/shared/Registry.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/RegistryTest.cpp
===================================================================
new file mode 100644
--- /dev/null
+++ b/test/RegistryTest.cpp
@@ -0,0 +1,101 @@
+/*
+ * This file is part of Adblock Plus <http://adblockplus.org/>,
+ * Copyright (C) 2014 Eyeo GmbH
+ *
+ * Adblock Plus is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 3 as
+ * published by the Free Software Foundation.
+ *
+ * Adblock Plus is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <gtest/gtest.h>
+
+#include "../src/shared/Registry.h"
+#include "../src/shared/IE_Version.h"
+
+using namespace AdblockPlus;
+
+//----------------------------------
+// Registry_Key
+//----------------------------------
+
+class Registry_Test
+ : public ::testing::Test
+{
+};
+
+TEST(Registry_Test, roots_0)
+{
+ // Test succeeds if it does not throw
+ auto r = Registry_Key(Registry_Key::Predefined::HKCR);
+ r = Registry_Key(Registry_Key::Predefined::HKCC);
+ r = Registry_Key(Registry_Key::Predefined::HKCU);
+ r = Registry_Key(Registry_Key::Predefined::HKLM);
+ r = Registry_Key(Registry_Key::Predefined::HKU);
+}
+
+TEST(Registry_Test, roots_1)
+{
+ // Test succeeds if it does not throw
+ auto r = Registry_Key(Registry_Key::Predefined::HKCR, L"");
+ r = Registry_Key(Registry_Key::Predefined::HKCC, L"");
+ r = Registry_Key(Registry_Key::Predefined::HKCU, L"");
+ r = Registry_Key(Registry_Key::Predefined::HKLM, L"");
+ r = Registry_Key(Registry_Key::Predefined::HKU, L"");
+}
+
+TEST(Registry_Test, value_notfound_0)
+{
+ auto r1 = Registry_Key(Registry_Key::Predefined::HKCR);
+ ASSERT_ANY_THROW({ r1.value_wstring(L"nonexistent"); });
+}
+
+TEST(Registry_Test, value_notfound_1)
+{
+ auto r1 = Registry_Key(Registry_Key::Predefined::HKCR, L"");
+ ASSERT_ANY_THROW({ r1.value_wstring(L"nonexistent"); });
+}
+
+TEST(Registry_Test, value_notfound_2)
+{
+ auto r1 = Registry_Key(Registry_Key::Predefined::HKCR, L"CLSID");
+ ASSERT_ANY_THROW({ r1.value_wstring(L"nonexistent"); });
+}
+
+//----------------------------------
+// IE_Version
+//----------------------------------
+
+class IE_Version_Test
+ : public ::testing::Test
+{
+};
+
+TEST(IE_Version_Test, sanity_string)
+{
+ std::wstring version = AdblockPlus::IE::installed_version_string();
+ ASSERT_NE(version, L"");
+ // Replace with local version prefix as appropriate
+ if (false)
+ {
+ EXPECT_EQ(0, version.compare(0, 3, L"11."));
+ }
+}
+
+TEST(IE_Version_Test, sanity_major)
+{
+ int version = AdblockPlus::IE::installed_major_version();
+ ASSERT_NE(version, 0);
+ // Replace with local major version
+ if (false)
+ {
+ EXPECT_EQ(version, 11);
+ }
+}
« no previous file with comments | « src/shared/Registry.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld