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

Side by Side Diff: chrome/browser/extensions/platform_app_browsertest.cc

Issue 12207155: Revert 182194 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 10 months 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/extensions/shell_window_registry.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 (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/prefs/pref_service.h" 6 #include "base/prefs/pref_service.h"
7 #include "base/test/test_timeouts.h" 7 #include "base/test/test_timeouts.h"
8 #include "base/threading/platform_thread.h" 8 #include "base/threading/platform_thread.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/app/chrome_command_ids.h" 10 #include "chrome/app/chrome_command_ids.h"
(...skipping 10 matching lines...) Expand all
21 #include "chrome/browser/extensions/shell_window_registry.h" 21 #include "chrome/browser/extensions/shell_window_registry.h"
22 #include "chrome/browser/prefs/pref_registry_syncable.h" 22 #include "chrome/browser/prefs/pref_registry_syncable.h"
23 #include "chrome/browser/tab_contents/render_view_context_menu.h" 23 #include "chrome/browser/tab_contents/render_view_context_menu.h"
24 #include "chrome/browser/ui/browser.h" 24 #include "chrome/browser/ui/browser.h"
25 #include "chrome/browser/ui/extensions/application_launch.h" 25 #include "chrome/browser/ui/extensions/application_launch.h"
26 #include "chrome/browser/ui/extensions/native_app_window.h" 26 #include "chrome/browser/ui/extensions/native_app_window.h"
27 #include "chrome/browser/ui/extensions/shell_window.h" 27 #include "chrome/browser/ui/extensions/shell_window.h"
28 #include "chrome/browser/ui/tabs/tab_strip_model.h" 28 #include "chrome/browser/ui/tabs/tab_strip_model.h"
29 #include "chrome/browser/ui/web_contents_modal_dialog_manager.h" 29 #include "chrome/browser/ui/web_contents_modal_dialog_manager.h"
30 #include "chrome/common/chrome_notification_types.h" 30 #include "chrome/common/chrome_notification_types.h"
31 #include "chrome/common/pref_names.h"
32 #include "chrome/common/url_constants.h" 31 #include "chrome/common/url_constants.h"
33 #include "chrome/test/base/ui_test_utils.h" 32 #include "chrome/test/base/ui_test_utils.h"
34 #include "content/public/browser/devtools_agent_host.h" 33 #include "content/public/browser/devtools_agent_host.h"
35 #include "content/public/browser/render_process_host.h" 34 #include "content/public/browser/render_process_host.h"
36 #include "content/public/browser/render_widget_host_view.h" 35 #include "content/public/browser/render_widget_host_view.h"
37 #include "content/public/browser/web_contents_view.h" 36 #include "content/public/browser/web_contents_view.h"
38 #include "content/public/test/test_utils.h" 37 #include "content/public/test/test_utils.h"
39 #include "googleurl/src/gurl.h" 38 #include "googleurl/src/gurl.h"
40 39
41 using content::WebContents; 40 using content::WebContents;
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after
680 679
681 // Tests that an app calling chrome.runtime.reload will reload the app and 680 // Tests that an app calling chrome.runtime.reload will reload the app and
682 // relaunch it if it was running. 681 // relaunch it if it was running.
683 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, ReloadRelaunches) { 682 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, ReloadRelaunches) {
684 ExtensionTestMessageListener launched_listener("Launched", true); 683 ExtensionTestMessageListener launched_listener("Launched", true);
685 const Extension* extension = LoadAndLaunchPlatformApp("reload"); 684 const Extension* extension = LoadAndLaunchPlatformApp("reload");
686 ASSERT_TRUE(extension); 685 ASSERT_TRUE(extension);
687 ASSERT_TRUE(launched_listener.WaitUntilSatisfied()); 686 ASSERT_TRUE(launched_listener.WaitUntilSatisfied());
688 ASSERT_TRUE(GetFirstShellWindow()); 687 ASSERT_TRUE(GetFirstShellWindow());
689 688
690 // Now tell the app to reload itself. 689 // Now tell the app to reload itself
691 ExtensionTestMessageListener launched_listener2("Launched", false); 690 ExtensionTestMessageListener launched_listener2("Launched", false);
692 launched_listener.Reply("reload"); 691 launched_listener.Reply("reload");
693 ASSERT_TRUE(launched_listener2.WaitUntilSatisfied()); 692 ASSERT_TRUE(launched_listener2.WaitUntilSatisfied());
694 ASSERT_TRUE(GetFirstShellWindow()); 693 ASSERT_TRUE(GetFirstShellWindow());
695 } 694 }
696 695
697 namespace { 696 namespace {
698 697
699 // Simple observer to check for NOTIFICATION_EXTENSION_INSTALLED events to 698 // Simple observer to check for NOTIFICATION_EXTENSION_INSTALLED events to
700 // ensure installation does or does not occur in certain scenarios. 699 // ensure installation does or does not occur in certain scenarios.
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
845 #else 844 #else
846 #define MAYBE_WebContentsHasFocus WebContentsHasFocus 845 #define MAYBE_WebContentsHasFocus WebContentsHasFocus
847 #endif 846 #endif
848 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MAYBE_WebContentsHasFocus) { 847 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MAYBE_WebContentsHasFocus) {
849 const Extension* extension = LoadAndLaunchPlatformApp("minimal"); 848 const Extension* extension = LoadAndLaunchPlatformApp("minimal");
850 ShellWindow* window = CreateShellWindow(extension); 849 ShellWindow* window = CreateShellWindow(extension);
851 EXPECT_TRUE(window->web_contents()->GetRenderWidgetHostView()->HasFocus()); 850 EXPECT_TRUE(window->web_contents()->GetRenderWidgetHostView()->HasFocus());
852 CloseShellWindow(window); 851 CloseShellWindow(window);
853 } 852 }
854 853
855 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, DontCrashWhenReloading) {
856 // Regression test for http://crbug.com/174250
857 browser()->profile()->GetPrefs()->SetBoolean(
858 prefs::kExtensionsUIDeveloperMode, true);
859 ui_test_utils::NavigateToURL(browser(), GURL("chrome://extensions"));
860 ExtensionTestMessageListener launched_listener("Launched", true);
861 const Extension* extension = LoadAndLaunchPlatformApp("reload");
862 ASSERT_TRUE(extension);
863 ASSERT_TRUE(launched_listener.WaitUntilSatisfied());
864 ASSERT_TRUE(GetFirstShellWindow());
865
866 // Now tell the app to reload itself.
867 ExtensionTestMessageListener launched_listener2("Launched", false);
868 launched_listener.Reply("reload");
869 ASSERT_TRUE(launched_listener2.WaitUntilSatisfied());
870 ASSERT_TRUE(GetFirstShellWindow());
871 }
872
873 } // namespace extensions 854 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/shell_window_registry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698