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

Side by Side Diff: chrome/browser/extensions/api/braille_display_private/braille_display_private_apitest.cc

Issue 1871713002: Convert //chrome/browser/extensions from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and fix header 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 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 #ifndef USE_BRLAPI 5 #ifndef USE_BRLAPI
6 #error This test requires brlapi. 6 #error This test requires brlapi.
7 #endif 7 #endif
8 8
9 #include <stddef.h> 9 #include <stddef.h>
10 10
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 162
163 // By default, don't let the accessibility manager interfere and 163 // By default, don't let the accessibility manager interfere and
164 // steal events. Some tests override this to keep the normal behaviour 164 // steal events. Some tests override this to keep the normal behaviour
165 // of the accessibility manager. 165 // of the accessibility manager.
166 virtual void DisableAccessibilityManagerBraille() { 166 virtual void DisableAccessibilityManagerBraille() {
167 chromeos::AccessibilityManager::SetBrailleControllerForTest( 167 chromeos::AccessibilityManager::SetBrailleControllerForTest(
168 &stub_braille_controller_); 168 &stub_braille_controller_);
169 } 169 }
170 170
171 private: 171 private:
172 scoped_ptr<BrlapiConnection> CreateBrlapiConnection() { 172 std::unique_ptr<BrlapiConnection> CreateBrlapiConnection() {
173 return scoped_ptr<BrlapiConnection>( 173 return std::unique_ptr<BrlapiConnection>(
174 new MockBrlapiConnection(&connection_data_)); 174 new MockBrlapiConnection(&connection_data_));
175 } 175 }
176 176
177 StubBrailleController stub_braille_controller_; 177 StubBrailleController stub_braille_controller_;
178 }; 178 };
179 179
180 IN_PROC_BROWSER_TEST_F(BrailleDisplayPrivateApiTest, WriteDots) { 180 IN_PROC_BROWSER_TEST_F(BrailleDisplayPrivateApiTest, WriteDots) {
181 connection_data_.display_size = 11; 181 connection_data_.display_size = 11;
182 ASSERT_TRUE(RunComponentExtensionTest("braille_display_private/write_dots")) 182 ASSERT_TRUE(RunComponentExtensionTest("braille_display_private/write_dots"))
183 << message_; 183 << message_;
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 command_line->AppendSwitchASCII(chromeos::switches::kLoginProfile, 270 command_line->AppendSwitchASCII(chromeos::switches::kLoginProfile,
271 TestingProfile::kTestUserProfileDir); 271 TestingProfile::kTestUserProfileDir);
272 } 272 }
273 273
274 class MockEventDelegate : public BrailleDisplayPrivateAPI::EventDelegate { 274 class MockEventDelegate : public BrailleDisplayPrivateAPI::EventDelegate {
275 public: 275 public:
276 MockEventDelegate() : event_count_(0) {} 276 MockEventDelegate() : event_count_(0) {}
277 277
278 int GetEventCount() { return event_count_; } 278 int GetEventCount() { return event_count_; }
279 279
280 void BroadcastEvent(scoped_ptr<Event> event) override { ++event_count_; } 280 void BroadcastEvent(std::unique_ptr<Event> event) override {
281 ++event_count_;
282 }
281 bool HasListener() override { return true; } 283 bool HasListener() override { return true; }
282 284
283 private: 285 private:
284 int event_count_; 286 int event_count_;
285 }; 287 };
286 288
287 MockEventDelegate* SetMockEventDelegate(BrailleDisplayPrivateAPI* api) { 289 MockEventDelegate* SetMockEventDelegate(BrailleDisplayPrivateAPI* api) {
288 MockEventDelegate* delegate = new MockEventDelegate(); 290 MockEventDelegate* delegate = new MockEventDelegate();
289 api->SetEventDelegateForTest( 291 api->SetEventDelegateForTest(
290 scoped_ptr<BrailleDisplayPrivateAPI::EventDelegate>(delegate)); 292 std::unique_ptr<BrailleDisplayPrivateAPI::EventDelegate>(delegate));
291 return delegate; 293 return delegate;
292 } 294 }
293 295
294 void LockScreen(ScreenLockerTester* tester) { 296 void LockScreen(ScreenLockerTester* tester) {
295 ScreenLocker::Show(); 297 ScreenLocker::Show();
296 tester->EmulateWindowManagerReady(); 298 tester->EmulateWindowManagerReady();
297 content::WindowedNotificationObserver lock_state_observer( 299 content::WindowedNotificationObserver lock_state_observer(
298 chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED, 300 chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED,
299 content::NotificationService::AllSources()); 301 content::NotificationService::AllSources());
300 if (!tester->IsLocked()) 302 if (!tester->IsLocked())
(...skipping 18 matching lines...) Expand all
319 }; 321 };
320 322
321 // Flakily times out on ChromeOS MSAN bots. See https://crbug.com/592893. 323 // Flakily times out on ChromeOS MSAN bots. See https://crbug.com/592893.
322 #if defined(MEMORY_SANITIZER) 324 #if defined(MEMORY_SANITIZER)
323 #define MAYBE_KeyEventOnLockScreen DISABLED_KeyEventOnLockScreen 325 #define MAYBE_KeyEventOnLockScreen DISABLED_KeyEventOnLockScreen
324 #else 326 #else
325 #define MAYBE_KeyEventOnLockScreen KeyEventOnLockScreen 327 #define MAYBE_KeyEventOnLockScreen KeyEventOnLockScreen
326 #endif 328 #endif
327 IN_PROC_BROWSER_TEST_F(BrailleDisplayPrivateAPIUserTest, 329 IN_PROC_BROWSER_TEST_F(BrailleDisplayPrivateAPIUserTest,
328 MAYBE_KeyEventOnLockScreen) { 330 MAYBE_KeyEventOnLockScreen) {
329 scoped_ptr<ScreenLockerTester> tester(ScreenLocker::GetTester()); 331 std::unique_ptr<ScreenLockerTester> tester(ScreenLocker::GetTester());
330 // Log in. 332 // Log in.
331 user_manager::UserManager::Get()->UserLoggedIn( 333 user_manager::UserManager::Get()->UserLoggedIn(
332 AccountId::FromUserEmail(kTestUserName), kTestUserName, true); 334 AccountId::FromUserEmail(kTestUserName), kTestUserName, true);
333 user_manager::UserManager::Get()->SessionStarted(); 335 user_manager::UserManager::Get()->SessionStarted();
334 Profile* profile = ProfileManager::GetActiveUserProfile(); 336 Profile* profile = ProfileManager::GetActiveUserProfile();
335 ASSERT_FALSE( 337 ASSERT_FALSE(
336 ProfileHelper::GetSigninProfile()->IsSameProfile(profile)) 338 ProfileHelper::GetSigninProfile()->IsSameProfile(profile))
337 << ProfileHelper::GetSigninProfile()->GetDebugName() << " vs. " 339 << ProfileHelper::GetSigninProfile()->GetDebugName() << " vs. "
338 << profile->GetDebugName(); 340 << profile->GetDebugName();
339 341
(...skipping 25 matching lines...) Expand all
365 DismissLockScreen(tester.get()); 367 DismissLockScreen(tester.get());
366 signin_api.OnBrailleKeyEvent(key_event); 368 signin_api.OnBrailleKeyEvent(key_event);
367 user_api.OnBrailleKeyEvent(key_event); 369 user_api.OnBrailleKeyEvent(key_event);
368 EXPECT_EQ(1, signin_delegate->GetEventCount()); 370 EXPECT_EQ(1, signin_delegate->GetEventCount());
369 EXPECT_EQ(2, user_delegate->GetEventCount()); 371 EXPECT_EQ(2, user_delegate->GetEventCount());
370 } 372 }
371 373
372 } // namespace braille_display_private 374 } // namespace braille_display_private
373 } // namespace api 375 } // namespace api
374 } // namespace extensions 376 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698