OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |