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

Side by Side Diff: chrome/browser/ui/cocoa/profiles/profile_menu_controller_unittest.mm

Issue 2685333005: ash: fix regression where ctrl+n put new window on wrong desktop (Closed)
Patch Set: We have both kinds of compile fixes: mac and windows 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #import "chrome/browser/ui/cocoa/profiles/profile_menu_controller.h" 5 #import "chrome/browser/ui/cocoa/profiles/profile_menu_controller.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/mac/scoped_nsobject.h" 9 #include "base/mac/scoped_nsobject.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 // BrowserWindow::Show() and when a Browser becomes active. We don't need a full 197 // BrowserWindow::Show() and when a Browser becomes active. We don't need a full
198 // BrowserWindow, so it is called manually. 198 // BrowserWindow, so it is called manually.
199 TEST_F(ProfileMenuControllerTest, SetActiveAndRemove) { 199 TEST_F(ProfileMenuControllerTest, SetActiveAndRemove) {
200 NSMenu* menu = [controller() menu]; 200 NSMenu* menu = [controller() menu];
201 TestingProfileManager* manager = testing_profile_manager(); 201 TestingProfileManager* manager = testing_profile_manager();
202 TestingProfile* profile2 = manager->CreateTestingProfile("Profile 2"); 202 TestingProfile* profile2 = manager->CreateTestingProfile("Profile 2");
203 TestingProfile* profile3 = manager->CreateTestingProfile("Profile 3"); 203 TestingProfile* profile3 = manager->CreateTestingProfile("Profile 3");
204 ASSERT_EQ(7, [menu numberOfItems]); 204 ASSERT_EQ(7, [menu numberOfItems]);
205 205
206 // Create a browser and "show" it. 206 // Create a browser and "show" it.
207 Browser::CreateParams profile2_params(profile2); 207 Browser::CreateParams profile2_params(profile2, true);
208 std::unique_ptr<Browser> p2_browser( 208 std::unique_ptr<Browser> p2_browser(
209 chrome::CreateBrowserWithTestWindowForParams(&profile2_params)); 209 chrome::CreateBrowserWithTestWindowForParams(&profile2_params));
210 BrowserList::SetLastActive(p2_browser.get()); 210 BrowserList::SetLastActive(p2_browser.get());
211 VerifyProfileNamedIsActive(@"Profile 2", __LINE__); 211 VerifyProfileNamedIsActive(@"Profile 2", __LINE__);
212 212
213 // Close the browser and make sure it's still active. 213 // Close the browser and make sure it's still active.
214 p2_browser.reset(); 214 p2_browser.reset();
215 VerifyProfileNamedIsActive(@"Profile 2", __LINE__); 215 VerifyProfileNamedIsActive(@"Profile 2", __LINE__);
216 216
217 // Open a new browser and make sure it takes effect. 217 // Open a new browser and make sure it takes effect.
218 Browser::CreateParams profile3_params(profile3); 218 Browser::CreateParams profile3_params(profile3, true);
219 std::unique_ptr<Browser> p3_browser( 219 std::unique_ptr<Browser> p3_browser(
220 chrome::CreateBrowserWithTestWindowForParams(&profile3_params)); 220 chrome::CreateBrowserWithTestWindowForParams(&profile3_params));
221 BrowserList::SetLastActive(p3_browser.get()); 221 BrowserList::SetLastActive(p3_browser.get());
222 VerifyProfileNamedIsActive(@"Profile 3", __LINE__); 222 VerifyProfileNamedIsActive(@"Profile 3", __LINE__);
223 223
224 p3_browser.reset(); 224 p3_browser.reset();
225 VerifyProfileNamedIsActive(@"Profile 3", __LINE__); 225 VerifyProfileNamedIsActive(@"Profile 3", __LINE__);
226 } 226 }
227 227
228 TEST_F(ProfileMenuControllerTest, DeleteActiveProfile) { 228 TEST_F(ProfileMenuControllerTest, DeleteActiveProfile) {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 275
276 item = [menu itemAtIndex:1]; 276 item = [menu itemAtIndex:1];
277 ASSERT_EQ(@selector(switchToProfileFromMenu:), [item action]); 277 ASSERT_EQ(@selector(switchToProfileFromMenu:), [item action]);
278 EXPECT_TRUE([controller() validateMenuItem:item]); 278 EXPECT_TRUE([controller() validateMenuItem:item]);
279 279
280 item = [menu itemAtIndex:5]; 280 item = [menu itemAtIndex:5];
281 ASSERT_EQ(@selector(newProfile:), [item action]); 281 ASSERT_EQ(@selector(newProfile:), [item action]);
282 EXPECT_TRUE([controller() validateMenuItem:item]); 282 EXPECT_TRUE([controller() validateMenuItem:item]);
283 283
284 // Open a new browser for the supervised user and switch to it. 284 // Open a new browser for the supervised user and switch to it.
285 Browser::CreateParams supervised_profile_params(supervised_profile); 285 Browser::CreateParams supervised_profile_params(supervised_profile, true);
286 std::unique_ptr<Browser> supervised_browser( 286 std::unique_ptr<Browser> supervised_browser(
287 chrome::CreateBrowserWithTestWindowForParams(&supervised_profile_params)); 287 chrome::CreateBrowserWithTestWindowForParams(&supervised_profile_params));
288 BrowserList::SetLastActive(supervised_browser.get()); 288 BrowserList::SetLastActive(supervised_browser.get());
289 289
290 item = [menu itemAtIndex:0]; 290 item = [menu itemAtIndex:0];
291 ASSERT_EQ(@selector(switchToProfileFromMenu:), [item action]); 291 ASSERT_EQ(@selector(switchToProfileFromMenu:), [item action]);
292 EXPECT_FALSE([controller() validateMenuItem:item]); 292 EXPECT_FALSE([controller() validateMenuItem:item]);
293 293
294 item = [menu itemAtIndex:1]; 294 item = [menu itemAtIndex:1];
295 ASSERT_EQ(@selector(switchToProfileFromMenu:), [item action]); 295 ASSERT_EQ(@selector(switchToProfileFromMenu:), [item action]);
296 EXPECT_TRUE([controller() validateMenuItem:item]); 296 EXPECT_TRUE([controller() validateMenuItem:item]);
297 297
298 item = [menu itemAtIndex:5]; 298 item = [menu itemAtIndex:5];
299 ASSERT_EQ(@selector(newProfile:), [item action]); 299 ASSERT_EQ(@selector(newProfile:), [item action]);
300 EXPECT_FALSE([controller() validateMenuItem:item]); 300 EXPECT_FALSE([controller() validateMenuItem:item]);
301 } 301 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698