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

Side by Side Diff: chrome/browser/ui/browser_finder_chromeos_unittest.cc

Issue 1661713002: Remove the rest of HostDesktopType from c/b/ui/browser_finder.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@metro-mode-11
Patch Set: linux adl Created 4 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
« no previous file with comments | « chrome/browser/ui/browser_finder.cc ('k') | chrome/browser/ui/browser_navigator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 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/browser_finder.h" 5 #include "chrome/browser/ui/browser_finder.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" 8 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h"
9 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" 9 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h"
10 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h" 10 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 82
83 TestingProfile* second_profile_; 83 TestingProfile* second_profile_;
84 scoped_ptr<TestingProfileManager> profile_manager_; 84 scoped_ptr<TestingProfileManager> profile_manager_;
85 chrome::MultiUserWindowManagerChromeOS* multi_user_window_manager_; 85 chrome::MultiUserWindowManagerChromeOS* multi_user_window_manager_;
86 86
87 DISALLOW_COPY_AND_ASSIGN(BrowserFinderChromeOSTest); 87 DISALLOW_COPY_AND_ASSIGN(BrowserFinderChromeOSTest);
88 }; 88 };
89 89
90 TEST_F(BrowserFinderChromeOSTest, IncognitoBrowserMatchTest) { 90 TEST_F(BrowserFinderChromeOSTest, IncognitoBrowserMatchTest) {
91 // GetBrowserCount() use kMatchAll to find all browser windows for profile(). 91 // GetBrowserCount() use kMatchAll to find all browser windows for profile().
92 EXPECT_EQ(1u, 92 EXPECT_EQ(1u, chrome::GetBrowserCount(profile()));
93 chrome::GetBrowserCount(profile(), chrome::HOST_DESKTOP_TYPE_ASH)); 93 EXPECT_TRUE(chrome::FindAnyBrowser(profile(), true));
94 EXPECT_TRUE( 94 EXPECT_TRUE(chrome::FindAnyBrowser(profile(), false));
95 chrome::FindAnyBrowser(profile(), true, chrome::HOST_DESKTOP_TYPE_ASH));
96 EXPECT_TRUE(
97 chrome::FindAnyBrowser(profile(), false, chrome::HOST_DESKTOP_TYPE_ASH));
98 set_browser(nullptr); 95 set_browser(nullptr);
99 96
100 // Create an incognito browser. 97 // Create an incognito browser.
101 Browser::CreateParams params(profile()->GetOffTheRecordProfile(), 98 Browser::CreateParams params(profile()->GetOffTheRecordProfile(),
102 chrome::HOST_DESKTOP_TYPE_ASH); 99 chrome::HOST_DESKTOP_TYPE_ASH);
103 scoped_ptr<Browser> incognito_browser( 100 scoped_ptr<Browser> incognito_browser(
104 chrome::CreateBrowserWithAuraTestWindowForParams(nullptr, &params)); 101 chrome::CreateBrowserWithAuraTestWindowForParams(nullptr, &params));
105 // Incognito windows are excluded in GetBrowserCount() because kMatchAll 102 // Incognito windows are excluded in GetBrowserCount() because kMatchAll
106 // doesn't match original profile of the browser with the given profile. 103 // doesn't match original profile of the browser with the given profile.
107 EXPECT_EQ(0u, 104 EXPECT_EQ(0u, chrome::GetBrowserCount(profile()));
108 chrome::GetBrowserCount(profile(), chrome::HOST_DESKTOP_TYPE_ASH)); 105 EXPECT_TRUE(chrome::FindAnyBrowser(profile(), true));
109 EXPECT_TRUE( 106 EXPECT_FALSE(chrome::FindAnyBrowser(profile(), false));
110 chrome::FindAnyBrowser(profile(), true, chrome::HOST_DESKTOP_TYPE_ASH));
111 EXPECT_FALSE(
112 chrome::FindAnyBrowser(profile(), false, chrome::HOST_DESKTOP_TYPE_ASH));
113 } 107 }
114 108
115 TEST_F(BrowserFinderChromeOSTest, FindBrowserOwnedByAnotherProfile) { 109 TEST_F(BrowserFinderChromeOSTest, FindBrowserOwnedByAnotherProfile) {
116 set_browser(nullptr); 110 set_browser(nullptr);
117 111
118 Browser::CreateParams params(profile()->GetOriginalProfile(), 112 Browser::CreateParams params(profile()->GetOriginalProfile(),
119 chrome::HOST_DESKTOP_TYPE_ASH); 113 chrome::HOST_DESKTOP_TYPE_ASH);
120 scoped_ptr<Browser> browser( 114 scoped_ptr<Browser> browser(
121 chrome::CreateBrowserWithAuraTestWindowForParams(nullptr, &params)); 115 chrome::CreateBrowserWithAuraTestWindowForParams(nullptr, &params));
122 GetUserWindowManager()->SetWindowOwner(browser->window()->GetNativeWindow(), 116 GetUserWindowManager()->SetWindowOwner(browser->window()->GetNativeWindow(),
123 test_account_id1_); 117 test_account_id1_);
124 EXPECT_EQ(1u, 118 EXPECT_EQ(1u, chrome::GetBrowserCount(profile()));
125 chrome::GetBrowserCount(profile(), chrome::HOST_DESKTOP_TYPE_ASH)); 119 EXPECT_TRUE(chrome::FindAnyBrowser(profile(), true));
126 EXPECT_TRUE( 120 EXPECT_TRUE(chrome::FindAnyBrowser(profile(), false));
127 chrome::FindAnyBrowser(profile(), true, chrome::HOST_DESKTOP_TYPE_ASH));
128 EXPECT_TRUE(
129 chrome::FindAnyBrowser(profile(), false, chrome::HOST_DESKTOP_TYPE_ASH));
130 121
131 // Move the browser window to another user's desktop. Then no window should 122 // Move the browser window to another user's desktop. Then no window should
132 // be available for the current profile. 123 // be available for the current profile.
133 GetUserWindowManager()->ShowWindowForUser( 124 GetUserWindowManager()->ShowWindowForUser(
134 browser->window()->GetNativeWindow(), test_account_id2_); 125 browser->window()->GetNativeWindow(), test_account_id2_);
135 EXPECT_EQ(0u, 126 EXPECT_EQ(0u, chrome::GetBrowserCount(profile()));
136 chrome::GetBrowserCount(profile(), chrome::HOST_DESKTOP_TYPE_ASH)); 127 EXPECT_FALSE(chrome::FindAnyBrowser(profile(), true));
137 EXPECT_FALSE( 128 EXPECT_FALSE(chrome::FindAnyBrowser(profile(), false));
138 chrome::FindAnyBrowser(profile(), true, chrome::HOST_DESKTOP_TYPE_ASH));
139 EXPECT_FALSE(
140 chrome::FindAnyBrowser(profile(), false, chrome::HOST_DESKTOP_TYPE_ASH));
141 } 129 }
142 130
143 } // namespace test 131 } // namespace test
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser_finder.cc ('k') | chrome/browser/ui/browser_navigator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698