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

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

Issue 1661713002: Remove the rest of HostDesktopType from c/b/ui/browser_finder.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@metro-mode-11
Patch Set: linux adl Created 4 years, 10 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/command_line.h" 5 #include "base/command_line.h"
6 #include "build/build_config.h" 6 #include "build/build_config.h"
7 #include "chrome/browser/chrome_notification_types.h" 7 #include "chrome/browser/chrome_notification_types.h"
8 #include "chrome/browser/extensions/extension_apitest.h" 8 #include "chrome/browser/extensions/extension_apitest.h"
9 #include "chrome/browser/extensions/extension_service.h" 9 #include "chrome/browser/extensions/extension_service.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 // tab, we now have 3 tabs. The two app tabs should not be in the same 114 // tab, we now have 3 tabs. The two app tabs should not be in the same
115 // process, since they do not have the background permission. (Thus, we 115 // process, since they do not have the background permission. (Thus, we
116 // want to separate them to improve responsiveness.) 116 // want to separate them to improve responsiveness.)
117 ASSERT_EQ(3, browser()->tab_strip_model()->count()); 117 ASSERT_EQ(3, browser()->tab_strip_model()->count());
118 WebContents* tab1 = browser()->tab_strip_model()->GetWebContentsAt(1); 118 WebContents* tab1 = browser()->tab_strip_model()->GetWebContentsAt(1);
119 WebContents* tab2 = browser()->tab_strip_model()->GetWebContentsAt(2); 119 WebContents* tab2 = browser()->tab_strip_model()->GetWebContentsAt(2);
120 EXPECT_NE(tab1->GetRenderProcessHost(), tab2->GetRenderProcessHost()); 120 EXPECT_NE(tab1->GetRenderProcessHost(), tab2->GetRenderProcessHost());
121 121
122 // Opening tabs with window.open should keep the page in the opener's 122 // Opening tabs with window.open should keep the page in the opener's
123 // process. 123 // process.
124 ASSERT_EQ(1u, chrome::GetBrowserCount(browser()->profile(), 124 ASSERT_EQ(1u, chrome::GetBrowserCount(browser()->profile()));
125 browser()->host_desktop_type()));
126 OpenWindow(tab1, base_url.Resolve("path1/empty.html"), true, NULL); 125 OpenWindow(tab1, base_url.Resolve("path1/empty.html"), true, NULL);
127 LOG(INFO) << "WindowOpenHelper 1."; 126 LOG(INFO) << "WindowOpenHelper 1.";
128 OpenWindow(tab2, base_url.Resolve("path2/empty.html"), true, NULL); 127 OpenWindow(tab2, base_url.Resolve("path2/empty.html"), true, NULL);
129 LOG(INFO) << "End of test."; 128 LOG(INFO) << "End of test.";
130 UnloadExtension(extension->id()); 129 UnloadExtension(extension->id());
131 } 130 }
132 }; 131 };
133 132
134 // Omits the disable-popup-blocking flag so we can cover that case. 133 // Omits the disable-popup-blocking flag so we can cover that case.
135 class BlockedAppApiTest : public AppApiTest { 134 class BlockedAppApiTest : public AppApiTest {
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 WebContents* tab = browser()->tab_strip_model()->GetWebContentsAt(1); 201 WebContents* tab = browser()->tab_strip_model()->GetWebContentsAt(1);
203 202
204 EXPECT_EQ(tab->GetRenderProcessHost(), 203 EXPECT_EQ(tab->GetRenderProcessHost(),
205 browser()->tab_strip_model()->GetWebContentsAt(2)-> 204 browser()->tab_strip_model()->GetWebContentsAt(2)->
206 GetRenderProcessHost()); 205 GetRenderProcessHost());
207 EXPECT_NE(tab->GetRenderProcessHost(), 206 EXPECT_NE(tab->GetRenderProcessHost(),
208 browser()->tab_strip_model()->GetWebContentsAt(3)-> 207 browser()->tab_strip_model()->GetWebContentsAt(3)->
209 GetRenderProcessHost()); 208 GetRenderProcessHost());
210 209
211 // Now let's do the same using window.open. The same should happen. 210 // Now let's do the same using window.open. The same should happen.
212 ASSERT_EQ(1u, chrome::GetBrowserCount(browser()->profile(), 211 ASSERT_EQ(1u, chrome::GetBrowserCount(browser()->profile()));
213 browser()->host_desktop_type()));
214 OpenWindow(tab, base_url.Resolve("path1/empty.html"), true, NULL); 212 OpenWindow(tab, base_url.Resolve("path1/empty.html"), true, NULL);
215 LOG(INFO) << "WindowOpenHelper 1."; 213 LOG(INFO) << "WindowOpenHelper 1.";
216 OpenWindow(tab, base_url.Resolve("path2/empty.html"), true, NULL); 214 OpenWindow(tab, base_url.Resolve("path2/empty.html"), true, NULL);
217 LOG(INFO) << "WindowOpenHelper 2."; 215 LOG(INFO) << "WindowOpenHelper 2.";
218 // TODO(creis): This should open in a new process (i.e., false for the last 216 // TODO(creis): This should open in a new process (i.e., false for the last
219 // argument), but we temporarily avoid swapping processes away from a hosted 217 // argument), but we temporarily avoid swapping processes away from a hosted
220 // app if it has an opener, because some OAuth providers make script calls 218 // app if it has an opener, because some OAuth providers make script calls
221 // between non-app popups and non-app iframes in the app process. 219 // between non-app popups and non-app iframes in the app process.
222 // See crbug.com/59285. 220 // See crbug.com/59285.
223 OpenWindow(tab, base_url.Resolve("path3/empty.html"), true, NULL); 221 OpenWindow(tab, base_url.Resolve("path3/empty.html"), true, NULL);
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 // We should have opened 2 new bookmark app tabs. Including the original blank 338 // We should have opened 2 new bookmark app tabs. Including the original blank
341 // tab, we now have 3 tabs. Because normal pages use the 339 // tab, we now have 3 tabs. Because normal pages use the
342 // process-per-site-instance model, each should be in its own process. 340 // process-per-site-instance model, each should be in its own process.
343 ASSERT_EQ(3, browser()->tab_strip_model()->count()); 341 ASSERT_EQ(3, browser()->tab_strip_model()->count());
344 WebContents* tab = browser()->tab_strip_model()->GetWebContentsAt(1); 342 WebContents* tab = browser()->tab_strip_model()->GetWebContentsAt(1);
345 EXPECT_NE(tab->GetRenderProcessHost(), 343 EXPECT_NE(tab->GetRenderProcessHost(),
346 browser()->tab_strip_model()->GetWebContentsAt(2)-> 344 browser()->tab_strip_model()->GetWebContentsAt(2)->
347 GetRenderProcessHost()); 345 GetRenderProcessHost());
348 346
349 // Now let's do the same using window.open. The same should happen. 347 // Now let's do the same using window.open. The same should happen.
350 ASSERT_EQ(1u, chrome::GetBrowserCount(browser()->profile(), 348 ASSERT_EQ(1u, chrome::GetBrowserCount(browser()->profile()));
351 browser()->host_desktop_type()));
352 OpenWindow(tab, base_url.Resolve("path1/empty.html"), true, NULL); 349 OpenWindow(tab, base_url.Resolve("path1/empty.html"), true, NULL);
353 OpenWindow(tab, base_url.Resolve("path2/empty.html"), true, NULL); 350 OpenWindow(tab, base_url.Resolve("path2/empty.html"), true, NULL);
354 351
355 // Now let's have a tab navigate out of and back into the app's web 352 // Now let's have a tab navigate out of and back into the app's web
356 // extent. Neither navigation should switch processes. 353 // extent. Neither navigation should switch processes.
357 const GURL& app_url(base_url.Resolve("path1/empty.html")); 354 const GURL& app_url(base_url.Resolve("path1/empty.html"));
358 const GURL& non_app_url(base_url.Resolve("path3/empty.html")); 355 const GURL& non_app_url(base_url.Resolve("path3/empty.html"));
359 RenderViewHost* host2 = 356 RenderViewHost* host2 =
360 browser()->tab_strip_model()->GetWebContentsAt(2)->GetRenderViewHost(); 357 browser()->tab_strip_model()->GetWebContentsAt(2)->GetRenderViewHost();
361 NavigateInRenderer(browser()->tab_strip_model()->GetWebContentsAt(2), 358 NavigateInRenderer(browser()->tab_strip_model()->GetWebContentsAt(2),
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after
863 // Navigate the popup to another process outside the app. 860 // Navigate the popup to another process outside the app.
864 GURL non_app_url(base_url.Resolve("path3/empty.html")); 861 GURL non_app_url(base_url.Resolve("path3/empty.html"));
865 ui_test_utils::NavigateToURL(active_browser_list->get(1), non_app_url); 862 ui_test_utils::NavigateToURL(active_browser_list->get(1), non_app_url);
866 SiteInstance* new_instance = popup_contents->GetSiteInstance(); 863 SiteInstance* new_instance = popup_contents->GetSiteInstance();
867 EXPECT_NE(app_instance, new_instance); 864 EXPECT_NE(app_instance, new_instance);
868 865
869 // It should still be in the same BrowsingInstance, allowing postMessage to 866 // It should still be in the same BrowsingInstance, allowing postMessage to
870 // work. 867 // work.
871 EXPECT_TRUE(app_instance->IsRelatedSiteInstance(new_instance)); 868 EXPECT_TRUE(app_instance->IsRelatedSiteInstance(new_instance));
872 } 869 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/tabs/tabs_api.cc ('k') | chrome/browser/extensions/chrome_extension_function.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698