Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(551)

Side by Side Diff: chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl_unittest.cc

Issue 2685333005: ash: fix regression where ctrl+n put new window on wrong desktop (Closed)
Patch Set: Rebase to ToT Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.h" 5 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <map> 10 #include <map>
(...skipping 975 matching lines...) Expand 10 before | Expand all | Expand 10 after
986 native_window_.reset(new aura::Window(NULL)); 986 native_window_.reset(new aura::Window(NULL));
987 native_window_->set_id(0); 987 native_window_->set_id(0);
988 native_window_->SetType(ui::wm::WINDOW_TYPE_POPUP); 988 native_window_->SetType(ui::wm::WINDOW_TYPE_POPUP);
989 native_window_->Init(ui::LAYER_TEXTURED); 989 native_window_->Init(ui::LAYER_TEXTURED);
990 native_window_->Show(); 990 native_window_->Show();
991 aura::client::ParentWindowWithContext(native_window_.get(), 991 aura::client::ParentWindowWithContext(native_window_.get(),
992 ash::Shell::GetPrimaryRootWindow(), 992 ash::Shell::GetPrimaryRootWindow(),
993 gfx::Rect(10, 10, 20, 30)); 993 gfx::Rect(10, 10, 20, 30));
994 Browser::CreateParams params = Browser::CreateParams::CreateForApp( 994 Browser::CreateParams params = Browser::CreateParams::CreateForApp(
995 kCrxAppPrefix + app_name, true /* trusted_source */, gfx::Rect(), 995 kCrxAppPrefix + app_name, true /* trusted_source */, gfx::Rect(),
996 profile); 996 profile, true);
997 params.window = this; 997 params.window = this;
998 browser_.reset(new Browser(params)); 998 browser_.reset(new Browser(params));
999 chrome::AddTabAt(browser_.get(), GURL(), 0, true); 999 chrome::AddTabAt(browser_.get(), GURL(), 0, true);
1000 } 1000 }
1001 1001
1002 ~V1App() override { 1002 ~V1App() override {
1003 // close all tabs. Note that we do not need to destroy the browser itself. 1003 // close all tabs. Note that we do not need to destroy the browser itself.
1004 browser_->tab_strip_model()->CloseAllTabs(); 1004 browser_->tab_strip_model()->CloseAllTabs();
1005 } 1005 }
1006 1006
(...skipping 1298 matching lines...) Expand 10 before | Expand all | Expand 10 after
2305 2305
2306 // Create a second test profile. The first is the one in profile() created in 2306 // Create a second test profile. The first is the one in profile() created in
2307 // BrowserWithTestWindowTest::SetUp(). 2307 // BrowserWithTestWindowTest::SetUp().
2308 // No need to add the profiles to the MultiUserWindowManager here. 2308 // No need to add the profiles to the MultiUserWindowManager here.
2309 // CreateMultiUserProfile() already does that. 2309 // CreateMultiUserProfile() already does that.
2310 TestingProfile* profile2 = CreateMultiUserProfile("user2"); 2310 TestingProfile* profile2 = CreateMultiUserProfile("user2");
2311 const AccountId current_user = 2311 const AccountId current_user =
2312 multi_user_util::GetAccountIdFromProfile(profile()); 2312 multi_user_util::GetAccountIdFromProfile(profile());
2313 2313
2314 // Create a browser window with a native window for the current user. 2314 // Create a browser window with a native window for the current user.
2315 Browser::CreateParams params(profile()); 2315 Browser::CreateParams params(profile(), true);
2316 std::unique_ptr<Browser> browser( 2316 std::unique_ptr<Browser> browser(
2317 chrome::CreateBrowserWithAuraTestWindowForParams(nullptr, &params)); 2317 chrome::CreateBrowserWithAuraTestWindowForParams(nullptr, &params));
2318 BrowserWindow* browser_window = browser->window(); 2318 BrowserWindow* browser_window = browser->window();
2319 aura::Window* window = browser_window->GetNativeWindow(); 2319 aura::Window* window = browser_window->GetNativeWindow();
2320 manager->SetWindowOwner(window, current_user); 2320 manager->SetWindowOwner(window, current_user);
2321 2321
2322 // Check that an activation of the window on its owner's desktop does not 2322 // Check that an activation of the window on its owner's desktop does not
2323 // change the visibility to another user. 2323 // change the visibility to another user.
2324 launcher_controller_->ActivateWindowOrMinimizeIfActive(browser_window, false); 2324 launcher_controller_->ActivateWindowOrMinimizeIfActive(browser_window, false);
2325 EXPECT_TRUE(manager->IsWindowOnDesktopOfUser(window, current_user)); 2325 EXPECT_TRUE(manager->IsWindowOnDesktopOfUser(window, current_user));
(...skipping 1883 matching lines...) Expand 10 before | Expand all | Expand 10 after
4209 EXPECT_EQ(ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, 4209 EXPECT_EQ(ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS,
4210 shelf_controller->auto_hide()); 4210 shelf_controller->auto_hide());
4211 EXPECT_EQ(2u, shelf_controller->auto_hide_change_count()); 4211 EXPECT_EQ(2u, shelf_controller->auto_hide_change_count());
4212 4212
4213 PrefService* prefs = profile()->GetTestingPrefService(); 4213 PrefService* prefs = profile()->GetTestingPrefService();
4214 EXPECT_EQ("Left", prefs->GetString(prefs::kShelfAlignmentLocal)); 4214 EXPECT_EQ("Left", prefs->GetString(prefs::kShelfAlignmentLocal));
4215 EXPECT_EQ("Left", prefs->GetString(prefs::kShelfAlignment)); 4215 EXPECT_EQ("Left", prefs->GetString(prefs::kShelfAlignment));
4216 EXPECT_EQ("Always", prefs->GetString(prefs::kShelfAutoHideBehaviorLocal)); 4216 EXPECT_EQ("Always", prefs->GetString(prefs::kShelfAutoHideBehaviorLocal));
4217 EXPECT_EQ("Always", prefs->GetString(prefs::kShelfAutoHideBehavior)); 4217 EXPECT_EQ("Always", prefs->GetString(prefs::kShelfAutoHideBehavior));
4218 } 4218 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698