| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium OS 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 // Tests for cros_boot_mode::BootloaderType default behavior. | 5 // Tests for cros_boot_mode::BootloaderType default behavior. |
| 6 #include "bootloader_type.h" | 6 #include "bootloader_type.h" |
| 7 | 7 |
| 8 #include <base/basictypes.h> | 8 #include <base/basictypes.h> |
| 9 #include <base/file_util.h> | 9 #include <base/file_util.h> |
| 10 #include <base/stringprintf.h> | 10 #include <base/stringprintf.h> |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 cros_boot_mode::BootloaderType::kSupportedBootloaders[ | 92 cros_boot_mode::BootloaderType::kSupportedBootloaders[ |
| 93 cros_boot_mode::BootloaderType::kChromeOS]); | 93 cros_boot_mode::BootloaderType::kChromeOS]); |
| 94 | 94 |
| 95 EXPECT_EQ(file_util::WriteFile(FilePath(type_file_path_), | 95 EXPECT_EQ(file_util::WriteFile(FilePath(type_file_path_), |
| 96 contents.c_str(), contents.length()), | 96 contents.c_str(), contents.length()), |
| 97 contents.length()); | 97 contents.length()); |
| 98 type_.Initialize(); | 98 type_.Initialize(); |
| 99 ExpectType(cros_boot_mode::BootloaderType::kUnsupported); | 99 ExpectType(cros_boot_mode::BootloaderType::kUnsupported); |
| 100 } | 100 } |
| 101 | 101 |
| 102 TEST_F(BootloaderTypeTest, FirstMatchIsUsed) { | 102 TEST_F(BootloaderTypeTest, FirstMatchInEnumOrderIsUsed) { |
| 103 std::string contents = StringPrintf(" %s %s ", | 103 std::string contents = StringPrintf(" %s %s ", |
| 104 cros_boot_mode::BootloaderType::kSupportedBootloaders[ | 104 cros_boot_mode::BootloaderType::kSupportedBootloaders[ |
| 105 cros_boot_mode::BootloaderType::kChromeOS], | 105 cros_boot_mode::BootloaderType::kChromeOS], |
| 106 cros_boot_mode::BootloaderType::kSupportedBootloaders[ | 106 cros_boot_mode::BootloaderType::kSupportedBootloaders[ |
| 107 cros_boot_mode::BootloaderType::kEFI]); | 107 cros_boot_mode::BootloaderType::kDebug]); |
| 108 | 108 |
| 109 EXPECT_EQ(file_util::WriteFile(FilePath(type_file_path_), | 109 EXPECT_EQ(file_util::WriteFile(FilePath(type_file_path_), |
| 110 contents.c_str(), contents.length()), | 110 contents.c_str(), contents.length()), |
| 111 contents.length()); | 111 contents.length()); |
| 112 type_.Initialize(); | 112 type_.Initialize(); |
| 113 ExpectType(cros_boot_mode::BootloaderType::kChromeOS); | 113 ExpectType(cros_boot_mode::BootloaderType::kDebug); |
| 114 } | 114 } |
| 115 |
| OLD | NEW |