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 "apps/app_window.h" | 5 #include "apps/app_window.h" |
6 #include "apps/app_window_registry.h" | 6 #include "apps/app_window_registry.h" |
7 #include "apps/common/api/app_runtime.h" | 7 #include "apps/common/api/app_runtime.h" |
8 #include "apps/launcher.h" | 8 #include "apps/launcher.h" |
9 #include "apps/ui/native_app_window.h" | 9 #include "apps/ui/native_app_window.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 999 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1010 OpenApplication(AppLaunchParams( | 1010 OpenApplication(AppLaunchParams( |
1011 browser()->profile(), extension, LAUNCH_CONTAINER_NONE, NEW_WINDOW)); | 1011 browser()->profile(), extension, LAUNCH_CONTAINER_NONE, NEW_WINDOW)); |
1012 | 1012 |
1013 ASSERT_TRUE(launched_listener.WaitUntilSatisfied()); | 1013 ASSERT_TRUE(launched_listener.WaitUntilSatisfied()); |
1014 ASSERT_FALSE(should_not_install.seen()); | 1014 ASSERT_FALSE(should_not_install.seen()); |
1015 | 1015 |
1016 // Simulate a "downgrade" from version 2 in the test manifest.json to 1. | 1016 // Simulate a "downgrade" from version 2 in the test manifest.json to 1. |
1017 ExtensionPrefs* extension_prefs = ExtensionPrefs::Get(browser()->profile()); | 1017 ExtensionPrefs* extension_prefs = ExtensionPrefs::Get(browser()->profile()); |
1018 | 1018 |
1019 // Clear the registered events to ensure they are updated. | 1019 // Clear the registered events to ensure they are updated. |
1020 extensions::ExtensionSystem::Get(browser()->profile())->event_router()-> | 1020 extensions::EventRouter::Get(browser()->profile()) |
1021 SetRegisteredEvents(extension->id(), std::set<std::string>()); | 1021 ->SetRegisteredEvents(extension->id(), std::set<std::string>()); |
1022 | 1022 |
1023 DictionaryPrefUpdate update(extension_prefs->pref_service(), | 1023 DictionaryPrefUpdate update(extension_prefs->pref_service(), |
1024 extensions::pref_names::kExtensions); | 1024 extensions::pref_names::kExtensions); |
1025 base::DictionaryValue* dict = update.Get(); | 1025 base::DictionaryValue* dict = update.Get(); |
1026 std::string key(extension->id()); | 1026 std::string key(extension->id()); |
1027 key += ".manifest.version"; | 1027 key += ".manifest.version"; |
1028 dict->SetString(key, "1"); | 1028 dict->SetString(key, "1"); |
1029 } | 1029 } |
1030 | 1030 |
1031 // Component App Test 3 of 3: simulate a component extension upgrade that | 1031 // Component App Test 3 of 3: simulate a component extension upgrade that |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1189 IN_PROC_BROWSER_TEST_F(PlatformAppIncognitoBrowserTest, IncognitoComponentApp) { | 1189 IN_PROC_BROWSER_TEST_F(PlatformAppIncognitoBrowserTest, IncognitoComponentApp) { |
1190 // Get the file manager app. | 1190 // Get the file manager app. |
1191 const Extension* file_manager = extension_service()->GetExtensionById( | 1191 const Extension* file_manager = extension_service()->GetExtensionById( |
1192 "hhaomjibdihmijegdhdafkllkbggdgoj", false); | 1192 "hhaomjibdihmijegdhdafkllkbggdgoj", false); |
1193 ASSERT_TRUE(file_manager != NULL); | 1193 ASSERT_TRUE(file_manager != NULL); |
1194 Profile* incognito_profile = profile()->GetOffTheRecordProfile(); | 1194 Profile* incognito_profile = profile()->GetOffTheRecordProfile(); |
1195 ASSERT_TRUE(incognito_profile != NULL); | 1195 ASSERT_TRUE(incognito_profile != NULL); |
1196 | 1196 |
1197 // Wait until the file manager has had a chance to register its listener | 1197 // Wait until the file manager has had a chance to register its listener |
1198 // for the launch event. | 1198 // for the launch event. |
1199 EventRouter* router = ExtensionSystem::Get(incognito_profile)->event_router(); | 1199 EventRouter* router = EventRouter::Get(incognito_profile); |
1200 ASSERT_TRUE(router != NULL); | 1200 ASSERT_TRUE(router != NULL); |
1201 while (!router->ExtensionHasEventListener( | 1201 while (!router->ExtensionHasEventListener( |
1202 file_manager->id(), app_runtime::OnLaunched::kEventName)) { | 1202 file_manager->id(), app_runtime::OnLaunched::kEventName)) { |
1203 content::RunAllPendingInMessageLoop(); | 1203 content::RunAllPendingInMessageLoop(); |
1204 } | 1204 } |
1205 | 1205 |
1206 // Listen for new app windows so we see the file manager app launch itself. | 1206 // Listen for new app windows so we see the file manager app launch itself. |
1207 AppWindowRegistry* registry = AppWindowRegistry::Get(incognito_profile); | 1207 AppWindowRegistry* registry = AppWindowRegistry::Get(incognito_profile); |
1208 ASSERT_TRUE(registry != NULL); | 1208 ASSERT_TRUE(registry != NULL); |
1209 registry->AddObserver(this); | 1209 registry->AddObserver(this); |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1324 | 1324 |
1325 ExtensionApiTest::ResultCatcher result_catcher; | 1325 ExtensionApiTest::ResultCatcher result_catcher; |
1326 | 1326 |
1327 ASSERT_TRUE(launched_listener.WaitUntilSatisfied()); | 1327 ASSERT_TRUE(launched_listener.WaitUntilSatisfied()); |
1328 | 1328 |
1329 EXPECT_TRUE(result_catcher.GetNextResult()); | 1329 EXPECT_TRUE(result_catcher.GetNextResult()); |
1330 } | 1330 } |
1331 } | 1331 } |
1332 | 1332 |
1333 } // namespace extensions | 1333 } // namespace extensions |
OLD | NEW |