Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(220)

Side by Side Diff: chrome/browser/apps/app_browsertest.cc

Issue 106713002: Move LaunchContainer enum to extension_constants.h. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/apps/app_browsertest_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/launcher.h" 5 #include "apps/launcher.h"
6 #include "apps/shell_window.h" 6 #include "apps/shell_window.h"
7 #include "apps/shell_window_registry.h" 7 #include "apps/shell_window_registry.h"
8 #include "apps/ui/native_app_window.h" 8 #include "apps/ui/native_app_window.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 relative_test_doc = relative_test_doc.NormalizePathSeparators(); 515 relative_test_doc = relative_test_doc.NormalizePathSeparators();
516 command_line->AppendArgPath(relative_test_doc); 516 command_line->AppendArgPath(relative_test_doc);
517 517
518 // Load the extension 518 // Load the extension
519 ResultCatcher catcher; 519 ResultCatcher catcher;
520 const Extension* extension = LoadExtension( 520 const Extension* extension = LoadExtension(
521 test_data_dir_.AppendASCII("platform_apps/launch_file")); 521 test_data_dir_.AppendASCII("platform_apps/launch_file"));
522 ASSERT_TRUE(extension); 522 ASSERT_TRUE(extension);
523 523
524 // Run the test 524 // Run the test
525 AppLaunchParams params(browser()->profile(), extension, LAUNCH_NONE, 525 AppLaunchParams params(
526 NEW_WINDOW); 526 browser()->profile(), extension, LAUNCH_CONTAINER_NONE, NEW_WINDOW);
527 params.command_line = CommandLine::ForCurrentProcess(); 527 params.command_line = CommandLine::ForCurrentProcess();
528 params.current_directory = test_data_dir_; 528 params.current_directory = test_data_dir_;
529 OpenApplication(params); 529 OpenApplication(params);
530 530
531 if (!catcher.GetNextResult()) { 531 if (!catcher.GetNextResult()) {
532 message_ = catcher.message(); 532 message_ = catcher.message();
533 ASSERT_TRUE(0); 533 ASSERT_TRUE(0);
534 } 534 }
535 } 535 }
536 536
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
836 836
837 if (test_flags & RELAUNCH) { 837 if (test_flags & RELAUNCH) {
838 // Close the ShellWindow, and ensure it is gone. 838 // Close the ShellWindow, and ensure it is gone.
839 CloseShellWindow(window); 839 CloseShellWindow(window);
840 ASSERT_FALSE(GetFirstShellWindow()); 840 ASSERT_FALSE(GetFirstShellWindow());
841 841
842 // Relaunch the app and get a new ShellWindow. 842 // Relaunch the app and get a new ShellWindow.
843 content::WindowedNotificationObserver app_loaded_observer( 843 content::WindowedNotificationObserver app_loaded_observer(
844 content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, 844 content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME,
845 content::NotificationService::AllSources()); 845 content::NotificationService::AllSources());
846 OpenApplication(AppLaunchParams(browser()->profile(), extension, 846 OpenApplication(AppLaunchParams(
847 LAUNCH_NONE, NEW_WINDOW)); 847 browser()->profile(), extension, LAUNCH_CONTAINER_NONE, NEW_WINDOW));
848 app_loaded_observer.Wait(); 848 app_loaded_observer.Wait();
849 window = GetFirstShellWindow(); 849 window = GetFirstShellWindow();
850 ASSERT_TRUE(window); 850 ASSERT_TRUE(window);
851 851
852 // DevTools should have reopened with the relaunch. 852 // DevTools should have reopened with the relaunch.
853 rvh = window->web_contents()->GetRenderViewHost(); 853 rvh = window->web_contents()->GetRenderViewHost();
854 ASSERT_TRUE(rvh); 854 ASSERT_TRUE(rvh);
855 ASSERT_TRUE(DevToolsAgentHost::HasFor(rvh)); 855 ASSERT_TRUE(DevToolsAgentHost::HasFor(rvh));
856 } 856 }
857 } 857 }
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
979 content::NotificationService::AllSources()); 979 content::NotificationService::AllSources());
980 980
981 const Extension* extension = LoadExtensionAsComponent( 981 const Extension* extension = LoadExtensionAsComponent(
982 test_data_dir_.AppendASCII("platform_apps").AppendASCII("component")); 982 test_data_dir_.AppendASCII("platform_apps").AppendASCII("component"));
983 ASSERT_TRUE(extension); 983 ASSERT_TRUE(extension);
984 984
985 app_loaded_observer.Wait(); 985 app_loaded_observer.Wait();
986 ASSERT_TRUE(should_install.seen()); 986 ASSERT_TRUE(should_install.seen());
987 987
988 ExtensionTestMessageListener launched_listener("Launched", false); 988 ExtensionTestMessageListener launched_listener("Launched", false);
989 OpenApplication(AppLaunchParams(browser()->profile(), extension, LAUNCH_NONE, 989 OpenApplication(AppLaunchParams(
990 NEW_WINDOW)); 990 browser()->profile(), extension, LAUNCH_CONTAINER_NONE, NEW_WINDOW));
991 991
992 ASSERT_TRUE(launched_listener.WaitUntilSatisfied()); 992 ASSERT_TRUE(launched_listener.WaitUntilSatisfied());
993 } 993 }
994 994
995 // Component App Test 2 of 3: ensure an installed component app can be launched 995 // Component App Test 2 of 3: ensure an installed component app can be launched
996 // on a subsequent browser start, without requiring any install/upgrade logic 996 // on a subsequent browser start, without requiring any install/upgrade logic
997 // to be run, then perform setup for step 3. 997 // to be run, then perform setup for step 3.
998 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, 998 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest,
999 PRE_ComponentAppBackgroundPage) { 999 PRE_ComponentAppBackgroundPage) {
1000 1000
1001 // Since the component app is now installed, re-adding it in the same profile 1001 // Since the component app is now installed, re-adding it in the same profile
1002 // should not cause it to be re-installed. Instead, we wait for the OnLaunched 1002 // should not cause it to be re-installed. Instead, we wait for the OnLaunched
1003 // in a different observer (which would timeout if not the app was not 1003 // in a different observer (which would timeout if not the app was not
1004 // previously installed properly) and then check this observer to make sure it 1004 // previously installed properly) and then check this observer to make sure it
1005 // never saw the NOTIFICATION_EXTENSION_INSTALLED event. 1005 // never saw the NOTIFICATION_EXTENSION_INSTALLED event.
1006 CheckExtensionInstalledObserver should_not_install; 1006 CheckExtensionInstalledObserver should_not_install;
1007 const Extension* extension = LoadExtensionAsComponent( 1007 const Extension* extension = LoadExtensionAsComponent(
1008 test_data_dir_.AppendASCII("platform_apps").AppendASCII("component")); 1008 test_data_dir_.AppendASCII("platform_apps").AppendASCII("component"));
1009 ASSERT_TRUE(extension); 1009 ASSERT_TRUE(extension);
1010 1010
1011 ExtensionTestMessageListener launched_listener("Launched", false); 1011 ExtensionTestMessageListener launched_listener("Launched", false);
1012 OpenApplication(AppLaunchParams(browser()->profile(), extension, LAUNCH_NONE, 1012 OpenApplication(AppLaunchParams(
1013 NEW_WINDOW)); 1013 browser()->profile(), extension, LAUNCH_CONTAINER_NONE, NEW_WINDOW));
1014 1014
1015 ASSERT_TRUE(launched_listener.WaitUntilSatisfied()); 1015 ASSERT_TRUE(launched_listener.WaitUntilSatisfied());
1016 ASSERT_FALSE(should_not_install.seen()); 1016 ASSERT_FALSE(should_not_install.seen());
1017 1017
1018 // Simulate a "downgrade" from version 2 in the test manifest.json to 1. 1018 // Simulate a "downgrade" from version 2 in the test manifest.json to 1.
1019 ExtensionPrefs* extension_prefs = 1019 ExtensionPrefs* extension_prefs =
1020 extensions::ExtensionSystem::Get(browser()->profile())-> 1020 extensions::ExtensionSystem::Get(browser()->profile())->
1021 extension_service()->extension_prefs(); 1021 extension_service()->extension_prefs();
1022 1022
1023 // Clear the registered events to ensure they are updated. 1023 // Clear the registered events to ensure they are updated.
(...skipping 17 matching lines...) Expand all
1041 content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, 1041 content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME,
1042 content::NotificationService::AllSources()); 1042 content::NotificationService::AllSources());
1043 1043
1044 const Extension* extension = LoadExtensionAsComponent( 1044 const Extension* extension = LoadExtensionAsComponent(
1045 test_data_dir_.AppendASCII("platform_apps").AppendASCII("component")); 1045 test_data_dir_.AppendASCII("platform_apps").AppendASCII("component"));
1046 ASSERT_TRUE(extension); 1046 ASSERT_TRUE(extension);
1047 app_loaded_observer.Wait(); 1047 app_loaded_observer.Wait();
1048 ASSERT_TRUE(should_install.seen()); 1048 ASSERT_TRUE(should_install.seen());
1049 1049
1050 ExtensionTestMessageListener launched_listener("Launched", false); 1050 ExtensionTestMessageListener launched_listener("Launched", false);
1051 OpenApplication(AppLaunchParams(browser()->profile(), extension, LAUNCH_NONE, 1051 OpenApplication(AppLaunchParams(
1052 NEW_WINDOW)); 1052 browser()->profile(), extension, LAUNCH_CONTAINER_NONE, NEW_WINDOW));
1053 1053
1054 ASSERT_TRUE(launched_listener.WaitUntilSatisfied()); 1054 ASSERT_TRUE(launched_listener.WaitUntilSatisfied());
1055 } 1055 }
1056 1056
1057 // Flakes on Windows: http://crbug.com/171450 1057 // Flakes on Windows: http://crbug.com/171450
1058 #if defined(OS_WIN) 1058 #if defined(OS_WIN)
1059 #define MAYBE_Messaging DISABLED_Messaging 1059 #define MAYBE_Messaging DISABLED_Messaging
1060 #else 1060 #else
1061 #define MAYBE_Messaging Messaging 1061 #define MAYBE_Messaging Messaging
1062 #endif 1062 #endif
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
1287 false); 1287 false);
1288 ASSERT_TRUE(restart_requested_listener.WaitUntilSatisfied()); 1288 ASSERT_TRUE(restart_requested_listener.WaitUntilSatisfied());
1289 1289
1290 EXPECT_EQ(1, request_restart_call_count()); 1290 EXPECT_EQ(1, request_restart_call_count());
1291 } 1291 }
1292 1292
1293 #endif // defined(OS_CHROMEOS) 1293 #endif // defined(OS_CHROMEOS)
1294 1294
1295 1295
1296 } // namespace extensions 1296 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/apps/app_browsertest_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698