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