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

Side by Side Diff: chrome/browser/extensions/default_apps_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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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" 5 #include "chrome/browser/extensions/default_apps.h"
6
7 #include <memory>
8
6 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
7 #include "build/build_config.h" 10 #include "build/build_config.h"
8 #include "chrome/browser/extensions/default_apps.h"
9 #include "chrome/browser/extensions/external_pref_loader.h" 11 #include "chrome/browser/extensions/external_pref_loader.h"
10 #include "chrome/common/chrome_paths.h" 12 #include "chrome/common/chrome_paths.h"
11 #include "chrome/common/pref_names.h" 13 #include "chrome/common/pref_names.h"
12 #include "chrome/test/base/testing_profile.h" 14 #include "chrome/test/base/testing_profile.h"
13 #include "components/prefs/pref_service.h" 15 #include "components/prefs/pref_service.h"
14 #include "content/public/test/test_browser_thread.h" 16 #include "content/public/test/test_browser_thread.h"
15 #include "extensions/common/extension.h" 17 #include "extensions/common/extension.h"
16 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
17 19
18 using default_apps::Provider; 20 using default_apps::Provider;
(...skipping 17 matching lines...) Expand all
36 38
37 private: 39 private:
38 base::MessageLoopForIO loop_; 40 base::MessageLoopForIO loop_;
39 content::TestBrowserThread ui_thread_; 41 content::TestBrowserThread ui_thread_;
40 }; 42 };
41 43
42 #if !defined(OS_CHROMEOS) 44 #if !defined(OS_CHROMEOS)
43 // Chrome OS has different way of installing default apps. 45 // Chrome OS has different way of installing default apps.
44 // Android does not currently support installing apps via Chrome. 46 // Android does not currently support installing apps via Chrome.
45 TEST_F(DefaultAppsTest, Install) { 47 TEST_F(DefaultAppsTest, Install) {
46 scoped_ptr<TestingProfile> profile(new TestingProfile()); 48 std::unique_ptr<TestingProfile> profile(new TestingProfile());
47 ExternalLoader* loader = new MockExternalLoader(); 49 ExternalLoader* loader = new MockExternalLoader();
48 50
49 Provider provider(profile.get(), NULL, loader, Manifest::INTERNAL, 51 Provider provider(profile.get(), NULL, loader, Manifest::INTERNAL,
50 Manifest::INTERNAL, Extension::NO_FLAGS); 52 Manifest::INTERNAL, Extension::NO_FLAGS);
51 53
52 // The default apps should be installed if kDefaultAppsInstallState 54 // The default apps should be installed if kDefaultAppsInstallState
53 // is unknown. 55 // is unknown.
54 EXPECT_TRUE(provider.ShouldInstallInProfile()); 56 EXPECT_TRUE(provider.ShouldInstallInProfile());
55 int state = profile->GetPrefs()->GetInteger(prefs::kDefaultAppsInstallState); 57 int state = profile->GetPrefs()->GetInteger(prefs::kDefaultAppsInstallState);
56 EXPECT_TRUE(state == default_apps::kAlreadyInstalledDefaultApps); 58 EXPECT_TRUE(state == default_apps::kAlreadyInstalledDefaultApps);
(...skipping 30 matching lines...) Expand all
87 // even if the profile version is older than Chrome version. 89 // even if the profile version is older than Chrome version.
88 profile->GetPrefs()->SetInteger(prefs::kDefaultAppsInstallState, 90 profile->GetPrefs()->SetInteger(prefs::kDefaultAppsInstallState,
89 default_apps::kProvideLegacyDefaultApps); 91 default_apps::kProvideLegacyDefaultApps);
90 EXPECT_TRUE(provider2.ShouldInstallInProfile()); 92 EXPECT_TRUE(provider2.ShouldInstallInProfile());
91 state = profile->GetPrefs()->GetInteger(prefs::kDefaultAppsInstallState); 93 state = profile->GetPrefs()->GetInteger(prefs::kDefaultAppsInstallState);
92 EXPECT_TRUE(state == default_apps::kAlreadyInstalledDefaultApps); 94 EXPECT_TRUE(state == default_apps::kAlreadyInstalledDefaultApps);
93 } 95 }
94 #endif 96 #endif
95 97
96 } // namespace extensions 98 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/crx_installer_browsertest.cc ('k') | chrome/browser/extensions/display_info_provider_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698