ash: fix regression where ctrl+n put new window on wrong desktop
In multi-user mode on chromeos, we check whether a new window was
created by a user gesture by looking at the state of the MessageLoop and
the EventDispatcher. This doesn't work in an asynchronous world.
This patch replaces this check by manually annotating windows which were
created by user gesture.
BUG=690160
[email protected]
Review-Url: https://codereview.chromium.org/2685333005
Cr-Commit-Position: refs/heads/master@{#452222}
diff --git a/chrome/browser/profiles/profile_manager_unittest.cc b/chrome/browser/profiles/profile_manager_unittest.cc
index 6a66ac55..f5c4ef1 100644
--- a/chrome/browser/profiles/profile_manager_unittest.cc
+++ b/chrome/browser/profiles/profile_manager_unittest.cc
@@ -713,7 +713,7 @@
ASSERT_EQ(0U, last_opened_profiles.size());
// Create a browser for profile1.
- Browser::CreateParams profile1_params(profile1);
+ Browser::CreateParams profile1_params(profile1, true);
std::unique_ptr<Browser> browser1a(
chrome::CreateBrowserWithTestWindowForParams(&profile1_params));
@@ -722,7 +722,7 @@
EXPECT_EQ(profile1, last_opened_profiles[0]);
// And for profile2.
- Browser::CreateParams profile2_params(profile2);
+ Browser::CreateParams profile2_params(profile2, true);
std::unique_ptr<Browser> browser2(
chrome::CreateBrowserWithTestWindowForParams(&profile2_params));
@@ -775,12 +775,12 @@
ASSERT_TRUE(profile2);
// Create a browser for profile1.
- Browser::CreateParams profile1_params(profile1);
+ Browser::CreateParams profile1_params(profile1, true);
std::unique_ptr<Browser> browser1(
chrome::CreateBrowserWithTestWindowForParams(&profile1_params));
// And for profile2.
- Browser::CreateParams profile2_params(profile2);
+ Browser::CreateParams profile2_params(profile2, true);
std::unique_ptr<Browser> browser2(
chrome::CreateBrowserWithTestWindowForParams(&profile2_params));
@@ -825,7 +825,7 @@
ASSERT_EQ(0U, last_opened_profiles.size());
// Create a browser for profile1.
- Browser::CreateParams profile1_params(profile1);
+ Browser::CreateParams profile1_params(profile1, true);
std::unique_ptr<Browser> browser1(
chrome::CreateBrowserWithTestWindowForParams(&profile1_params));
@@ -834,7 +834,8 @@
EXPECT_EQ(profile1, last_opened_profiles[0]);
// And for profile2.
- Browser::CreateParams profile2_params(profile1->GetOffTheRecordProfile());
+ Browser::CreateParams profile2_params(profile1->GetOffTheRecordProfile(),
+ true);
std::unique_ptr<Browser> browser2a(
chrome::CreateBrowserWithTestWindowForParams(&profile2_params));
@@ -884,7 +885,7 @@
EXPECT_NE(profile, last_used_profile);
// Create a browser for the profile.
- Browser::CreateParams profile_params(profile);
+ Browser::CreateParams profile_params(profile, true);
std::unique_ptr<Browser> browser(
chrome::CreateBrowserWithTestWindowForParams(&profile_params));
last_used_profile = profile_manager->GetLastUsedProfile();
@@ -926,16 +927,16 @@
ASSERT_TRUE(ephemeral_profile2);
// Create a browser for profile1.
- Browser::CreateParams profile1_params(normal_profile);
+ Browser::CreateParams profile1_params(normal_profile, true);
std::unique_ptr<Browser> browser1(
chrome::CreateBrowserWithTestWindowForParams(&profile1_params));
// Create browsers for the ephemeral profile.
- Browser::CreateParams profile2_params(ephemeral_profile1);
+ Browser::CreateParams profile2_params(ephemeral_profile1, true);
std::unique_ptr<Browser> browser2(
chrome::CreateBrowserWithTestWindowForParams(&profile2_params));
- Browser::CreateParams profile3_params(ephemeral_profile2);
+ Browser::CreateParams profile3_params(ephemeral_profile2, true);
std::unique_ptr<Browser> browser3(
chrome::CreateBrowserWithTestWindowForParams(&profile3_params));