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

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

Issue 8760024: Cross-process postMessage (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 9 years 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
« no previous file with comments | « no previous file | chrome/browser/ui/browser.cc » ('j') | chrome/browser/ui/browser_navigator.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_service.h" 8 #include "chrome/browser/extensions/extension_service.h"
9 #include "chrome/browser/extensions/process_map.h" 9 #include "chrome/browser/extensions/process_map.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 browser()->GetTabContentsAt(3)->render_view_host()->process()); 142 browser()->GetTabContentsAt(3)->render_view_host()->process());
143 143
144 // Now let's do the same using window.open. The same should happen. 144 // Now let's do the same using window.open. The same should happen.
145 ASSERT_EQ(1u, BrowserList::GetBrowserCount(browser()->profile())); 145 ASSERT_EQ(1u, BrowserList::GetBrowserCount(browser()->profile()));
146 WindowOpenHelper(browser(), host, 146 WindowOpenHelper(browser(), host,
147 base_url.Resolve("path1/empty.html"), true); 147 base_url.Resolve("path1/empty.html"), true);
148 LOG(INFO) << "WindowOpenHelper 1."; 148 LOG(INFO) << "WindowOpenHelper 1.";
149 WindowOpenHelper(browser(), host, 149 WindowOpenHelper(browser(), host,
150 base_url.Resolve("path2/empty.html"), true); 150 base_url.Resolve("path2/empty.html"), true);
151 LOG(INFO) << "WindowOpenHelper 2."; 151 LOG(INFO) << "WindowOpenHelper 2.";
152 // TODO(creis): This should open in a new process (i.e., false for the last 152 // This should open in a new process (i.e., false for the last argument).
153 // argument), but we temporarily avoid swapping processes away from an app
154 // until we're able to support cross-process postMessage calls.
155 // See crbug.com/59285.
156 WindowOpenHelper(browser(), host, 153 WindowOpenHelper(browser(), host,
157 base_url.Resolve("path3/empty.html"), true); 154 base_url.Resolve("path3/empty.html"), true);
158 LOG(INFO) << "WindowOpenHelper 3."; 155 LOG(INFO) << "WindowOpenHelper 3.";
159 156
160 // Now let's have these pages navigate, into or out of the extension web 157 // Now let's have these pages navigate, into or out of the extension web
161 // extent. They should switch processes. 158 // extent. They should switch processes.
162 const GURL& app_url(base_url.Resolve("path1/empty.html")); 159 const GURL& app_url(base_url.Resolve("path1/empty.html"));
163 const GURL& non_app_url(base_url.Resolve("path3/empty.html")); 160 const GURL& non_app_url(base_url.Resolve("path3/empty.html"));
164 NavigateTabHelper(browser()->GetTabContentsAt(2), non_app_url); 161 NavigateTabHelper(browser()->GetTabContentsAt(2), non_app_url);
165 LOG(INFO) << "NavigateTabHelper 1."; 162 LOG(INFO) << "NavigateTabHelper 1.";
166 NavigateTabHelper(browser()->GetTabContentsAt(3), app_url); 163 NavigateTabHelper(browser()->GetTabContentsAt(3), app_url);
167 LOG(INFO) << "NavigateTabHelper 2."; 164 LOG(INFO) << "NavigateTabHelper 2.";
168 // TODO(creis): This should swap out of the app's process (i.e., EXPECT_NE), 165 EXPECT_NE(host->process(),
169 // but we temporarily avoid swapping away from an app in case the window
170 // tries to send a postMessage to the app. See crbug.com/59285.
171 EXPECT_EQ(host->process(),
172 browser()->GetTabContentsAt(2)->render_view_host()->process()); 166 browser()->GetTabContentsAt(2)->render_view_host()->process());
173 EXPECT_EQ(host->process(), 167 EXPECT_EQ(host->process(),
174 browser()->GetTabContentsAt(3)->render_view_host()->process()); 168 browser()->GetTabContentsAt(3)->render_view_host()->process());
175 169
176 // If one of the popup tabs navigates back to the app, window.opener should 170 // If one of the popup tabs navigates back to the app, window.opener should
177 // be valid. 171 // be valid.
178 NavigateTabHelper(browser()->GetTabContentsAt(6), app_url); 172 NavigateTabHelper(browser()->GetTabContentsAt(6), app_url);
179 LOG(INFO) << "NavigateTabHelper 3."; 173 LOG(INFO) << "NavigateTabHelper 3.";
180 EXPECT_EQ(host->process(), 174 EXPECT_EQ(host->process(),
181 browser()->GetTabContentsAt(6)->render_view_host()->process()); 175 browser()->GetTabContentsAt(6)->render_view_host()->process());
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 content::Source<NavigationController>( 578 content::Source<NavigationController>(
585 &browser()->GetSelectedTabContentsWrapper()->controller())); 579 &browser()->GetSelectedTabContentsWrapper()->controller()));
586 browser()->Reload(CURRENT_TAB); 580 browser()->Reload(CURRENT_TAB);
587 observer.Wait(); 581 observer.Wait();
588 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( 582 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool(
589 contents->render_view_host(), L"", 583 contents->render_view_host(), L"",
590 L"window.domAutomationController.send(chrome.app.isInstalled)", 584 L"window.domAutomationController.send(chrome.app.isInstalled)",
591 &is_installed)); 585 &is_installed));
592 ASSERT_TRUE(is_installed); 586 ASSERT_TRUE(is_installed);
593 } 587 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/browser.cc » ('j') | chrome/browser/ui/browser_navigator.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698