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

Unified Diff: common/test/RegistryTest.cpp

Issue 6216090891845632: Issue #404 - Create common library shared between plugin/engine and installer (Closed)
Patch Set: final check after rebase Created May 19, 2015, 3:36 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 | « common/test/IeVersionTest.cpp ('k') | src/engine/Main.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: common/test/RegistryTest.cpp
===================================================================
rename from test/RegistryTest.cpp
rename to common/test/RegistryTest.cpp
--- a/test/RegistryTest.cpp
+++ b/common/test/RegistryTest.cpp
@@ -15,77 +15,29 @@
* 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
-//----------------------------------
-TEST(RegistryTest, simple_0)
-{
- ASSERT_NO_THROW({ auto r = RegistryKey(HKEY_CLASSES_ROOT, L"CLSID"); });
-}
-
-TEST(RegistryTest, constructor_illegal_argument_0)
-{
- ASSERT_ANY_THROW({ auto r1 = RegistryKey(HKEY_CLASSES_ROOT, L""); });
-}
-
-TEST(RegistryTest, value_notfound_0)
-{
- auto r1 = RegistryKey(HKEY_CLASSES_ROOT, L"CLSID");
- ASSERT_ANY_THROW({ r1.value_wstring(L"nonexistent"); });
-}
-
-//----------------------------------
-// IE_Version
-//----------------------------------
-/*
- * Exact version tests enabled by default.
- * If they are disabled, gtext will report 2 disabled tests.
- */
-#if !defined(DISABLE_EXACT_TESTS)
-#define exact(x) exact_##x
-#else
-#define exact(x) DISABLED_exact_##x
-#endif
-/*
- * Define a default version as the current version of IE in general release.
- * Predefine on the command line to compile tests for non-standard development environments.
- */
-#ifndef INSTALLED_IE_VERSION
-#define INSTALLED_IE_VERSION 11
-#endif
-
-TEST(IE_Version_Test, sanity_string)
-{
- std::wstring version = AdblockPlus::IE::InstalledVersionString();
- ASSERT_FALSE(version.length() == 0); // separate test for default value
- ASSERT_TRUE(version.length() >= 2);
-}
-
-TEST(IE_Version_Test, sanity_major)
-{
- int version = AdblockPlus::IE::InstalledMajorVersion();
- ASSERT_NE(version, 0); // separate test for default value
- ASSERT_GE(version, 6);
- ASSERT_LE(version, 12);
- EXPECT_NE(version, 12); // This check will point out when the test needs updating.
-}
-
-TEST(IE_Version_Test, exact(string))
-{
- std::wstring version = AdblockPlus::IE::InstalledVersionString();
- std::wstring expected = std::to_wstring(INSTALLED_IE_VERSION) + L".";
- ASSERT_EQ(expected, version.substr(0, expected.length()));
-}
-
-TEST(IE_Version_Test, exact(major))
-{
- int version = AdblockPlus::IE::InstalledMajorVersion();
- ASSERT_EQ(version, INSTALLED_IE_VERSION);
-}
+#include <gtest/gtest.h>
+#include "Registry.h"
+
+using namespace AdblockPlus;
+
+TEST(RegistryTest, Simple00)
+{
+ ASSERT_NO_THROW({ auto r = RegistryKey(HKEY_CLASSES_ROOT, L"CLSID"); });
+}
+
+TEST(RegistryTest, Simple01)
+{
+ ASSERT_ANY_THROW({ auto r = RegistryKey(HKEY_CLASSES_ROOT, L"IREALLYHOPENOBODYHASREGISTEREDTHISKEY"); });
+}
+
+TEST(RegistryTest, ConstructorIllegalArgument00)
+{
+ // Empty string arguments are illegal by fiat; there's an explicit check
+ ASSERT_ANY_THROW({ auto r = RegistryKey(HKEY_CLASSES_ROOT, L""); });
+}
+
+TEST(RegistryTest, ValueNotFound00)
+{
+ auto r = RegistryKey(HKEY_CLASSES_ROOT, L"CLSID");
+ ASSERT_ANY_THROW({ r.value_wstring(L"nonexistent"); });
+}
« no previous file with comments | « common/test/IeVersionTest.cpp ('k') | src/engine/Main.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld