| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <stdio.h> | 5 #include <stdio.h> |
| 6 | 6 |
| 7 #include "base/environment.h" | 7 #include "base/environment.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
| 11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
| 12 #include "base/win/scoped_handle.h" | 12 #include "base/win/scoped_handle.h" |
| 13 #include "base/win/windows_version.h" | 13 #include "base/win/windows_version.h" |
| 14 #include "sandbox/win/tests/common/controller.h" | 14 #include "sandbox/win/tests/common/controller.h" |
| 15 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 16 | 16 |
| 17 namespace sandbox { | 17 namespace sandbox { |
| 18 | 18 |
| 19 class AddressSanitizerTests : public ::testing::Test { | 19 class AddressSanitizerTests : public ::testing::Test { |
| 20 public: | 20 public: |
| 21 void SetUp() { | 21 void SetUp() override { |
| 22 env_.reset(base::Environment::Create()); | 22 env_.reset(base::Environment::Create()); |
| 23 had_asan_options_ = env_->GetVar("ASAN_OPTIONS", &old_asan_options_); | 23 had_asan_options_ = env_->GetVar("ASAN_OPTIONS", &old_asan_options_); |
| 24 } | 24 } |
| 25 | 25 |
| 26 void TearDown() { | 26 void TearDown() override { |
| 27 if (had_asan_options_) | 27 if (had_asan_options_) |
| 28 ASSERT_TRUE(env_->SetVar("ASAN_OPTIONS", old_asan_options_)); | 28 ASSERT_TRUE(env_->SetVar("ASAN_OPTIONS", old_asan_options_)); |
| 29 else | 29 else |
| 30 env_->UnSetVar("ASAN_OPTIONS"); | 30 env_->UnSetVar("ASAN_OPTIONS"); |
| 31 } | 31 } |
| 32 | 32 |
| 33 protected: | 33 protected: |
| 34 scoped_ptr<base::Environment> env_; | 34 scoped_ptr<base::Environment> env_; |
| 35 bool had_asan_options_; | 35 bool had_asan_options_; |
| 36 std::string old_asan_options_; | 36 std::string old_asan_options_; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 << "The stack trace doesn't have a correct filename:\n" << data; | 98 << "The stack trace doesn't have a correct filename:\n" << data; |
| 99 } else { | 99 } else { |
| 100 LOG(WARNING) << "Pre-Vista versions are not supported."; | 100 LOG(WARNING) << "Pre-Vista versions are not supported."; |
| 101 } | 101 } |
| 102 } else { | 102 } else { |
| 103 LOG(WARNING) << "Not an AddressSanitizer build, skipping the run."; | 103 LOG(WARNING) << "Not an AddressSanitizer build, skipping the run."; |
| 104 } | 104 } |
| 105 } | 105 } |
| 106 | 106 |
| 107 } | 107 } |
| OLD | NEW |