| 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 "base/memory/scoped_ptr.h" |
| 6 #include "base/message_loop.h" | 6 #include "base/message_loop.h" |
| 7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
| 8 #include "chrome/browser/extensions/default_apps.h" | 8 #include "chrome/browser/extensions/default_apps.h" |
| 9 #include "chrome/browser/extensions/external_pref_loader.h" | 9 #include "chrome/browser/extensions/external_pref_loader.h" |
| 10 #include "chrome/common/chrome_paths.h" | 10 #include "chrome/common/chrome_paths.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 public: | 22 public: |
| 23 MockExternalLoader() {} | 23 MockExternalLoader() {} |
| 24 | 24 |
| 25 virtual void StartLoading() OVERRIDE {} | 25 virtual void StartLoading() OVERRIDE {} |
| 26 private: | 26 private: |
| 27 virtual ~MockExternalLoader() {} | 27 virtual ~MockExternalLoader() {} |
| 28 }; | 28 }; |
| 29 | 29 |
| 30 class DefaultAppsTest : public testing::Test { | 30 class DefaultAppsTest : public testing::Test { |
| 31 public: | 31 public: |
| 32 DefaultAppsTest() : loop_(MessageLoop::TYPE_IO), | 32 DefaultAppsTest() |
| 33 ui_thread_(content::BrowserThread::UI, &loop_) {} | 33 : loop_(base::MessageLoop::TYPE_IO), |
| 34 ui_thread_(content::BrowserThread::UI, &loop_) {} |
| 34 virtual ~DefaultAppsTest() {} | 35 virtual ~DefaultAppsTest() {} |
| 35 private: | 36 private: |
| 36 MessageLoop loop_; | 37 base::MessageLoop loop_; |
| 37 content::TestBrowserThread ui_thread_; | 38 content::TestBrowserThread ui_thread_; |
| 38 }; | 39 }; |
| 39 | 40 |
| 40 #if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) | 41 #if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) |
| 41 // Chrome OS has different way of installing default apps. | 42 // Chrome OS has different way of installing default apps. |
| 42 // Android does not currently support installing apps via Chrome. | 43 // Android does not currently support installing apps via Chrome. |
| 43 TEST_F(DefaultAppsTest, Install) { | 44 TEST_F(DefaultAppsTest, Install) { |
| 44 scoped_ptr<TestingProfile> profile(new TestingProfile()); | 45 scoped_ptr<TestingProfile> profile(new TestingProfile()); |
| 45 ExternalLoader* loader = new MockExternalLoader(); | 46 ExternalLoader* loader = new MockExternalLoader(); |
| 46 | 47 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 // even if the profile version is older than Chrome version. | 87 // even if the profile version is older than Chrome version. |
| 87 profile->GetPrefs()->SetInteger(prefs::kDefaultAppsInstallState, | 88 profile->GetPrefs()->SetInteger(prefs::kDefaultAppsInstallState, |
| 88 default_apps::kProvideLegacyDefaultApps); | 89 default_apps::kProvideLegacyDefaultApps); |
| 89 EXPECT_TRUE(provider2.ShouldInstallInProfile()); | 90 EXPECT_TRUE(provider2.ShouldInstallInProfile()); |
| 90 state = profile->GetPrefs()->GetInteger(prefs::kDefaultAppsInstallState); | 91 state = profile->GetPrefs()->GetInteger(prefs::kDefaultAppsInstallState); |
| 91 EXPECT_TRUE(state == default_apps::kAlreadyInstalledDefaultApps); | 92 EXPECT_TRUE(state == default_apps::kAlreadyInstalledDefaultApps); |
| 92 } | 93 } |
| 93 #endif | 94 #endif |
| 94 | 95 |
| 95 } // namespace extensions | 96 } // namespace extensions |
| OLD | NEW |