Skip to content

Commit

Permalink
Test for crash fix
Browse files Browse the repository at this point in the history
https://crrev.com/c/4335571 fixed a crash with bogus extensions. Add
a test to prevent regressions.

Bug: 1423362
Change-Id: I2e4ac1fa1a48a13be8ceeac80b09093fd251c77b
Fixed: 1426193
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4368782
Commit-Queue: Leonard Grey <lgrey@chromium.org>
Reviewed-by: Leonard Grey <lgrey@chromium.org>
Auto-Submit: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1121915}
  • Loading branch information
Avi Drissman authored and Chromium LUCI CQ committed Mar 24, 2023
1 parent 7a1b7b5 commit c4cc64a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions ui/shell_dialogs/select_file_dialog_mac_unittest.mm
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,18 @@ void ResetDialog() {
EXPECT_FALSE(panel.extensionHidden);
}

TEST_F(SelectFileDialogMacTest, DontCrashWithBogusExtension) {
SelectFileDialog::FileTypeInfo file_type_info;
file_type_info.extensions = {{"bogus type", "j.pg"}};

FileDialogArguments args;
args.file_types = &file_type_info;

NSSavePanel* panel = SelectFileWithParams(args);
// If execution gets this far, there was no crash.
EXPECT_TRUE(panel);
}

// Test to ensure lifetime is sound if a reference to
// the panel outlives the delegate.
TEST_F(SelectFileDialogMacTest, Lifetime) {
Expand Down

0 comments on commit c4cc64a

Please sign in to comment.