| 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 // Contains holistic tests of the bindings infrastructure | 5 // Contains holistic tests of the bindings infrastructure |
| 6 | 6 |
| 7 #include "chrome/browser/extensions/extension_apitest.h" | 7 #include "chrome/browser/extensions/extension_apitest.h" |
| 8 | 8 |
| 9 #include "chrome/browser/extensions/extension_host.h" | 9 #include "chrome/browser/extensions/extension_host.h" |
| 10 #include "chrome/browser/extensions/extension_process_manager.h" | 10 #include "chrome/browser/extensions/extension_process_manager.h" |
| 11 #include "chrome/browser/extensions/extension_system.h" | 11 #include "chrome/browser/extensions/extension_system.h" |
| 12 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
| 13 #include "chrome/test/base/ui_test_utils.h" | 13 #include "chrome/test/base/ui_test_utils.h" |
| 14 #include "content/public/test/browser_test_utils.h" | 14 #include "content/public/test/browser_test_utils.h" |
| 15 | 15 |
| 16 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ExceptionInHandlerShouldNotCrash) { | 16 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ExceptionInHandlerShouldNotCrash) { |
| 17 ASSERT_TRUE(RunExtensionSubtest( | 17 ASSERT_TRUE(RunExtensionSubtest( |
| 18 "bindings/exception_in_handler_should_not_crash", | 18 "bindings/exception_in_handler_should_not_crash", |
| 19 "page.html")) << message_; | 19 "page.html")) << message_; |
| 20 } | 20 } |
| 21 | 21 |
| 22 // Tests that an error raised during an async function still fires | 22 // Tests that an error raised during an async function still fires |
| 23 // the callback, but sets chrome.extension.lastError. | 23 // the callback, but sets chrome.runtime.lastError. |
| 24 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, LastError) { | 24 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, LastError) { |
| 25 ASSERT_TRUE(LoadExtension( | 25 ASSERT_TRUE(LoadExtension( |
| 26 test_data_dir_.AppendASCII("browsertest").AppendASCII("last_error"))); | 26 test_data_dir_.AppendASCII("browsertest").AppendASCII("last_error"))); |
| 27 | 27 |
| 28 // Get the ExtensionHost that is hosting our background page. | 28 // Get the ExtensionHost that is hosting our background page. |
| 29 ExtensionProcessManager* manager = | 29 ExtensionProcessManager* manager = |
| 30 extensions::ExtensionSystem::Get(browser()->profile())->process_manager(); | 30 extensions::ExtensionSystem::Get(browser()->profile())->process_manager(); |
| 31 extensions::ExtensionHost* host = FindHostWithPath(manager, "/bg.html", 1); | 31 extensions::ExtensionHost* host = FindHostWithPath(manager, "/bg.html", 1); |
| 32 | 32 |
| 33 bool result = false; | 33 bool result = false; |
| 34 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( | 34 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( |
| 35 host->render_view_host(), "testLastError()", &result)); | 35 host->render_view_host(), "testLastError()", &result)); |
| 36 EXPECT_TRUE(result); | 36 EXPECT_TRUE(result); |
| 37 } | 37 } |
| OLD | NEW |