| OLD | NEW | 
| (Empty) |  | 
 |    1 /* | 
 |    2  * This file is part of Adblock Plus <http://adblockplus.org/>, | 
 |    3  * Copyright (C) 2014 Eyeo GmbH | 
 |    4  * | 
 |    5  * Adblock Plus is free software: you can redistribute it and/or modify | 
 |    6  * it under the terms of the GNU General Public License version 3 as | 
 |    7  * published by the Free Software Foundation. | 
 |    8  * | 
 |    9  * Adblock Plus is distributed in the hope that it will be useful, | 
 |   10  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
 |   11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
 |   12  * GNU General Public License for more details. | 
 |   13  * | 
 |   14  * You should have received a copy of the GNU General Public License | 
 |   15  * along with Adblock Plus.  If not, see <http://www.gnu.org/licenses/>. | 
 |   16  */ | 
 |   17  | 
 |   18 #include <gtest/gtest.h> | 
 |   19  | 
 |   20 #include "../src/shared/Registry.h" | 
 |   21 #include "../src/shared/IE_Version.h" | 
 |   22  | 
 |   23 using namespace AdblockPlus; | 
 |   24  | 
 |   25 //---------------------------------- | 
 |   26 // Registry_Key | 
 |   27 //---------------------------------- | 
 |   28  | 
 |   29 class Registry_Test | 
 |   30   : public ::testing::Test | 
 |   31 { | 
 |   32 }; | 
 |   33  | 
 |   34 TEST( Registry_Test, roots_0 ) | 
 |   35 { | 
 |   36   // Test succeeds if it does not throw | 
 |   37   auto r = Registry_Key( Registry_Key::Predefined::HKCR ); | 
 |   38   r =  Registry_Key( Registry_Key::Predefined::HKCC ); | 
 |   39   r =  Registry_Key( Registry_Key::Predefined::HKCU ); | 
 |   40   r =  Registry_Key( Registry_Key::Predefined::HKLM ); | 
 |   41   r =  Registry_Key( Registry_Key::Predefined::HKU ); | 
 |   42 } | 
 |   43  | 
 |   44 TEST( Registry_Test, roots_1 ) | 
 |   45 { | 
 |   46   // Test succeeds if it does not throw | 
 |   47   auto r = Registry_Key( Registry_Key::Predefined::HKCR, L"" ); | 
 |   48   r =  Registry_Key( Registry_Key::Predefined::HKCC, L"" ); | 
 |   49   r =  Registry_Key( Registry_Key::Predefined::HKCU, L"" ); | 
 |   50   r =  Registry_Key( Registry_Key::Predefined::HKLM, L"" ); | 
 |   51   r =  Registry_Key( Registry_Key::Predefined::HKU, L"" ); | 
 |   52 } | 
 |   53  | 
 |   54 TEST( Registry_Test, value_notfound_0 ) | 
 |   55 { | 
 |   56   auto r1 = Registry_Key( Registry_Key::Predefined::HKCR ); | 
 |   57   ASSERT_ANY_THROW( { r1.value_wstring( L"nonexistent" ); } ); | 
 |   58 } | 
 |   59  | 
 |   60 TEST( Registry_Test, value_notfound_1 ) | 
 |   61 { | 
 |   62   auto r1 = Registry_Key( Registry_Key::Predefined::HKCR, L"" ); | 
 |   63   ASSERT_ANY_THROW( { r1.value_wstring( L"nonexistent" ); } ); | 
 |   64 } | 
 |   65  | 
 |   66 TEST( Registry_Test, value_notfound_2 ) | 
 |   67 { | 
 |   68   auto r1 = Registry_Key( Registry_Key::Predefined::HKCR, L"CLSID" ); | 
 |   69   ASSERT_ANY_THROW( { r1.value_wstring( L"nonexistent" ); } ); | 
 |   70 } | 
 |   71  | 
 |   72 //---------------------------------- | 
 |   73 // IE_Version | 
 |   74 //---------------------------------- | 
 |   75  | 
 |   76 class IE_Version_Test | 
 |   77   : public ::testing::Test | 
 |   78 { | 
 |   79 }; | 
 |   80  | 
 |   81 TEST( IE_Version_Test, sanity_string ) | 
 |   82 { | 
 |   83   std::wstring version = AdblockPlus::IE::installed_version_string(); | 
 |   84   ASSERT_NE( version, L"" ); | 
 |   85   // Replace with local version prefix as appropriate | 
 |   86   if (false) | 
 |   87   { | 
 |   88     EXPECT_EQ( 0, version.compare( 0, 3, L"11." ) ); | 
 |   89   } | 
 |   90 } | 
 |   91  | 
 |   92 TEST( IE_Version_Test, sanity_major ) | 
 |   93 { | 
 |   94   int version = AdblockPlus::IE::installed_major_version(); | 
 |   95   ASSERT_NE( version, 0 ); | 
 |   96   // Replace with local major version | 
 |   97   if (false) | 
 |   98   { | 
 |   99     EXPECT_EQ( version, 11 ); | 
 |  100   } | 
 |  101 } | 
| OLD | NEW |