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

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

Issue 7048015: Fix app process initialization when opening an app in a new tab. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 GURL base_url = test_server()->GetURL( 74 GURL base_url = test_server()->GetURL(
75 "files/extensions/api_test/app_process/"); 75 "files/extensions/api_test/app_process/");
76 76
77 // The app under test acts on URLs whose host is "localhost", 77 // The app under test acts on URLs whose host is "localhost",
78 // so the URLs we navigate to must have host "localhost". 78 // so the URLs we navigate to must have host "localhost".
79 GURL::Replacements replace_host; 79 GURL::Replacements replace_host;
80 std::string host_str("localhost"); // must stay in scope with replace_host 80 std::string host_str("localhost"); // must stay in scope with replace_host
81 replace_host.SetHostStr(host_str); 81 replace_host.SetHostStr(host_str);
82 base_url = base_url.ReplaceComponents(replace_host); 82 base_url = base_url.ReplaceComponents(replace_host);
83 83
84 browser()->NewTab(); 84 // Test both opening a URL in a new tab, and opening a tab and then navigating
85 ui_test_utils::NavigateToURL(browser(), base_url.Resolve("path1/empty.html")); 85 // it. Either way, app tabs should be considered extension processes.
86 ui_test_utils::NavigateToURLWithDisposition(
87 browser(), base_url.Resolve("path1/empty.html"), NEW_FOREGROUND_TAB,
88 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
89 EXPECT_TRUE(browser()->GetTabContentsAt(1)->render_view_host()->process()->
90 is_extension_process());
86 browser()->NewTab(); 91 browser()->NewTab();
87 ui_test_utils::NavigateToURL(browser(), base_url.Resolve("path2/empty.html")); 92 ui_test_utils::NavigateToURL(browser(), base_url.Resolve("path2/empty.html"));
93 EXPECT_TRUE(browser()->GetTabContentsAt(2)->render_view_host()->process()->
94 is_extension_process());
88 browser()->NewTab(); 95 browser()->NewTab();
89 ui_test_utils::NavigateToURL(browser(), base_url.Resolve("path3/empty.html")); 96 ui_test_utils::NavigateToURL(browser(), base_url.Resolve("path3/empty.html"));
97 EXPECT_FALSE(browser()->GetTabContentsAt(3)->render_view_host()->process()->
98 is_extension_process());
90 99
91 // The extension should have opened 3 new tabs. Including the original blank 100 // The extension should have opened 3 new tabs. Including the original blank
92 // tab, we now have 4 tabs. Two should be part of the extension app, and 101 // tab, we now have 4 tabs. Two should be part of the extension app, and
93 // grouped in the same process. 102 // grouped in the same process.
94 ASSERT_EQ(4, browser()->tab_count()); 103 ASSERT_EQ(4, browser()->tab_count());
95 RenderViewHost* host = browser()->GetTabContentsAt(1)->render_view_host(); 104 RenderViewHost* host = browser()->GetTabContentsAt(1)->render_view_host();
96 105
97 EXPECT_EQ(host->process(), 106 EXPECT_EQ(host->process(),
98 browser()->GetTabContentsAt(2)->render_view_host()->process()); 107 browser()->GetTabContentsAt(2)->render_view_host()->process());
99 EXPECT_NE(host->process(), 108 EXPECT_NE(host->process(),
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 // 3 tabs, including the initial about:blank. The last 2 should be the same 178 // 3 tabs, including the initial about:blank. The last 2 should be the same
170 // process. 179 // process.
171 ASSERT_EQ(3, browser()->tab_count()); 180 ASSERT_EQ(3, browser()->tab_count());
172 EXPECT_EQ("/files/extensions/api_test/app_process/path1/empty.html", 181 EXPECT_EQ("/files/extensions/api_test/app_process/path1/empty.html",
173 browser()->GetTabContentsAt(2)->controller(). 182 browser()->GetTabContentsAt(2)->controller().
174 GetLastCommittedEntry()->url().path()); 183 GetLastCommittedEntry()->url().path());
175 RenderViewHost* host = browser()->GetTabContentsAt(1)->render_view_host(); 184 RenderViewHost* host = browser()->GetTabContentsAt(1)->render_view_host();
176 EXPECT_EQ(host->process(), 185 EXPECT_EQ(host->process(),
177 browser()->GetTabContentsAt(2)->render_view_host()->process()); 186 browser()->GetTabContentsAt(2)->render_view_host()->process());
178 } 187 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/webui/chrome_web_ui_factory.cc » ('j') | chrome/browser/ui/webui/chrome_web_ui_factory.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698