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 931 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
942 | 942 |
943 // Now tell the app to reload itself | 943 // Now tell the app to reload itself |
944 ExtensionTestMessageListener launched_listener2("Launched", false); | 944 ExtensionTestMessageListener launched_listener2("Launched", false); |
945 launched_listener.Reply("reload"); | 945 launched_listener.Reply("reload"); |
946 ASSERT_TRUE(launched_listener2.WaitUntilSatisfied()); | 946 ASSERT_TRUE(launched_listener2.WaitUntilSatisfied()); |
947 ASSERT_TRUE(GetFirstAppWindow()); | 947 ASSERT_TRUE(GetFirstAppWindow()); |
948 } | 948 } |
949 | 949 |
950 namespace { | 950 namespace { |
951 | 951 |
952 // Simple observer to check for NOTIFICATION_EXTENSION_INSTALLED events to | 952 // Simple observer to check for NOTIFICATION_EXTENSION_INSTALLED_DEPRECATED |
| 953 // events to |
953 // ensure installation does or does not occur in certain scenarios. | 954 // ensure installation does or does not occur in certain scenarios. |
954 class CheckExtensionInstalledObserver : public content::NotificationObserver { | 955 class CheckExtensionInstalledObserver : public content::NotificationObserver { |
955 public: | 956 public: |
956 CheckExtensionInstalledObserver() : seen_(false) { | 957 CheckExtensionInstalledObserver() : seen_(false) { |
957 registrar_.Add(this, | 958 registrar_.Add(this, |
958 chrome::NOTIFICATION_EXTENSION_INSTALLED, | 959 chrome::NOTIFICATION_EXTENSION_INSTALLED_DEPRECATED, |
959 content::NotificationService::AllSources()); | 960 content::NotificationService::AllSources()); |
960 } | 961 } |
961 | 962 |
962 bool seen() const { | 963 bool seen() const { |
963 return seen_; | 964 return seen_; |
964 }; | 965 }; |
965 | 966 |
966 // NotificationObserver: | 967 // NotificationObserver: |
967 virtual void Observe(int type, | 968 virtual void Observe(int type, |
968 const content::NotificationSource& source, | 969 const content::NotificationSource& source, |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1010 // Component App Test 2 of 3: ensure an installed component app can be launched | 1011 // Component App Test 2 of 3: ensure an installed component app can be launched |
1011 // on a subsequent browser start, without requiring any install/upgrade logic | 1012 // on a subsequent browser start, without requiring any install/upgrade logic |
1012 // to be run, then perform setup for step 3. | 1013 // to be run, then perform setup for step 3. |
1013 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, | 1014 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, |
1014 PRE_ComponentAppBackgroundPage) { | 1015 PRE_ComponentAppBackgroundPage) { |
1015 | 1016 |
1016 // Since the component app is now installed, re-adding it in the same profile | 1017 // Since the component app is now installed, re-adding it in the same profile |
1017 // should not cause it to be re-installed. Instead, we wait for the OnLaunched | 1018 // should not cause it to be re-installed. Instead, we wait for the OnLaunched |
1018 // in a different observer (which would timeout if not the app was not | 1019 // in a different observer (which would timeout if not the app was not |
1019 // previously installed properly) and then check this observer to make sure it | 1020 // previously installed properly) and then check this observer to make sure it |
1020 // never saw the NOTIFICATION_EXTENSION_INSTALLED event. | 1021 // never saw the NOTIFICATION_EXTENSION_INSTALLED_DEPRECATED event. |
1021 CheckExtensionInstalledObserver should_not_install; | 1022 CheckExtensionInstalledObserver should_not_install; |
1022 const Extension* extension = LoadExtensionAsComponent( | 1023 const Extension* extension = LoadExtensionAsComponent( |
1023 test_data_dir_.AppendASCII("platform_apps").AppendASCII("component")); | 1024 test_data_dir_.AppendASCII("platform_apps").AppendASCII("component")); |
1024 ASSERT_TRUE(extension); | 1025 ASSERT_TRUE(extension); |
1025 | 1026 |
1026 ExtensionTestMessageListener launched_listener("Launched", false); | 1027 ExtensionTestMessageListener launched_listener("Launched", false); |
1027 OpenApplication(AppLaunchParams( | 1028 OpenApplication(AppLaunchParams( |
1028 browser()->profile(), extension, LAUNCH_CONTAINER_NONE, NEW_WINDOW)); | 1029 browser()->profile(), extension, LAUNCH_CONTAINER_NONE, NEW_WINDOW)); |
1029 | 1030 |
1030 ASSERT_TRUE(launched_listener.WaitUntilSatisfied()); | 1031 ASSERT_TRUE(launched_listener.WaitUntilSatisfied()); |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1339 | 1340 |
1340 ExtensionApiTest::ResultCatcher result_catcher; | 1341 ExtensionApiTest::ResultCatcher result_catcher; |
1341 | 1342 |
1342 ASSERT_TRUE(launched_listener.WaitUntilSatisfied()); | 1343 ASSERT_TRUE(launched_listener.WaitUntilSatisfied()); |
1343 | 1344 |
1344 EXPECT_TRUE(result_catcher.GetNextResult()); | 1345 EXPECT_TRUE(result_catcher.GetNextResult()); |
1345 } | 1346 } |
1346 } | 1347 } |
1347 | 1348 |
1348 } // namespace extensions | 1349 } // namespace extensions |
OLD | NEW |