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 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
700 // Pretend that the app is supposed to be running. | 700 // Pretend that the app is supposed to be running. |
701 extension_prefs->SetExtensionRunning(extension->id(), true); | 701 extension_prefs->SetExtensionRunning(extension->id(), true); |
702 | 702 |
703 ExtensionTestMessageListener restart_listener("onRestarted", false); | 703 ExtensionTestMessageListener restart_listener("onRestarted", false); |
704 AppRestoreServiceFactory::GetForProfile(browser()->profile())-> | 704 AppRestoreServiceFactory::GetForProfile(browser()->profile())-> |
705 HandleStartup(true); | 705 HandleStartup(true); |
706 restart_listener.WaitUntilSatisfied(); | 706 restart_listener.WaitUntilSatisfied(); |
707 } | 707 } |
708 | 708 |
709 // Tests that relaunching an app with devtools open reopens devtools. | 709 // Tests that relaunching an app with devtools open reopens devtools. |
710 #ifdef NDEBUG | 710 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, DevToolsOpenedWithReload) { |
711 #define MAYBE_DevToolsOpenedWithReload DevToolsOpenedWithReload | |
712 #else | |
713 // This is currently expected to fail in debug builds due to a segfault in | |
714 // WebKit triggered by a dereference between #ifndef NDEBUG guards see | |
715 // http://crbug.com/157097 . | |
716 // The test is disabled because of timeouts, see http://crbug.com/158283. | |
717 #define MAYBE_DevToolsOpenedWithReload DISABLED_DevToolsOpenedWithReload | |
718 #endif | |
719 | |
720 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MAYBE_DevToolsOpenedWithReload) { | |
721 using content::DevToolsAgentHostRegistry; | 711 using content::DevToolsAgentHostRegistry; |
722 | 712 |
723 ExtensionTestMessageListener launched_listener("Launched", false); | 713 ExtensionTestMessageListener launched_listener("Launched", false); |
724 const Extension* extension = LoadAndLaunchPlatformApp("minimal_id"); | 714 const Extension* extension = LoadAndLaunchPlatformApp("minimal_id"); |
725 ASSERT_TRUE(extension); | 715 ASSERT_TRUE(extension); |
726 ASSERT_TRUE(launched_listener.WaitUntilSatisfied()); | 716 ASSERT_TRUE(launched_listener.WaitUntilSatisfied()); |
727 ShellWindow* window = GetFirstShellWindow(); | 717 ShellWindow* window = GetFirstShellWindow(); |
728 ASSERT_TRUE(window); | 718 ASSERT_TRUE(window); |
729 content::RenderViewHost* rvh = window->web_contents()->GetRenderViewHost(); | 719 content::RenderViewHost* rvh = window->web_contents()->GetRenderViewHost(); |
730 ASSERT_TRUE(rvh); | 720 ASSERT_TRUE(rvh); |
(...skipping 23 matching lines...) Expand all Loading... |
754 window = GetFirstShellWindow(); | 744 window = GetFirstShellWindow(); |
755 ASSERT_TRUE(window); | 745 ASSERT_TRUE(window); |
756 | 746 |
757 // DevTools should have reopened with the relaunch. | 747 // DevTools should have reopened with the relaunch. |
758 rvh = window->web_contents()->GetRenderViewHost(); | 748 rvh = window->web_contents()->GetRenderViewHost(); |
759 ASSERT_TRUE(rvh); | 749 ASSERT_TRUE(rvh); |
760 ASSERT_TRUE(DevToolsAgentHostRegistry::HasDevToolsAgentHost(rvh)); | 750 ASSERT_TRUE(DevToolsAgentHostRegistry::HasDevToolsAgentHost(rvh)); |
761 } | 751 } |
762 | 752 |
763 } // namespace extensions | 753 } // namespace extensions |
OLD | NEW |