OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/extensions/extension_apitest.h" | 6 #include "chrome/browser/extensions/extension_apitest.h" |
7 #include "chrome/browser/extensions/extension_host.h" | 7 #include "chrome/browser/extensions/extension_host.h" |
8 #include "chrome/browser/extensions/extension_process_manager.h" | 8 #include "chrome/browser/extensions/extension_process_manager.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
126 EXPECT_NE(host->process(), | 126 EXPECT_NE(host->process(), |
127 browser()->GetTabContentsAt(3)->render_view_host()->process()); | 127 browser()->GetTabContentsAt(3)->render_view_host()->process()); |
128 | 128 |
129 // Now let's do the same using window.open. The same should happen. | 129 // Now let's do the same using window.open. The same should happen. |
130 ASSERT_EQ(1u, BrowserList::GetBrowserCount(browser()->profile())); | 130 ASSERT_EQ(1u, BrowserList::GetBrowserCount(browser()->profile())); |
131 WindowOpenHelper(browser(), host, | 131 WindowOpenHelper(browser(), host, |
132 base_url.Resolve("path1/empty.html"), true); | 132 base_url.Resolve("path1/empty.html"), true); |
133 WindowOpenHelper(browser(), host, | 133 WindowOpenHelper(browser(), host, |
134 base_url.Resolve("path2/empty.html"), true); | 134 base_url.Resolve("path2/empty.html"), true); |
135 // This should open in a new process (i.e., false for the last argument). | 135 // This should open in a new process (i.e., false for the last argument). |
136 // TODO(creis): Do we want the fix to change this behavior? The alternative | |
137 // is to require the opener URL to be a non-extension URL in order to keep the | |
Mihai Parparita -not on Chrome
2011/08/17 20:33:09
I think requiring this makes sense (it would still
Charlie Reis
2011/08/17 21:55:24
Agreed-- I've updated the logic so we don't affect
| |
138 // popup in process. (I'm not sure whether we want an app page to open a | |
139 // non-app popup in the same process, just because they're same origin.) | |
136 WindowOpenHelper(browser(), host, | 140 WindowOpenHelper(browser(), host, |
137 base_url.Resolve("path3/empty.html"), false); | 141 base_url.Resolve("path3/empty.html"), true); |
138 | 142 |
139 // Now let's have these pages navigate, into or out of the extension web | 143 // Now let's have these pages navigate, into or out of the extension web |
140 // extent. They should switch processes. | 144 // extent. They should switch processes. |
141 const GURL& app_url(base_url.Resolve("path1/empty.html")); | 145 const GURL& app_url(base_url.Resolve("path1/empty.html")); |
142 const GURL& non_app_url(base_url.Resolve("path3/empty.html")); | 146 const GURL& non_app_url(base_url.Resolve("path3/empty.html")); |
143 NavigateTabHelper(browser()->GetTabContentsAt(2), non_app_url); | 147 NavigateTabHelper(browser()->GetTabContentsAt(2), non_app_url); |
144 NavigateTabHelper(browser()->GetTabContentsAt(3), app_url); | 148 NavigateTabHelper(browser()->GetTabContentsAt(3), app_url); |
145 EXPECT_NE(host->process(), | 149 EXPECT_NE(host->process(), |
146 browser()->GetTabContentsAt(2)->render_view_host()->process()); | 150 browser()->GetTabContentsAt(2)->render_view_host()->process()); |
147 EXPECT_EQ(host->process(), | 151 EXPECT_EQ(host->process(), |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
362 // Crash the tab and reload it, chrome.app.isInstalled should still be true. | 366 // Crash the tab and reload it, chrome.app.isInstalled should still be true. |
363 ui_test_utils::CrashTab(browser()->GetSelectedTabContents()); | 367 ui_test_utils::CrashTab(browser()->GetSelectedTabContents()); |
364 browser()->Reload(CURRENT_TAB); | 368 browser()->Reload(CURRENT_TAB); |
365 ASSERT_TRUE(ui_test_utils::WaitForNavigationInCurrentTab(browser())); | 369 ASSERT_TRUE(ui_test_utils::WaitForNavigationInCurrentTab(browser())); |
366 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( | 370 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( |
367 contents->render_view_host(), L"", | 371 contents->render_view_host(), L"", |
368 L"window.domAutomationController.send(chrome.app.isInstalled)", | 372 L"window.domAutomationController.send(chrome.app.isInstalled)", |
369 &is_installed)); | 373 &is_installed)); |
370 ASSERT_TRUE(is_installed); | 374 ASSERT_TRUE(is_installed); |
371 } | 375 } |
OLD | NEW |