| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/browser/conflicts/module_inspector_win.h" | 5 #include "chrome/browser/conflicts/module_inspector_win.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/bind.h" | 12 #include "base/bind.h" |
| 13 #include "base/environment.h" | 13 #include "base/environment.h" |
| 14 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/run_loop.h" | 16 #include "base/run_loop.h" |
| 17 #include "base/test/scoped_task_scheduler.h" | 17 #include "base/test/scoped_task_environment.h" |
| 18 #include "base/test/test_simple_task_runner.h" | 18 #include "base/test/test_simple_task_runner.h" |
| 19 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
| 20 | 20 |
| 21 namespace { | 21 namespace { |
| 22 | 22 |
| 23 base::FilePath GetKernel32DllFilePath() { | 23 base::FilePath GetKernel32DllFilePath() { |
| 24 std::unique_ptr<base::Environment> env = base::Environment::Create(); | 24 std::unique_ptr<base::Environment> env = base::Environment::Create(); |
| 25 std::string sysroot; | 25 std::string sysroot; |
| 26 EXPECT_TRUE(env->GetVar("SYSTEMROOT", &sysroot)); | 26 EXPECT_TRUE(env->GetVar("SYSTEMROOT", &sysroot)); |
| 27 | 27 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 50 inspected_modules_.push_back(std::move(inspection_result)); | 50 inspected_modules_.push_back(std::move(inspection_result)); |
| 51 } | 51 } |
| 52 | 52 |
| 53 const std::vector<std::unique_ptr<ModuleInspectionResult>>& | 53 const std::vector<std::unique_ptr<ModuleInspectionResult>>& |
| 54 inspected_modules() { | 54 inspected_modules() { |
| 55 return inspected_modules_; | 55 return inspected_modules_; |
| 56 } | 56 } |
| 57 | 57 |
| 58 private: | 58 private: |
| 59 // Must be before the ModuleInspector. | 59 // Must be before the ModuleInspector. |
| 60 base::test::ScopedTaskScheduler scoped_task_scheduler_; | 60 base::test::ScopedTaskEnvironment scoped_task_environment_; |
| 61 | 61 |
| 62 ModuleInspector module_inspector_; | 62 ModuleInspector module_inspector_; |
| 63 | 63 |
| 64 std::vector<std::unique_ptr<ModuleInspectionResult>> inspected_modules_; | 64 std::vector<std::unique_ptr<ModuleInspectionResult>> inspected_modules_; |
| 65 | 65 |
| 66 DISALLOW_COPY_AND_ASSIGN(ModuleInspectorTest); | 66 DISALLOW_COPY_AND_ASSIGN(ModuleInspectorTest); |
| 67 }; | 67 }; |
| 68 | 68 |
| 69 } // namespace | 69 } // namespace |
| 70 | 70 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 88 {base::FilePath(), 0, 0, 4}, | 88 {base::FilePath(), 0, 0, 4}, |
| 89 {base::FilePath(), 0, 0, 5}, | 89 {base::FilePath(), 0, 0, 5}, |
| 90 }); | 90 }); |
| 91 | 91 |
| 92 base::RunLoop().RunUntilIdle(); | 92 base::RunLoop().RunUntilIdle(); |
| 93 | 93 |
| 94 EXPECT_EQ(5u, inspected_modules().size()); | 94 EXPECT_EQ(5u, inspected_modules().size()); |
| 95 for (const auto& inspection_result : inspected_modules()) | 95 for (const auto& inspection_result : inspected_modules()) |
| 96 EXPECT_TRUE(inspection_result); | 96 EXPECT_TRUE(inspection_result); |
| 97 } | 97 } |
| OLD | NEW |