diff options
author | scottmg@chromium.org <scottmg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-08 11:42:24 +0000 |
---|---|---|
committer | scottmg@chromium.org <scottmg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-08 11:42:24 +0000 |
commit | 4a262ba669c0bbbcde1cafe1e7f221faab6d9c5a (patch) | |
tree | 8ebf8d212c72c3a2b2dc6b43a927a92a2eddf2ec /win8/metro_driver | |
parent | dc69a6843ae9d710eb0aece44e710e63c4b0ae50 (diff) | |
download | chromium_src-4a262ba669c0bbbcde1cafe1e7f221faab6d9c5a.zip chromium_src-4a262ba669c0bbbcde1cafe1e7f221faab6d9c5a.tar.gz chromium_src-4a262ba669c0bbbcde1cafe1e7f221faab6d9c5a.tar.bz2 |
don't launch chrome.exe when running in metro test binary
In ash_unittests, TestMetroViewerProcessHost launches the metro viewer,
and the metro viewer is expected to connect back to it. By default
though, it launches chrome because it normally needs to do that to
have something to connect to.
Normally, ash_unittests creates the pipe, so chrome.exe's pipe creation
fails, and then chrome.exe shuts down when the viewer shuts down. If,
however, chrome takes longer to start, then the ash_unittests test
may finish, try to kill chrome.exes, then chrome.exe starts up and
creates the host pipe, then the next ash_unittest test starts up, and
fails because it will fail to create the pipe.
To avoid this race, pass an argument to the viewer (normally "open",
now in tests "test_open") that inhibits it from starting chrome.exe
R=ananta@chromium.org
TBR=sky@chromium.org
BUG=303478,316012
Review URL: https://codereview.chromium.org/65623002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@233872 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'win8/metro_driver')
-rw-r--r-- | win8/metro_driver/chrome_app_view_ash.cc | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/win8/metro_driver/chrome_app_view_ash.cc b/win8/metro_driver/chrome_app_view_ash.cc index 7dd7d39..6152d22 100644 --- a/win8/metro_driver/chrome_app_view_ash.cc +++ b/win8/metro_driver/chrome_app_view_ash.cc @@ -311,7 +311,33 @@ uint32 GetKeyboardEventFlags() { return flags; } -bool LaunchChromeBrowserProcess (const wchar_t* additional_parameters) { +bool LaunchChromeBrowserProcess(const wchar_t* additional_parameters, + winapp::Activation::IActivatedEventArgs* args) { + if (args) { + DVLOG(1) << __FUNCTION__ << ":" << ::GetCommandLineW(); + winapp::Activation::ActivationKind activation_kind; + CheckHR(args->get_Kind(&activation_kind)); + + DVLOG(1) << __FUNCTION__ << ", activation_kind=" << activation_kind; + + if (activation_kind == winapp::Activation::ActivationKind_Launch) { + mswr::ComPtr<winapp::Activation::ILaunchActivatedEventArgs> launch_args; + if (args->QueryInterface( + winapp::Activation::IID_ILaunchActivatedEventArgs, + &launch_args) == S_OK) { + DVLOG(1) << "Activate: ActivationKind_Launch"; + mswrw::HString launch_args_str; + launch_args->get_Arguments(launch_args_str.GetAddressOf()); + string16 actual_launch_args(MakeStdWString(launch_args_str.Get())); + if (actual_launch_args == L"test_open") { + DVLOG(1) << __FUNCTION__ + << "Not launching chrome server"; + return true; + } + } + } + } + DVLOG(1) << "Launching chrome server"; base::FilePath chrome_exe_path; @@ -683,7 +709,7 @@ HRESULT ChromeAppViewAsh::OnActivate( else if (activation_kind == winapp::Activation::ActivationKind_Protocol) HandleProtocolRequest(args); else - LaunchChromeBrowserProcess(NULL); + LaunchChromeBrowserProcess(NULL, args); // We call ICoreWindow::Activate after the handling for the search/protocol // requests because Chrome can be launched to handle a search request which // in turn launches the chrome browser process in desktop mode via @@ -923,7 +949,7 @@ HRESULT ChromeAppViewAsh::HandleSearchRequest( if (!ui_channel_) { DVLOG(1) << "Launched to handle search request"; - LaunchChromeBrowserProcess(L"--windows8-search"); + LaunchChromeBrowserProcess(L"--windows8-search", args); } mswrw::HString search_string; |