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

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

Issue 1865213004: Convert //chrome/browser/ui from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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 (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 "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/test/ash_test_helper.h" 8 #include "ash/test/ash_test_helper.h"
9 #include "ash/test/test_session_state_delegate.h" 9 #include "ash/test/test_session_state_delegate.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 79
80 TestingProfile* CreateProfile() override { 80 TestingProfile* CreateProfile() override {
81 return CreateMultiUserProfile(test_account_id1_); 81 return CreateMultiUserProfile(test_account_id1_);
82 } 82 }
83 83
84 void DestroyProfile(TestingProfile* test_profile) override { 84 void DestroyProfile(TestingProfile* test_profile) override {
85 profile_manager_->DeleteTestingProfile(test_profile->GetProfileUserName()); 85 profile_manager_->DeleteTestingProfile(test_profile->GetProfileUserName());
86 } 86 }
87 87
88 TestingProfile* second_profile_; 88 TestingProfile* second_profile_;
89 scoped_ptr<TestingProfileManager> profile_manager_; 89 std::unique_ptr<TestingProfileManager> profile_manager_;
90 chrome::MultiUserWindowManagerChromeOS* multi_user_window_manager_; 90 chrome::MultiUserWindowManagerChromeOS* multi_user_window_manager_;
91 91
92 DISALLOW_COPY_AND_ASSIGN(BrowserFinderChromeOSTest); 92 DISALLOW_COPY_AND_ASSIGN(BrowserFinderChromeOSTest);
93 }; 93 };
94 94
95 TEST_F(BrowserFinderChromeOSTest, IncognitoBrowserMatchTest) { 95 TEST_F(BrowserFinderChromeOSTest, IncognitoBrowserMatchTest) {
96 // GetBrowserCount() use kMatchAll to find all browser windows for profile(). 96 // GetBrowserCount() use kMatchAll to find all browser windows for profile().
97 EXPECT_EQ(1u, chrome::GetBrowserCount(profile())); 97 EXPECT_EQ(1u, chrome::GetBrowserCount(profile()));
98 EXPECT_TRUE(chrome::FindAnyBrowser(profile(), true)); 98 EXPECT_TRUE(chrome::FindAnyBrowser(profile(), true));
99 EXPECT_TRUE(chrome::FindAnyBrowser(profile(), false)); 99 EXPECT_TRUE(chrome::FindAnyBrowser(profile(), false));
100 set_browser(nullptr); 100 set_browser(nullptr);
101 101
102 // Create an incognito browser. 102 // Create an incognito browser.
103 Browser::CreateParams params(profile()->GetOffTheRecordProfile()); 103 Browser::CreateParams params(profile()->GetOffTheRecordProfile());
104 scoped_ptr<Browser> incognito_browser( 104 std::unique_ptr<Browser> incognito_browser(
105 chrome::CreateBrowserWithAuraTestWindowForParams(nullptr, &params)); 105 chrome::CreateBrowserWithAuraTestWindowForParams(nullptr, &params));
106 // Incognito windows are excluded in GetBrowserCount() because kMatchAll 106 // Incognito windows are excluded in GetBrowserCount() because kMatchAll
107 // doesn't match original profile of the browser with the given profile. 107 // doesn't match original profile of the browser with the given profile.
108 EXPECT_EQ(0u, chrome::GetBrowserCount(profile())); 108 EXPECT_EQ(0u, chrome::GetBrowserCount(profile()));
109 EXPECT_TRUE(chrome::FindAnyBrowser(profile(), true)); 109 EXPECT_TRUE(chrome::FindAnyBrowser(profile(), true));
110 EXPECT_FALSE(chrome::FindAnyBrowser(profile(), false)); 110 EXPECT_FALSE(chrome::FindAnyBrowser(profile(), false));
111 } 111 }
112 112
113 TEST_F(BrowserFinderChromeOSTest, FindBrowserOwnedByAnotherProfile) { 113 TEST_F(BrowserFinderChromeOSTest, FindBrowserOwnedByAnotherProfile) {
114 set_browser(nullptr); 114 set_browser(nullptr);
115 115
116 Browser::CreateParams params(profile()->GetOriginalProfile()); 116 Browser::CreateParams params(profile()->GetOriginalProfile());
117 scoped_ptr<Browser> browser( 117 std::unique_ptr<Browser> browser(
118 chrome::CreateBrowserWithAuraTestWindowForParams(nullptr, &params)); 118 chrome::CreateBrowserWithAuraTestWindowForParams(nullptr, &params));
119 GetUserWindowManager()->SetWindowOwner(browser->window()->GetNativeWindow(), 119 GetUserWindowManager()->SetWindowOwner(browser->window()->GetNativeWindow(),
120 test_account_id1_); 120 test_account_id1_);
121 EXPECT_EQ(1u, chrome::GetBrowserCount(profile())); 121 EXPECT_EQ(1u, chrome::GetBrowserCount(profile()));
122 EXPECT_TRUE(chrome::FindAnyBrowser(profile(), true)); 122 EXPECT_TRUE(chrome::FindAnyBrowser(profile(), true));
123 EXPECT_TRUE(chrome::FindAnyBrowser(profile(), false)); 123 EXPECT_TRUE(chrome::FindAnyBrowser(profile(), false));
124 124
125 // Move the browser window to another user's desktop. Then no window should 125 // Move the browser window to another user's desktop. Then no window should
126 // be available for the current profile. 126 // be available for the current profile.
127 GetUserWindowManager()->ShowWindowForUser( 127 GetUserWindowManager()->ShowWindowForUser(
128 browser->window()->GetNativeWindow(), test_account_id2_); 128 browser->window()->GetNativeWindow(), test_account_id2_);
129 EXPECT_EQ(0u, chrome::GetBrowserCount(profile())); 129 EXPECT_EQ(0u, chrome::GetBrowserCount(profile()));
130 EXPECT_FALSE(chrome::FindAnyBrowser(profile(), true)); 130 EXPECT_FALSE(chrome::FindAnyBrowser(profile(), true));
131 EXPECT_FALSE(chrome::FindAnyBrowser(profile(), false)); 131 EXPECT_FALSE(chrome::FindAnyBrowser(profile(), false));
132 } 132 }
133 133
134 } // namespace test 134 } // namespace test
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser_command_controller_unittest.cc ('k') | chrome/browser/ui/browser_instant_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698