| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/installer/util/legacy_firewall_manager_win.h" | 5 #include "chrome/installer/util/legacy_firewall_manager_win.h" |
| 6 | 6 |
| 7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
| 8 #include "base/process/process_info.h" | 8 #include "base/process/process_info.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| 11 namespace installer { | 11 namespace installer { |
| 12 | 12 |
| 13 class LegacyFirewallManagerTest : public ::testing::Test { | 13 class LegacyFirewallManagerTest : public ::testing::Test { |
| 14 public: | 14 public: |
| 15 LegacyFirewallManagerTest() : skip_test_(true) {} | 15 LegacyFirewallManagerTest() : skip_test_(true) {} |
| 16 | 16 |
| 17 protected: | 17 protected: |
| 18 // Sets up the test fixture. | 18 // Sets up the test fixture. |
| 19 virtual void SetUp() override { | 19 void SetUp() override { |
| 20 if (base::GetCurrentProcessIntegrityLevel() != base::HIGH_INTEGRITY) { | 20 if (base::GetCurrentProcessIntegrityLevel() != base::HIGH_INTEGRITY) { |
| 21 LOG(WARNING) << "Not elevated. Skipping the test."; | 21 LOG(WARNING) << "Not elevated. Skipping the test."; |
| 22 return; | 22 return; |
| 23 }; | 23 }; |
| 24 skip_test_ = false; | 24 skip_test_ = false; |
| 25 base::FilePath exe_path; | 25 base::FilePath exe_path; |
| 26 PathService::Get(base::FILE_EXE, &exe_path); | 26 PathService::Get(base::FILE_EXE, &exe_path); |
| 27 EXPECT_TRUE(manager_.Init(L"LegacyFirewallManagerTest", exe_path)); | 27 EXPECT_TRUE(manager_.Init(L"LegacyFirewallManagerTest", exe_path)); |
| 28 manager_.DeleteRule(); | 28 manager_.DeleteRule(); |
| 29 } | 29 } |
| 30 | 30 |
| 31 // Tears down the test fixture. | 31 // Tears down the test fixture. |
| 32 virtual void TearDown() override { | 32 void TearDown() override { |
| 33 if (!skip_test_) | 33 if (!skip_test_) |
| 34 manager_.DeleteRule(); | 34 manager_.DeleteRule(); |
| 35 } | 35 } |
| 36 | 36 |
| 37 bool skip_test_; | 37 bool skip_test_; |
| 38 LegacyFirewallManager manager_; | 38 LegacyFirewallManager manager_; |
| 39 | 39 |
| 40 private: | 40 private: |
| 41 DISALLOW_COPY_AND_ASSIGN(LegacyFirewallManagerTest); | 41 DISALLOW_COPY_AND_ASSIGN(LegacyFirewallManagerTest); |
| 42 }; | 42 }; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 63 return; | 63 return; |
| 64 EXPECT_TRUE(manager_.SetAllowIncomingConnection(false)); | 64 EXPECT_TRUE(manager_.SetAllowIncomingConnection(false)); |
| 65 bool allowed = true; | 65 bool allowed = true; |
| 66 EXPECT_TRUE(manager_.GetAllowIncomingConnection(&allowed)); | 66 EXPECT_TRUE(manager_.GetAllowIncomingConnection(&allowed)); |
| 67 EXPECT_FALSE(allowed); | 67 EXPECT_FALSE(allowed); |
| 68 manager_.DeleteRule(); | 68 manager_.DeleteRule(); |
| 69 EXPECT_FALSE(manager_.GetAllowIncomingConnection(NULL)); | 69 EXPECT_FALSE(manager_.GetAllowIncomingConnection(NULL)); |
| 70 } | 70 } |
| 71 | 71 |
| 72 } // namespace installer | 72 } // namespace installer |
| OLD | NEW |