Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(145)

Side by Side Diff: chrome/installer/util/advanced_firewall_manager_win_unittest.cc

Issue 921913002: Move GetProcessIntegrityLevel to file_info.h and remove the handle argument. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix cast Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/advanced_firewall_manager_win.h" 5 #include "chrome/installer/util/advanced_firewall_manager_win.h"
6 6
7 #include "base/path_service.h" 7 #include "base/path_service.h"
8 #include "base/process/process_handle.h" 8 #include "base/process/process_info.h"
9 #include "base/win/scoped_bstr.h" 9 #include "base/win/scoped_bstr.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
11 11
12 namespace installer { 12 namespace installer {
13 13
14 class AdvancedFirewallManagerTest : public ::testing::Test { 14 class AdvancedFirewallManagerTest : public ::testing::Test {
15 public: 15 public:
16 AdvancedFirewallManagerTest() : skip_test_(true) {} 16 AdvancedFirewallManagerTest() : skip_test_(true) {}
17 17
18 protected: 18 protected:
19 // Sets up the test fixture. 19 // Sets up the test fixture.
20 virtual void SetUp() override { 20 virtual void SetUp() override {
21 base::IntegrityLevel level = base::INTEGRITY_UNKNOWN; 21 if (base::GetCurrentProcessIntegrityLevel() != base::HIGH_INTEGRITY) {
22 if (!GetProcessIntegrityLevel(base::GetCurrentProcessHandle(), &level) ||
23 level != base::HIGH_INTEGRITY) {
24 LOG(WARNING) << "XP or not elevated. Skipping the test."; 22 LOG(WARNING) << "XP or not elevated. Skipping the test.";
25 return; 23 return;
26 }; 24 };
27 skip_test_ = false; 25 skip_test_ = false;
28 base::FilePath exe_path; 26 base::FilePath exe_path;
29 PathService::Get(base::FILE_EXE, &exe_path); 27 PathService::Get(base::FILE_EXE, &exe_path);
30 EXPECT_TRUE(manager_.Init(L"AdvancedFirewallManagerTest", exe_path)); 28 EXPECT_TRUE(manager_.Init(L"AdvancedFirewallManagerTest", exe_path));
31 manager_.DeleteAllRules(); 29 manager_.DeleteAllRules();
32 } 30 }
33 31
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 EXPECT_TRUE(manager_.HasAnyRule()); 76 EXPECT_TRUE(manager_.HasAnyRule());
79 77
80 manager_.DeleteRuleByName(kRuleName); 78 manager_.DeleteRuleByName(kRuleName);
81 rule_names.clear(); 79 rule_names.clear();
82 GetAllRules(&rule_names); 80 GetAllRules(&rule_names);
83 EXPECT_TRUE(rule_names.empty()); 81 EXPECT_TRUE(rule_names.empty());
84 EXPECT_FALSE(manager_.HasAnyRule()); 82 EXPECT_FALSE(manager_.HasAnyRule());
85 } 83 }
86 84
87 } // namespace installer 85 } // namespace installer
OLDNEW
« no previous file with comments | « chrome/browser/process_singleton_win.cc ('k') | chrome/installer/util/legacy_firewall_manager_win_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698