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

Side by Side Diff: chrome/browser/extensions/api/signed_in_devices/signed_in_devices_manager_unittest.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 #include "base/memory/scoped_ptr.h"
6 #include "chrome/browser/extensions/api/signed_in_devices/signed_in_devices_mana ger.h" 5 #include "chrome/browser/extensions/api/signed_in_devices/signed_in_devices_mana ger.h"
6
7 #include <memory>
8
7 #include "chrome/browser/signin/signin_manager_factory.h" 9 #include "chrome/browser/signin/signin_manager_factory.h"
8 #include "chrome/browser/sync/profile_sync_service_factory.h" 10 #include "chrome/browser/sync/profile_sync_service_factory.h"
9 #include "chrome/common/extensions/api/signed_in_devices.h" 11 #include "chrome/common/extensions/api/signed_in_devices.h"
10 #include "chrome/common/pref_names.h" 12 #include "chrome/common/pref_names.h"
11 #include "chrome/test/base/testing_profile.h" 13 #include "chrome/test/base/testing_profile.h"
12 #include "components/prefs/pref_service.h" 14 #include "components/prefs/pref_service.h"
13 #include "components/prefs/testing_pref_store.h" 15 #include "components/prefs/testing_pref_store.h"
14 #include "components/signin/core/browser/signin_manager.h" 16 #include "components/signin/core/browser/signin_manager.h"
15 #include "content/public/test/test_browser_thread_bundle.h" 17 #include "content/public/test/test_browser_thread_bundle.h"
16 #include "extensions/browser/event_router.h" 18 #include "extensions/browser/event_router.h"
17 #include "testing/gmock/include/gmock/gmock.h" 19 #include "testing/gmock/include/gmock/gmock.h"
18 #include "testing/gtest/include/gtest/gtest.h" 20 #include "testing/gtest/include/gtest/gtest.h"
19 21
20 namespace extensions { 22 namespace extensions {
21 23
22 // Adds a listener and removes it. 24 // Adds a listener and removes it.
23 TEST(SignedInDevicesManager, UpdateListener) { 25 TEST(SignedInDevicesManager, UpdateListener) {
24 content::TestBrowserThreadBundle thread_bundle; 26 content::TestBrowserThreadBundle thread_bundle;
25 scoped_ptr<TestingProfile> profile(new TestingProfile()); 27 std::unique_ptr<TestingProfile> profile(new TestingProfile());
26 SigninManagerFactory::GetForProfile(profile.get())-> 28 SigninManagerFactory::GetForProfile(profile.get())->
27 SetAuthenticatedAccountInfo("gaia_id", "foo"); 29 SetAuthenticatedAccountInfo("gaia_id", "foo");
28 ProfileSyncServiceFactory::GetInstance()->SetTestingFactory(profile.get(), 30 ProfileSyncServiceFactory::GetInstance()->SetTestingFactory(profile.get(),
29 nullptr); 31 nullptr);
30 SignedInDevicesManager manager(profile.get()); 32 SignedInDevicesManager manager(profile.get());
31 33
32 EventListenerInfo info(api::signed_in_devices::OnDeviceInfoChange::kEventName, 34 EventListenerInfo info(api::signed_in_devices::OnDeviceInfoChange::kEventName,
33 "extension1", 35 "extension1",
34 GURL(), 36 GURL(),
35 profile.get()); 37 profile.get());
36 38
37 // Add a listener. 39 // Add a listener.
38 manager.OnListenerAdded(info); 40 manager.OnListenerAdded(info);
39 EXPECT_EQ(manager.change_observers_.size(), 1U); 41 EXPECT_EQ(manager.change_observers_.size(), 1U);
40 EXPECT_EQ(manager.change_observers_[0]->extension_id(), info.extension_id); 42 EXPECT_EQ(manager.change_observers_[0]->extension_id(), info.extension_id);
41 43
42 // Remove the listener. 44 // Remove the listener.
43 manager.OnListenerRemoved(info); 45 manager.OnListenerRemoved(info);
44 EXPECT_TRUE(manager.change_observers_.empty()); 46 EXPECT_TRUE(manager.change_observers_.empty());
45 } 47 }
46 } // namespace extensions 48 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698