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

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

Issue 7063015: Swap processes on reload if a hosted app has been installed/uninstalled. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compile on Windows Created 9 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/task_manager/task_manager_browsertest.cc » ('j') | no next file with comments »
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_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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 // 3 tabs, including the initial about:blank. The last 2 should be the same 182 // 3 tabs, including the initial about:blank. The last 2 should be the same
183 // process. 183 // process.
184 ASSERT_EQ(3, browser()->tab_count()); 184 ASSERT_EQ(3, browser()->tab_count());
185 EXPECT_EQ("/files/extensions/api_test/app_process/path1/empty.html", 185 EXPECT_EQ("/files/extensions/api_test/app_process/path1/empty.html",
186 browser()->GetTabContentsAt(2)->controller(). 186 browser()->GetTabContentsAt(2)->controller().
187 GetLastCommittedEntry()->url().path()); 187 GetLastCommittedEntry()->url().path());
188 RenderViewHost* host = browser()->GetTabContentsAt(1)->render_view_host(); 188 RenderViewHost* host = browser()->GetTabContentsAt(1)->render_view_host();
189 EXPECT_EQ(host->process(), 189 EXPECT_EQ(host->process(),
190 browser()->GetTabContentsAt(2)->render_view_host()->process()); 190 browser()->GetTabContentsAt(2)->render_view_host()->process());
191 } 191 }
192
193 // Ensure that reloading a URL after installing or uninstalling it as an app
194 // correctly swaps the process. (http://crbug.com/80621)
195 IN_PROC_BROWSER_TEST_F(AppApiTest, ReloadIntoAppProcess) {
196 CommandLine::ForCurrentProcess()->AppendSwitch(
197 switches::kDisablePopupBlocking);
198
199 host_resolver()->AddRule("*", "127.0.0.1");
200 ASSERT_TRUE(test_server()->Start());
201
202 // The app under test acts on URLs whose host is "localhost",
203 // so the URLs we navigate to must have host "localhost".
204 GURL::Replacements replace_host;
205 std::string host_str("localhost"); // must stay in scope with replace_host
206 replace_host.SetHostStr(host_str);
207 GURL base_url = test_server()->GetURL(
208 "files/extensions/api_test/app_process/");
209 base_url = base_url.ReplaceComponents(replace_host);
210
211 // Load an app URL before loading the app.
212 ui_test_utils::NavigateToURL(browser(), base_url.Resolve("path1/empty.html"));
213 TabContents* contents = browser()->GetTabContentsAt(0);
214 EXPECT_FALSE(contents->render_view_host()->process()->is_extension_process());
215
216 // Load app and reload page.
217 const Extension* app =
218 LoadExtension(test_data_dir_.AppendASCII("app_process"));
219 ASSERT_TRUE(app);
220 ui_test_utils::NavigateToURL(browser(), base_url.Resolve("path1/empty.html"));
221 EXPECT_TRUE(contents->render_view_host()->process()->is_extension_process());
222
223 // Disable app and reload page.
224 DisableExtension(app->id());
225 ui_test_utils::NavigateToURL(browser(), base_url.Resolve("path1/empty.html"));
226 EXPECT_FALSE(contents->render_view_host()->process()->is_extension_process());
227
228 // Enable app and reload via JavaScript.
229 EnableExtension(app->id());
230 ASSERT_TRUE(ui_test_utils::ExecuteJavaScript(contents->render_view_host(),
231 L"", L"location.reload();"));
232 ui_test_utils::WaitForNavigation(&contents->controller());
233 EXPECT_TRUE(contents->render_view_host()->process()->is_extension_process());
234
235 // Disable app and reload via JavaScript.
236 DisableExtension(app->id());
237 ASSERT_TRUE(ui_test_utils::ExecuteJavaScript(contents->render_view_host(),
238 L"", L"location.reload();"));
239 ui_test_utils::WaitForNavigation(&contents->controller());
240 EXPECT_FALSE(contents->render_view_host()->process()->is_extension_process());
241 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/task_manager/task_manager_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698