Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(119)

Side by Side Diff: chrome/browser/extensions/extension_bindings_apitest.cc

Issue 67253003: Reland: Move ExtensionProcessManager to src/extensions, part 4 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase process_manager Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/extensions/extension_host.h" 9 #include "chrome/browser/extensions/extension_host.h"
10 #include "chrome/browser/extensions/extension_process_manager.h"
11 #include "chrome/browser/extensions/extension_system.h" 10 #include "chrome/browser/extensions/extension_system.h"
12 #include "chrome/browser/extensions/extension_test_message_listener.h" 11 #include "chrome/browser/extensions/extension_test_message_listener.h"
13 #include "chrome/browser/ui/browser.h" 12 #include "chrome/browser/ui/browser.h"
14 #include "chrome/test/base/ui_test_utils.h" 13 #include "chrome/test/base/ui_test_utils.h"
15 #include "content/public/test/browser_test_utils.h" 14 #include "content/public/test/browser_test_utils.h"
15 #include "extensions/browser/process_manager.h"
16 16
17 namespace extensions { 17 namespace extensions {
18 namespace { 18 namespace {
19 19
20 class ExtensionBindingsApiTest : public ExtensionApiTest {}; 20 class ExtensionBindingsApiTest : public ExtensionApiTest {};
21 21
22 IN_PROC_BROWSER_TEST_F(ExtensionBindingsApiTest, 22 IN_PROC_BROWSER_TEST_F(ExtensionBindingsApiTest,
23 UnavailableBindingsNeverRegistered) { 23 UnavailableBindingsNeverRegistered) {
24 // Test will request the 'storage' permission. 24 // Test will request the 'storage' permission.
25 PermissionsRequestFunction::SetIgnoreUserGestureForTests(true); 25 PermissionsRequestFunction::SetIgnoreUserGestureForTests(true);
26 ASSERT_TRUE(RunExtensionTest( 26 ASSERT_TRUE(RunExtensionTest(
27 "bindings/unavailable_bindings_never_registered")) << message_; 27 "bindings/unavailable_bindings_never_registered")) << message_;
28 } 28 }
29 29
30 IN_PROC_BROWSER_TEST_F(ExtensionBindingsApiTest, 30 IN_PROC_BROWSER_TEST_F(ExtensionBindingsApiTest,
31 ExceptionInHandlerShouldNotCrash) { 31 ExceptionInHandlerShouldNotCrash) {
32 ASSERT_TRUE(RunExtensionSubtest( 32 ASSERT_TRUE(RunExtensionSubtest(
33 "bindings/exception_in_handler_should_not_crash", 33 "bindings/exception_in_handler_should_not_crash",
34 "page.html")) << message_; 34 "page.html")) << message_;
35 } 35 }
36 36
37 // Tests that an error raised during an async function still fires 37 // Tests that an error raised during an async function still fires
38 // the callback, but sets chrome.runtime.lastError. 38 // the callback, but sets chrome.runtime.lastError.
39 // FIXME should be in ExtensionBindingsApiTest. 39 // FIXME should be in ExtensionBindingsApiTest.
40 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, LastError) { 40 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, LastError) {
41 ASSERT_TRUE(LoadExtension( 41 ASSERT_TRUE(LoadExtension(
42 test_data_dir_.AppendASCII("browsertest").AppendASCII("last_error"))); 42 test_data_dir_.AppendASCII("browsertest").AppendASCII("last_error")));
43 43
44 // Get the ExtensionHost that is hosting our background page. 44 // Get the ExtensionHost that is hosting our background page.
45 ExtensionProcessManager* manager = 45 extensions::ProcessManager* manager =
46 extensions::ExtensionSystem::Get(browser()->profile())->process_manager(); 46 extensions::ExtensionSystem::Get(browser()->profile())->process_manager();
47 extensions::ExtensionHost* host = FindHostWithPath(manager, "/bg.html", 1); 47 extensions::ExtensionHost* host = FindHostWithPath(manager, "/bg.html", 1);
48 48
49 bool result = false; 49 bool result = false;
50 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( 50 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(
51 host->render_view_host(), "testLastError()", &result)); 51 host->render_view_host(), "testLastError()", &result));
52 EXPECT_TRUE(result); 52 EXPECT_TRUE(result);
53 } 53 }
54 54
55 // 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
(...skipping 24 matching lines...) Expand all
80 } 80 }
81 81
82 // 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.
83 // Regression test for http://crbug.com/269149. 83 // Regression test for http://crbug.com/269149.
84 IN_PROC_BROWSER_TEST_F(ExtensionBindingsApiTest, EventOverriding) { 84 IN_PROC_BROWSER_TEST_F(ExtensionBindingsApiTest, EventOverriding) {
85 ASSERT_TRUE(RunExtensionTest("bindings/event_overriding")) << message_; 85 ASSERT_TRUE(RunExtensionTest("bindings/event_overriding")) << message_;
86 } 86 }
87 87
88 } // namespace 88 } // namespace
89 } // namespace extensions 89 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/event_router.cc ('k') | chrome/browser/extensions/extension_browsertest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698