| 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/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/test/test_timeouts.h" | 6 #include "base/test/test_timeouts.h" |
| 7 #include "base/threading/platform_thread.h" | 7 #include "base/threading/platform_thread.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/app/chrome_command_ids.h" | 9 #include "chrome/app/chrome_command_ids.h" |
| 10 #include "chrome/browser/automation/automation_util.h" | 10 #include "chrome/browser/automation/automation_util.h" |
| (...skipping 877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 888 | 888 |
| 889 // Clear the registered events to ensure they are updated. | 889 // Clear the registered events to ensure they are updated. |
| 890 extension_prefs->SetRegisteredEvents(extension->id(), | 890 extension_prefs->SetRegisteredEvents(extension->id(), |
| 891 std::set<std::string>()); | 891 std::set<std::string>()); |
| 892 | 892 |
| 893 const base::StringValue old_version("1"); | 893 const base::StringValue old_version("1"); |
| 894 std::string pref_path("extensions.settings."); | 894 std::string pref_path("extensions.settings."); |
| 895 pref_path += extension->id(); | 895 pref_path += extension->id(); |
| 896 pref_path += ".manifest.version"; | 896 pref_path += ".manifest.version"; |
| 897 extension_prefs->pref_service()->RegisterStringPref( | 897 extension_prefs->pref_service()->RegisterStringPref( |
| 898 pref_path.c_str(), std::string(), PrefServiceBase::UNSYNCABLE_PREF); | 898 pref_path.c_str(), std::string(), PrefServiceSyncable::UNSYNCABLE_PREF); |
| 899 extension_prefs->pref_service()->Set(pref_path.c_str(), old_version); | 899 extension_prefs->pref_service()->Set(pref_path.c_str(), old_version); |
| 900 } | 900 } |
| 901 | 901 |
| 902 // Component App Test 3 of 3: simulate a component extension upgrade that | 902 // Component App Test 3 of 3: simulate a component extension upgrade that |
| 903 // re-adds the OnLaunched event, and allows the app to be launched. | 903 // re-adds the OnLaunched event, and allows the app to be launched. |
| 904 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, ComponentAppBackgroundPage) { | 904 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, ComponentAppBackgroundPage) { |
| 905 CheckExtensionInstalledObserver should_install; | 905 CheckExtensionInstalledObserver should_install; |
| 906 // Since we are forcing an upgrade, we need to wait for the load again. | 906 // Since we are forcing an upgrade, we need to wait for the load again. |
| 907 content::WindowedNotificationObserver app_loaded_observer( | 907 content::WindowedNotificationObserver app_loaded_observer( |
| 908 content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, | 908 content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, |
| 909 content::NotificationService::AllSources()); | 909 content::NotificationService::AllSources()); |
| 910 | 910 |
| 911 const Extension* extension = LoadExtensionAsComponent( | 911 const Extension* extension = LoadExtensionAsComponent( |
| 912 test_data_dir_.AppendASCII("platform_apps").AppendASCII("component")); | 912 test_data_dir_.AppendASCII("platform_apps").AppendASCII("component")); |
| 913 ASSERT_TRUE(extension); | 913 ASSERT_TRUE(extension); |
| 914 app_loaded_observer.Wait(); | 914 app_loaded_observer.Wait(); |
| 915 ASSERT_TRUE(should_install.seen()); | 915 ASSERT_TRUE(should_install.seen()); |
| 916 | 916 |
| 917 ExtensionTestMessageListener launched_listener("Launched", false); | 917 ExtensionTestMessageListener launched_listener("Launched", false); |
| 918 application_launch::OpenApplication(application_launch::LaunchParams( | 918 application_launch::OpenApplication(application_launch::LaunchParams( |
| 919 browser()->profile(), extension, extension_misc::LAUNCH_NONE, | 919 browser()->profile(), extension, extension_misc::LAUNCH_NONE, |
| 920 NEW_WINDOW)); | 920 NEW_WINDOW)); |
| 921 | 921 |
| 922 ASSERT_TRUE(launched_listener.WaitUntilSatisfied()); | 922 ASSERT_TRUE(launched_listener.WaitUntilSatisfied()); |
| 923 } | 923 } |
| 924 | 924 |
| 925 } // namespace extensions | 925 } // namespace extensions |
| OLD | NEW |