| 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/strings/utf_string_conversions.h" | 5 #include "base/strings/utf_string_conversions.h" |
| 6 #include "chrome/browser/extensions/extension_apitest.h" | 6 #include "chrome/browser/extensions/extension_apitest.h" |
| 7 #include "chrome/browser/extensions/extension_host.h" | 7 #include "chrome/browser/extensions/extension_host.h" |
| 8 #include "chrome/browser/extensions/extension_process_manager.h" | |
| 9 #include "chrome/browser/extensions/extension_system.h" | 8 #include "chrome/browser/extensions/extension_system.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 11 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog.h" | 10 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog.h" |
| 12 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser.h" |
| 13 #include "chrome/common/extensions/extension.h" | 12 #include "chrome/common/extensions/extension.h" |
| 14 #include "chrome/test/base/ui_test_utils.h" | 13 #include "chrome/test/base/ui_test_utils.h" |
| 15 #include "content/public/browser/render_view_host.h" | 14 #include "content/public/browser/render_view_host.h" |
| 15 #include "extensions/browser/process_manager.h" |
| 16 | 16 |
| 17 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, AlertBasic) { | 17 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, AlertBasic) { |
| 18 ASSERT_TRUE(RunExtensionTest("alert")) << message_; | 18 ASSERT_TRUE(RunExtensionTest("alert")) << message_; |
| 19 | 19 |
| 20 const extensions::Extension* extension = GetSingleLoadedExtension(); | 20 const extensions::Extension* extension = GetSingleLoadedExtension(); |
| 21 extensions::ExtensionHost* host = | 21 extensions::ExtensionHost* host = |
| 22 extensions::ExtensionSystem::Get(browser()->profile())-> | 22 extensions::ExtensionSystem::Get(browser()->profile())-> |
| 23 process_manager()->GetBackgroundHostForExtension(extension->id()); | 23 process_manager()->GetBackgroundHostForExtension(extension->id()); |
| 24 ASSERT_TRUE(host); | 24 ASSERT_TRUE(host); |
| 25 host->render_view_host()->ExecuteJavascriptInWebFrame(string16(), | 25 host->render_view_host()->ExecuteJavascriptInWebFrame(string16(), |
| 26 ASCIIToUTF16("alert('This should not crash.');")); | 26 ASCIIToUTF16("alert('This should not crash.');")); |
| 27 | 27 |
| 28 AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog(); | 28 AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog(); |
| 29 ASSERT_TRUE(alert); | 29 ASSERT_TRUE(alert); |
| 30 alert->CloseModalDialog(); | 30 alert->CloseModalDialog(); |
| 31 } | 31 } |
| OLD | NEW |