| 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/api/permissions/permissions_api.h" | 7 #include "chrome/browser/extensions/api/permissions/permissions_api.h" |
| 8 #include "chrome/browser/extensions/extension_apitest.h" | 8 #include "chrome/browser/extensions/extension_apitest.h" |
| 9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
| 10 #include "chrome/test/base/ui_test_utils.h" | 10 #include "chrome/test/base/ui_test_utils.h" |
| 11 #include "content/public/test/browser_test_utils.h" | 11 #include "content/public/test/browser_test_utils.h" |
| 12 #include "extensions/browser/extension_host.h" | 12 #include "extensions/browser/extension_host.h" |
| 13 #include "extensions/browser/extension_system.h" | |
| 14 #include "extensions/browser/process_manager.h" | 13 #include "extensions/browser/process_manager.h" |
| 15 #include "extensions/test/extension_test_message_listener.h" | 14 #include "extensions/test/extension_test_message_listener.h" |
| 16 #include "extensions/test/result_catcher.h" | 15 #include "extensions/test/result_catcher.h" |
| 17 | 16 |
| 18 namespace extensions { | 17 namespace extensions { |
| 19 namespace { | 18 namespace { |
| 20 | 19 |
| 21 class ExtensionBindingsApiTest : public ExtensionApiTest {}; | 20 class ExtensionBindingsApiTest : public ExtensionApiTest {}; |
| 22 | 21 |
| 23 IN_PROC_BROWSER_TEST_F(ExtensionBindingsApiTest, | 22 IN_PROC_BROWSER_TEST_F(ExtensionBindingsApiTest, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 37 | 36 |
| 38 // Tests that an error raised during an async function still fires | 37 // Tests that an error raised during an async function still fires |
| 39 // the callback, but sets chrome.runtime.lastError. | 38 // the callback, but sets chrome.runtime.lastError. |
| 40 // FIXME should be in ExtensionBindingsApiTest. | 39 // FIXME should be in ExtensionBindingsApiTest. |
| 41 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, LastError) { | 40 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, LastError) { |
| 42 ASSERT_TRUE(LoadExtension( | 41 ASSERT_TRUE(LoadExtension( |
| 43 test_data_dir_.AppendASCII("browsertest").AppendASCII("last_error"))); | 42 test_data_dir_.AppendASCII("browsertest").AppendASCII("last_error"))); |
| 44 | 43 |
| 45 // Get the ExtensionHost that is hosting our background page. | 44 // Get the ExtensionHost that is hosting our background page. |
| 46 extensions::ProcessManager* manager = | 45 extensions::ProcessManager* manager = |
| 47 extensions::ExtensionSystem::Get(browser()->profile())->process_manager(); | 46 extensions::ProcessManager::Get(browser()->profile()); |
| 48 extensions::ExtensionHost* host = FindHostWithPath(manager, "/bg.html", 1); | 47 extensions::ExtensionHost* host = FindHostWithPath(manager, "/bg.html", 1); |
| 49 | 48 |
| 50 bool result = false; | 49 bool result = false; |
| 51 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( | 50 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( |
| 52 host->render_view_host(), "testLastError()", &result)); | 51 host->render_view_host(), "testLastError()", &result)); |
| 53 EXPECT_TRUE(result); | 52 EXPECT_TRUE(result); |
| 54 } | 53 } |
| 55 | 54 |
| 56 // Regression test that we don't delete our own bindings with about:blank | 55 // Regression test that we don't delete our own bindings with about:blank |
| 57 // iframes. | 56 // iframes. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 81 } | 80 } |
| 82 | 81 |
| 83 // Tests that we don't override events when bindings are re-injected. | 82 // Tests that we don't override events when bindings are re-injected. |
| 84 // Regression test for http://crbug.com/269149. | 83 // Regression test for http://crbug.com/269149. |
| 85 IN_PROC_BROWSER_TEST_F(ExtensionBindingsApiTest, EventOverriding) { | 84 IN_PROC_BROWSER_TEST_F(ExtensionBindingsApiTest, EventOverriding) { |
| 86 ASSERT_TRUE(RunExtensionTest("bindings/event_overriding")) << message_; | 85 ASSERT_TRUE(RunExtensionTest("bindings/event_overriding")) << message_; |
| 87 } | 86 } |
| 88 | 87 |
| 89 } // namespace | 88 } // namespace |
| 90 } // namespace extensions | 89 } // namespace extensions |
| OLD | NEW |