DescriptionUse gtest failures and EXPECTS instead of returning a failure enum in test target base/test/test_shortcut_win.cc
BUG=148539
TEST=base_unittests.exe --gtest_filter=ShortcutTest*
installer_util_unittests.exe --gtest_filter=ShellUtilShortcutTest*
unit_tests --gtest_filter=ProfileShortcutManagerTest*
Locally tried a test meant to fail for every property:
TEST_F(ShortcutTest, CreateShortcutVerifyPropertiesWrong) {
ASSERT_TRUE(base::win::CreateOrUpdateShortcutLink(
link_file_, link_properties_, base::win::SHORTCUT_CREATE_ALWAYS));
base::win::ShortcutProperties wrong_properties = link_properties_;
wrong_properties.set_target(FilePath(L"g:\\src\\component\\.gclient"));
wrong_properties.set_working_dir(temp_dir_2_.path());
wrong_properties.set_arguments(string16());
wrong_properties.set_description(L"foo");
wrong_properties.set_icon(temp_dir_2_.path().Append(L"joe.ico"), 8);
wrong_properties.set_app_id(L"JOE");
wrong_properties.set_dual_mode(true);
base::win::ValidateShortcut(link_file_, wrong_properties);
}
And got expected failure output for every property:
[ RUN ] ShortcutTest.CreateShortcutVerifyPropertiesWrong
g:\src\component\src\base\test\test_shortcut_win.cc(54): error: Value of: long_actual_path
Actual: G:\src\temp\scoped_dir14192_645\Target 1.txt
Expected: long_expected_path
Which is: g:\src\component\.gclient
g:\src\component\src\base\test\test_shortcut_win.cc(54): error: Value of: long_actual_path
Actual: G:\src\temp\scoped_dir14192_645
Expected: long_expected_path
Which is: G:\src\temp\scoped_dir14192_27681
g:\src\component\src\base\test\test_shortcut_win.cc(95): error: Value of: read_arguments
Actual: L"--magic --awesome"
Expected: properties.arguments
Which is: L""
g:\src\component\src\base\test\test_shortcut_win.cc(101): error: Value of: read_description
Actual: L"Chrome is awesome."
Expected: properties.description
Which is: L"foo"
g:\src\component\src\base\test\test_shortcut_win.cc(43): error: Expected: (0U) != (::GetLongPathNameW( expected_path.val
ue().c_str(), long_expected_path_chars, 260)), actual: 0 vs 0
Failed to get LongPathName of G:\src\temp\scoped_dir14192_27681\joe.ico
g:\src\component\src\base\test\test_shortcut_win.cc(108): error: Value of: read_icon_index
Actual: 4
Expected: properties.icon_index
Which is: 8
g:\src\component\src\base\test\test_shortcut_win.cc(129): error: Value of: read_app_id
Actual: L"Chrome"
Expected: properties.app_id
Which is: L"JOE"
g:\src\component\src\base\test\test_shortcut_win.cc(138): error: Value of: static_cast<bool>(read_dual_mode)
Actual: false
Expected: properties.dual_mode
Which is: true
[ FAILED ] ShortcutTest.CreateShortcutVerifyPropertiesWrong (37 ms)
Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=158909
Patch Set 1 : #
Total comments: 6
Patch Set 2 : address robertshield's comments #Patch Set 3 : ASSERTs instead of EXPECTs where desired #Patch Set 4 : No ASSERTs in test support targets #
Messages
Total messages: 13 (0 generated)
|