Commit c2a8eb06 authored by jackhou's avatar jackhou Committed by Commit bot

[Mac] Re-enable AppShimInteractiveTest.Launch (again).

The flakiness only occurs on ASan builds. The test times out because the
shim does not successfully launch when the app launches.
LSOpenApplication returns procNotFound(-600). It's not clear why this
happens, but it could be some interaction with WaitForSingleProcess.

Reversing the order of the two test cases fixes the flakiness.

BUG=415422

Review URL: https://codereview.chromium.org/597113003

Cr-Commit-Position: refs/heads/master@{#296389}
parent b450e21d
......@@ -226,8 +226,7 @@ namespace apps {
#define MAYBE_Launch DISABLED_Launch
#define MAYBE_RebuildShim DISABLED_RebuildShim
#else
// Launch is flaky http://crbug.com/415422.
#define MAYBE_Launch DISABLED_Launch
#define MAYBE_Launch Launch
#define MAYBE_RebuildShim RebuildShim
#endif
......@@ -258,31 +257,7 @@ IN_PROC_BROWSER_TEST_F(AppShimInteractiveTest, MAYBE_Launch) {
ASSERT_TRUE(base::PathExists(shim_path));
NSString* bundle_id = GetBundleID(shim_path);
// Case 1: Launch the shim, it should start the app.
{
ExtensionTestMessageListener launched_listener("Launched", false);
CommandLine shim_cmdline(CommandLine::NO_PROGRAM);
shim_cmdline.AppendSwitch(app_mode::kLaunchedForTest);
ProcessSerialNumber shim_psn;
ASSERT_TRUE(base::mac::OpenApplicationWithPath(
shim_path, shim_cmdline, kLSLaunchDefaults, &shim_psn));
ASSERT_TRUE(launched_listener.WaitUntilSatisfied());
ASSERT_TRUE(GetFirstAppWindow());
EXPECT_TRUE(HasAppShimHost(profile(), app->id()));
// If the window is closed, the shim should quit.
pid_t shim_pid;
EXPECT_EQ(noErr, GetProcessPID(&shim_psn, &shim_pid));
GetFirstAppWindow()->GetBaseWindow()->Close();
ASSERT_TRUE(
base::WaitForSingleProcess(shim_pid, TestTimeouts::action_timeout()));
EXPECT_FALSE(GetFirstAppWindow());
EXPECT_FALSE(HasAppShimHost(profile(), app->id()));
}
// Case 2: Launch the app, it should start the shim.
// Case 1: Launch the app, it should start the shim.
{
base::scoped_nsobject<WindowedNSNotificationObserver> ns_observer;
ns_observer.reset([[WindowedNSNotificationObserver alloc]
......@@ -315,6 +290,30 @@ IN_PROC_BROWSER_TEST_F(AppShimInteractiveTest, MAYBE_Launch) {
EXPECT_FALSE(GetFirstAppWindow());
EXPECT_FALSE(HasAppShimHost(profile(), app->id()));
}
// Case 2: Launch the shim, it should start the app.
{
ExtensionTestMessageListener launched_listener("Launched", false);
CommandLine shim_cmdline(CommandLine::NO_PROGRAM);
shim_cmdline.AppendSwitch(app_mode::kLaunchedForTest);
ProcessSerialNumber shim_psn;
ASSERT_TRUE(base::mac::OpenApplicationWithPath(
shim_path, shim_cmdline, kLSLaunchDefaults, &shim_psn));
ASSERT_TRUE(launched_listener.WaitUntilSatisfied());
ASSERT_TRUE(GetFirstAppWindow());
EXPECT_TRUE(HasAppShimHost(profile(), app->id()));
// If the window is closed, the shim should quit.
pid_t shim_pid;
EXPECT_EQ(noErr, GetProcessPID(&shim_psn, &shim_pid));
GetFirstAppWindow()->GetBaseWindow()->Close();
ASSERT_TRUE(
base::WaitForSingleProcess(shim_pid, TestTimeouts::action_timeout()));
EXPECT_FALSE(GetFirstAppWindow());
EXPECT_FALSE(HasAppShimHost(profile(), app->id()));
}
}
#if defined(ARCH_CPU_64_BITS)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment