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

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

Issue 3263007: Reland r57788 - Expose Extension Bindings to Component Applications (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: don't hide gallery url in omnibar Created 10 years, 3 months 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/utf_string_conversions.h" 5 #include "base/utf_string_conversions.h"
6 #include "chrome/browser/browser.h" 6 #include "chrome/browser/browser.h"
7 #include "chrome/browser/browser_list.h" 7 #include "chrome/browser/browser_list.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" 10 #include "chrome/browser/extensions/extension_process_manager.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 GURL base_url("http://localhost:1337/files/extensions/api_test/app_process/"); 79 GURL base_url("http://localhost:1337/files/extensions/api_test/app_process/");
80 browser()->NewTab(); 80 browser()->NewTab();
81 ui_test_utils::NavigateToURL(browser(), base_url.Resolve("path1/empty.html")); 81 ui_test_utils::NavigateToURL(browser(), base_url.Resolve("path1/empty.html"));
82 browser()->NewTab(); 82 browser()->NewTab();
83 ui_test_utils::NavigateToURL(browser(), base_url.Resolve("path2/empty.html")); 83 ui_test_utils::NavigateToURL(browser(), base_url.Resolve("path2/empty.html"));
84 browser()->NewTab(); 84 browser()->NewTab();
85 ui_test_utils::NavigateToURL(browser(), base_url.Resolve("path3/empty.html")); 85 ui_test_utils::NavigateToURL(browser(), base_url.Resolve("path3/empty.html"));
86 86
87 // The extension should have opened 3 new tabs. Including the original blank 87 // The extension should have opened 3 new tabs. Including the original blank
88 // tab, we now have 4 tabs. Two should be part of the extension app, and 88 // tab, we now have 4 tabs. Two should be part of the extension app, and
89 // grouped in the extension process. 89 // grouped in the same process.
90 ASSERT_EQ(4, browser()->tab_count()); 90 ASSERT_EQ(4, browser()->tab_count());
91 RenderViewHost* host = browser()->GetTabContentsAt(1)->render_view_host(); 91 RenderViewHost* host = browser()->GetTabContentsAt(1)->render_view_host();
92 EXPECT_TRUE(host->is_extension_process());
93 92
94 EXPECT_EQ(host->process(), 93 EXPECT_EQ(host->process(),
95 browser()->GetTabContentsAt(2)->render_view_host()->process()); 94 browser()->GetTabContentsAt(2)->render_view_host()->process());
96 EXPECT_NE(host->process(), 95 EXPECT_NE(host->process(),
97 browser()->GetTabContentsAt(3)->render_view_host()->process()); 96 browser()->GetTabContentsAt(3)->render_view_host()->process());
98 97
99 // Now let's do the same using window.open. The same should happen. 98 // Now let's do the same using window.open. The same should happen.
100 ASSERT_EQ(1u, BrowserList::GetBrowserCount(browser()->profile())); 99 ASSERT_EQ(1u, BrowserList::GetBrowserCount(browser()->profile()));
101 WindowOpenHelper(browser(), host, 100 WindowOpenHelper(browser(), host,
102 base_url.Resolve("path1/empty.html"), true); 101 base_url.Resolve("path1/empty.html"), true);
103 WindowOpenHelper(browser(), host, 102 WindowOpenHelper(browser(), host,
104 base_url.Resolve("path2/empty.html"), true); 103 base_url.Resolve("path2/empty.html"), true);
105 WindowOpenHelper(browser(), host, 104 WindowOpenHelper(browser(), host,
106 base_url.Resolve("path3/empty.html"), false); 105 base_url.Resolve("path3/empty.html"), false);
107 106
108 // Now let's have these pages navigate, into or out of the extension web 107 // Now let's have these pages navigate, into or out of the extension web
109 // extent. They should switch processes. 108 // extent. They should switch processes.
110 const GURL& app_url(base_url.Resolve("path1/empty.html")); 109 const GURL& app_url(base_url.Resolve("path1/empty.html"));
111 const GURL& non_app_url(base_url.Resolve("path3/empty.html")); 110 const GURL& non_app_url(base_url.Resolve("path3/empty.html"));
112 NavigateTabHelper(browser()->GetTabContentsAt(2), non_app_url); 111 NavigateTabHelper(browser()->GetTabContentsAt(2), non_app_url);
113 NavigateTabHelper(browser()->GetTabContentsAt(3), app_url); 112 NavigateTabHelper(browser()->GetTabContentsAt(3), app_url);
114 EXPECT_NE(host->process(), 113 EXPECT_NE(host->process(),
115 browser()->GetTabContentsAt(2)->render_view_host()->process()); 114 browser()->GetTabContentsAt(2)->render_view_host()->process());
116 EXPECT_EQ(host->process(), 115 EXPECT_EQ(host->process(),
117 browser()->GetTabContentsAt(3)->render_view_host()->process()); 116 browser()->GetTabContentsAt(3)->render_view_host()->process());
118 } 117 }
OLDNEW
« no previous file with comments | « chrome/browser/dom_ui/dom_ui_factory.cc ('k') | chrome/browser/extensions/content_script_all_frames_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698