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

Side by Side Diff: chrome/browser/ui/ash/chrome_new_window_client_browsertest.cc

Issue 2644733004: Chrome OS: New window on teleported browser window should show on current desktop (Closed)
Patch Set: add test coverage Created 3 years, 11 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "ash/common/new_window_controller.h" 5 #include "ash/common/new_window_controller.h"
6 #include "ash/common/wm_shell.h" 6 #include "ash/common/wm_shell.h"
7 #include "ash/wm/window_util.h" 7 #include "ash/wm/window_util.h"
8 #include "chrome/browser/profiles/profile_manager.h" 8 #include "chrome/browser/profiles/profile_manager.h"
9 #include "chrome/browser/ui/browser_finder.h" 9 #include "chrome/browser/ui/browser_finder.h"
10 #include "chrome/browser/ui/browser_window.h" 10 #include "chrome/browser/ui/browser_window.h"
11 #include "chrome/test/base/in_process_browser_test.h" 11 #include "chrome/test/base/in_process_browser_test.h"
12 #include "components/session_manager/core/session_manager.h" 12 #include "components/session_manager/core/session_manager.h"
13 #include "components/signin/core/account_id/account_id.h" 13 #include "components/signin/core/account_id/account_id.h"
14 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
15 #include "ui/aura/window.h" 15 #include "ui/aura/window.h"
16 16
17 namespace { 17 namespace {
18 18
19 const char kTestUserName1[] = "test1@test.com"; 19 const char kTestUserName1[] = "test1@test.com";
20 const char kTestUserName2[] = "test2@test.com"; 20 const char kTestUserName2[] = "test2@test.com";
21 21
22 } // namespace 22 } // namespace
23 23
24 using ChromeNewWindowClientBrowserTest = InProcessBrowserTest; 24 using ChromeNewWindowClientBrowserTest = InProcessBrowserTest;
25 25
26 // Tests that when we open a new window by pressing 'Ctrl-N', we should use the 26 // Tests that when we open a new window by pressing 'Ctrl-N', we should use the
27 // current active window's profile to determine on which profile's desktop we 27 // current active window's profile to determine the new browser's profile.
28 // should open a new window.
29 IN_PROC_BROWSER_TEST_F(ChromeNewWindowClientBrowserTest, 28 IN_PROC_BROWSER_TEST_F(ChromeNewWindowClientBrowserTest,
30 NewWindowForActiveWindowProfileTest) { 29 NewWindowForActiveWindowProfileTest) {
31 session_manager::SessionManager::Get()->CreateSession( 30 session_manager::SessionManager::Get()->CreateSession(
32 AccountId::FromUserEmail(kTestUserName1), kTestUserName1); 31 AccountId::FromUserEmail(kTestUserName1), kTestUserName1);
33 Profile* profile1 = ProfileManager::GetActiveUserProfile(); 32 Profile* profile1 = ProfileManager::GetActiveUserProfile();
34 Browser* browser1 = CreateBrowser(profile1); 33 Browser* browser1 = CreateBrowser(profile1);
35 // The newly created window should be created for the current active profile. 34 // The newly created window should be created for the current active profile.
36 ash::WmShell::Get()->new_window_controller()->NewWindow(false); 35 ash::WmShell::Get()->new_window_controller()->NewWindow(false);
37 EXPECT_EQ( 36 EXPECT_EQ(
38 chrome::FindBrowserWithWindow(ash::wm::GetActiveWindow())->profile(), 37 chrome::FindBrowserWithWindow(ash::wm::GetActiveWindow())->profile(),
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 71
73 // The newly created incoginito window should be created against the current 72 // The newly created incoginito window should be created against the current
74 // active |browser2|'s profile. 73 // active |browser2|'s profile.
75 browser2->window()->Show(); 74 browser2->window()->Show();
76 ash::WmShell::Get()->new_window_controller()->NewWindow(true); 75 ash::WmShell::Get()->new_window_controller()->NewWindow(true);
77 EXPECT_EQ(chrome::FindBrowserWithWindow(ash::wm::GetActiveWindow()) 76 EXPECT_EQ(chrome::FindBrowserWithWindow(ash::wm::GetActiveWindow())
78 ->profile() 77 ->profile()
79 ->GetOriginalProfile(), 78 ->GetOriginalProfile(),
80 profile2); 79 profile2);
81 } 80 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698