| 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() : loop_(base::MessageLoop::TYPE_IO), |
| 33 ui_thread_(content::BrowserThread::UI, &loop_) {} | 33 ui_thread_(content::BrowserThread::UI, &loop_) {} |
| 34 virtual ~DefaultAppsTest() {} | 34 virtual ~DefaultAppsTest() {} |
| 35 private: | 35 private: |
| 36 MessageLoop loop_; | 36 base::MessageLoop loop_; |
| 37 content::TestBrowserThread ui_thread_; | 37 content::TestBrowserThread ui_thread_; |
| 38 }; | 38 }; |
| 39 | 39 |
| 40 #if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) | 40 #if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) |
| 41 // Chrome OS has different way of installing default apps. | 41 // Chrome OS has different way of installing default apps. |
| 42 // Android does not currently support installing apps via Chrome. | 42 // Android does not currently support installing apps via Chrome. |
| 43 TEST_F(DefaultAppsTest, Install) { | 43 TEST_F(DefaultAppsTest, Install) { |
| 44 scoped_ptr<TestingProfile> profile(new TestingProfile()); | 44 scoped_ptr<TestingProfile> profile(new TestingProfile()); |
| 45 ExternalLoader* loader = new MockExternalLoader(); | 45 ExternalLoader* loader = new MockExternalLoader(); |
| 46 | 46 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 // even if the profile version is older than Chrome version. | 86 // even if the profile version is older than Chrome version. |
| 87 profile->GetPrefs()->SetInteger(prefs::kDefaultAppsInstallState, | 87 profile->GetPrefs()->SetInteger(prefs::kDefaultAppsInstallState, |
| 88 default_apps::kProvideLegacyDefaultApps); | 88 default_apps::kProvideLegacyDefaultApps); |
| 89 EXPECT_TRUE(provider2.ShouldInstallInProfile()); | 89 EXPECT_TRUE(provider2.ShouldInstallInProfile()); |
| 90 state = profile->GetPrefs()->GetInteger(prefs::kDefaultAppsInstallState); | 90 state = profile->GetPrefs()->GetInteger(prefs::kDefaultAppsInstallState); |
| 91 EXPECT_TRUE(state == default_apps::kAlreadyInstalledDefaultApps); | 91 EXPECT_TRUE(state == default_apps::kAlreadyInstalledDefaultApps); |
| 92 } | 92 } |
| 93 #endif | 93 #endif |
| 94 | 94 |
| 95 } // namespace extensions | 95 } // namespace extensions |
| OLD | NEW |