OLD | NEW |
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 "chrome/browser/extensions/external_provider_impl.h" | 5 #include "chrome/browser/extensions/external_provider_impl.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/test/scoped_path_override.h" | 9 #include "base/test/scoped_path_override.h" |
10 #include "chrome/browser/extensions/extension_service_unittest.h" | 10 #include "chrome/browser/extensions/extension_service_unittest.h" |
| 11 #include "chrome/common/chrome_notification_types.h" |
11 #include "chrome/common/chrome_paths.h" | 12 #include "chrome/common/chrome_paths.h" |
12 #include "chrome/common/chrome_switches.h" | 13 #include "chrome/common/chrome_switches.h" |
13 #include "chrome/test/base/testing_profile.h" | 14 #include "chrome/test/base/testing_profile.h" |
| 15 #include "content/public/browser/notification_service.h" |
| 16 #include "content/public/test/test_utils.h" |
14 | 17 |
15 namespace extensions { | 18 namespace extensions { |
16 | 19 |
17 namespace { | 20 namespace { |
18 | 21 |
19 const char kExternalAppId[] = "kekdneafjmhmndejhmbcadfiiofngffo"; | 22 const char kExternalAppId[] = "kekdneafjmhmndejhmbcadfiiofngffo"; |
20 | 23 |
21 class ExternalProviderImplTest : public ExtensionServiceTestBase { | 24 class ExternalProviderImplTest : public ExtensionServiceTestBase { |
22 public: | 25 public: |
23 ExternalProviderImplTest() {} | 26 ExternalProviderImplTest() {} |
(...skipping 29 matching lines...) Expand all Loading... |
53 DISALLOW_COPY_AND_ASSIGN(ExternalProviderImplTest); | 56 DISALLOW_COPY_AND_ASSIGN(ExternalProviderImplTest); |
54 }; | 57 }; |
55 | 58 |
56 } // namespace | 59 } // namespace |
57 | 60 |
58 // Normal mode, external app should be installed. | 61 // Normal mode, external app should be installed. |
59 TEST_F(ExternalProviderImplTest, Normal) { | 62 TEST_F(ExternalProviderImplTest, Normal) { |
60 InitServiceWithExternalProviders(); | 63 InitServiceWithExternalProviders(); |
61 | 64 |
62 service_->CheckForExternalUpdates(); | 65 service_->CheckForExternalUpdates(); |
63 loop_.RunUntilIdle(); | 66 content::WindowedNotificationObserver( |
| 67 chrome::NOTIFICATION_CRX_INSTALLER_DONE, |
| 68 content::NotificationService::AllSources()).Wait(); |
64 | 69 |
65 EXPECT_TRUE(service_->GetInstalledExtension(kExternalAppId)); | 70 EXPECT_TRUE(service_->GetInstalledExtension(kExternalAppId)); |
66 } | 71 } |
67 | 72 |
68 // App mode, no external app should be installed. | 73 // App mode, no external app should be installed. |
69 TEST_F(ExternalProviderImplTest, AppMode) { | 74 TEST_F(ExternalProviderImplTest, AppMode) { |
70 CommandLine* command = CommandLine::ForCurrentProcess(); | 75 CommandLine* command = CommandLine::ForCurrentProcess(); |
71 command->AppendSwitchASCII(switches::kForceAppMode, std::string()); | 76 command->AppendSwitchASCII(switches::kForceAppMode, std::string()); |
72 command->AppendSwitchASCII(switches::kAppId, std::string("app_id")); | 77 command->AppendSwitchASCII(switches::kAppId, std::string("app_id")); |
73 | 78 |
74 InitServiceWithExternalProviders(); | 79 InitServiceWithExternalProviders(); |
75 | 80 |
76 service_->CheckForExternalUpdates(); | 81 service_->CheckForExternalUpdates(); |
77 loop_.RunUntilIdle(); | 82 loop_.RunUntilIdle(); |
78 | 83 |
79 EXPECT_FALSE(service_->GetInstalledExtension(kExternalAppId)); | 84 EXPECT_FALSE(service_->GetInstalledExtension(kExternalAppId)); |
80 } | 85 } |
81 | 86 |
82 } // namespace extensions | 87 } // namespace extensions |
OLD | NEW |