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

Side by Side Diff: chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos_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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include "ash/common/shelf/shelf_widget.h" 7 #include "ash/common/shelf/shelf_widget.h"
8 #include "ash/common/shelf/wm_shelf.h" 8 #include "ash/common/shelf/wm_shelf.h"
9 #include "ash/common/test/test_session_state_delegate.h" 9 #include "ash/common/test/test_session_state_delegate.h"
10 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" 10 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h"
(...skipping 1543 matching lines...) Expand 10 before | Expand all | Expand 10 after
1554 AddTestUser(account_id_A); 1554 AddTestUser(account_id_A);
1555 AddTestUser(account_id_B); 1555 AddTestUser(account_id_B);
1556 session_state_delegate()->set_logged_in_users(2); 1556 session_state_delegate()->set_logged_in_users(2);
1557 user_manager()->SwitchActiveUser(account_id_A); 1557 user_manager()->SwitchActiveUser(account_id_A);
1558 multi_user_window_manager()->ActiveUserChanged(account_id_A); 1558 multi_user_window_manager()->ActiveUserChanged(account_id_A);
1559 1559
1560 aura::client::ActivationClient* activation_client = 1560 aura::client::ActivationClient* activation_client =
1561 aura::client::GetActivationClient(window(0)->GetRootWindow()); 1561 aura::client::GetActivationClient(window(0)->GetRootWindow());
1562 multi_user_window_manager()->SetWindowOwner(window(0), account_id_A); 1562 multi_user_window_manager()->SetWindowOwner(window(0), account_id_A);
1563 Profile* profile = multi_user_util::GetProfileFromAccountId(account_id_A); 1563 Profile* profile = multi_user_util::GetProfileFromAccountId(account_id_A);
1564 Browser::CreateParams params(profile); 1564 Browser::CreateParams params(profile, true);
1565 std::unique_ptr<Browser> browser(CreateTestBrowser( 1565 std::unique_ptr<Browser> browser(CreateTestBrowser(
1566 CreateTestWindowInShellWithId(0), gfx::Rect(16, 32, 640, 320), &params)); 1566 CreateTestWindowInShellWithId(0), gfx::Rect(16, 32, 640, 320), &params));
1567 aura::Window* browser_native_window = browser->window()->GetNativeWindow(); 1567 aura::Window* browser_native_window = browser->window()->GetNativeWindow();
1568 activation_client->ActivateWindow(browser_native_window); 1568 activation_client->ActivateWindow(browser_native_window);
1569 // Manually set last active browser in BrowserList for testing. 1569 // Manually set last active browser in BrowserList for testing.
1570 BrowserList::GetInstance()->SetLastActive(browser.get()); 1570 BrowserList::GetInstance()->SetLastActive(browser.get());
1571 EXPECT_EQ(browser.get(), BrowserList::GetInstance()->GetLastActive()); 1571 EXPECT_EQ(browser.get(), BrowserList::GetInstance()->GetLastActive());
1572 EXPECT_EQ(browser_native_window, wm::GetActiveWindow()); 1572 EXPECT_EQ(browser_native_window, wm::GetActiveWindow());
1573 EXPECT_EQ(browser.get(), ChromeNewWindowClient::GetActiveBrowser()); 1573 EXPECT_EQ(browser.get(), ChromeNewWindowClient::GetActiveBrowser());
1574 1574
1575 // Switch to another user's desktop with no active window. 1575 // Switch to another user's desktop with no active window.
1576 user_manager()->SwitchActiveUser(account_id_B); 1576 user_manager()->SwitchActiveUser(account_id_B);
1577 multi_user_window_manager()->ActiveUserChanged(account_id_B); 1577 multi_user_window_manager()->ActiveUserChanged(account_id_B);
1578 EXPECT_EQ(browser.get(), BrowserList::GetInstance()->GetLastActive()); 1578 EXPECT_EQ(browser.get(), BrowserList::GetInstance()->GetLastActive());
1579 EXPECT_EQ(nullptr, wm::GetActiveWindow()); 1579 EXPECT_EQ(nullptr, wm::GetActiveWindow());
1580 EXPECT_EQ(nullptr, ChromeNewWindowClient::GetActiveBrowser()); 1580 EXPECT_EQ(nullptr, ChromeNewWindowClient::GetActiveBrowser());
1581 } 1581 }
1582 1582
1583 } // namespace test 1583 } // namespace test
1584 } // namespace ash 1584 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698