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

Side by Side Diff: chrome/browser/renderer_host/test/render_process_host_browsertest.cc

Issue 4145013: DOMUI: Use ShowSingletonTab to open the settings tab. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: csilv review fixes. Created 10 years, 1 month 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 | « chrome/browser/dom_ui/bug_report_ui.cc ('k') | chrome/browser/ui/browser.h » ('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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "chrome/browser/profile.h" 5 #include "chrome/browser/profile.h"
6 #include "chrome/browser/renderer_host/site_instance.h" 6 #include "chrome/browser/renderer_host/site_instance.h"
7 #include "chrome/browser/tab_contents/tab_contents.h" 7 #include "chrome/browser/tab_contents/tab_contents.h"
8 #include "chrome/browser/renderer_host/render_process_host.h" 8 #include "chrome/browser/renderer_host/render_process_host.h"
9 #include "chrome/browser/ui/browser.h" 9 #include "chrome/browser/ui/browser.h"
10 #include "chrome/common/url_constants.h" 10 #include "chrome/common/url_constants.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 GURL newtab(chrome::kChromeUINewTabURL); 51 GURL newtab(chrome::kChromeUINewTabURL);
52 ui_test_utils::NavigateToURL(browser(), newtab); 52 ui_test_utils::NavigateToURL(browser(), newtab);
53 EXPECT_EQ(tab_count, browser()->tab_count()); 53 EXPECT_EQ(tab_count, browser()->tab_count());
54 tab1 = browser()->GetTabContentsAt(tab_count - 1); 54 tab1 = browser()->GetTabContentsAt(tab_count - 1);
55 rph1 = tab1->GetRenderProcessHost(); 55 rph1 = tab1->GetRenderProcessHost();
56 EXPECT_EQ(tab1->GetURL(), newtab); 56 EXPECT_EQ(tab1->GetURL(), newtab);
57 EXPECT_EQ(host_count, RenderProcessHostCount()); 57 EXPECT_EQ(host_count, RenderProcessHostCount());
58 58
59 // Create a new TYPE_NORMAL tab. It should be in its own process. 59 // Create a new TYPE_NORMAL tab. It should be in its own process.
60 GURL page1("data:text/html,hello world1"); 60 GURL page1("data:text/html,hello world1");
61 browser()->ShowSingletonTab(page1); 61 browser()->ShowSingletonTab(page1, false);
62 if (browser()->tab_count() == tab_count) 62 if (browser()->tab_count() == tab_count)
63 ui_test_utils::WaitForNewTab(browser()); 63 ui_test_utils::WaitForNewTab(browser());
64 tab_count++; 64 tab_count++;
65 host_count++; 65 host_count++;
66 EXPECT_EQ(tab_count, browser()->tab_count()); 66 EXPECT_EQ(tab_count, browser()->tab_count());
67 tab1 = browser()->GetTabContentsAt(tab_count - 1); 67 tab1 = browser()->GetTabContentsAt(tab_count - 1);
68 rph2 = tab1->GetRenderProcessHost(); 68 rph2 = tab1->GetRenderProcessHost();
69 EXPECT_EQ(tab1->GetURL(), page1); 69 EXPECT_EQ(tab1->GetURL(), page1);
70 EXPECT_EQ(host_count, RenderProcessHostCount()); 70 EXPECT_EQ(host_count, RenderProcessHostCount());
71 EXPECT_NE(rph1, rph2); 71 EXPECT_NE(rph1, rph2);
72 72
73 // Create another TYPE_NORMAL tab. It should share the previous process. 73 // Create another TYPE_NORMAL tab. It should share the previous process.
74 GURL page2("data:text/html,hello world2"); 74 GURL page2("data:text/html,hello world2");
75 browser()->ShowSingletonTab(page2); 75 browser()->ShowSingletonTab(page2, false);
76 if (browser()->tab_count() == tab_count) 76 if (browser()->tab_count() == tab_count)
77 ui_test_utils::WaitForNewTab(browser()); 77 ui_test_utils::WaitForNewTab(browser());
78 tab_count++; 78 tab_count++;
79 EXPECT_EQ(tab_count, browser()->tab_count()); 79 EXPECT_EQ(tab_count, browser()->tab_count());
80 tab2 = browser()->GetTabContentsAt(tab_count - 1); 80 tab2 = browser()->GetTabContentsAt(tab_count - 1);
81 EXPECT_EQ(tab2->GetURL(), page2); 81 EXPECT_EQ(tab2->GetURL(), page2);
82 EXPECT_EQ(host_count, RenderProcessHostCount()); 82 EXPECT_EQ(host_count, RenderProcessHostCount());
83 EXPECT_EQ(tab2->GetRenderProcessHost(), rph2); 83 EXPECT_EQ(tab2->GetRenderProcessHost(), rph2);
84 84
85 // Create another TYPE_DOMUI tab. It should share the process with newtab. 85 // Create another TYPE_DOMUI tab. It should share the process with newtab.
86 // Note: intentionally create this tab after the TYPE_NORMAL tabs to exercise 86 // Note: intentionally create this tab after the TYPE_NORMAL tabs to exercise
87 // bug 43448 where extension and DOMUI tabs could get combined into normal 87 // bug 43448 where extension and DOMUI tabs could get combined into normal
88 // renderers. 88 // renderers.
89 GURL history(chrome::kChromeUIHistoryURL); 89 GURL history(chrome::kChromeUIHistoryURL);
90 browser()->ShowSingletonTab(history); 90 browser()->ShowSingletonTab(history, false);
91 if (browser()->tab_count() == tab_count) 91 if (browser()->tab_count() == tab_count)
92 ui_test_utils::WaitForNewTab(browser()); 92 ui_test_utils::WaitForNewTab(browser());
93 tab_count++; 93 tab_count++;
94 EXPECT_EQ(tab_count, browser()->tab_count()); 94 EXPECT_EQ(tab_count, browser()->tab_count());
95 tab2 = browser()->GetTabContentsAt(tab_count - 1); 95 tab2 = browser()->GetTabContentsAt(tab_count - 1);
96 EXPECT_EQ(tab2->GetURL(), history); 96 EXPECT_EQ(tab2->GetURL(), history);
97 EXPECT_EQ(host_count, RenderProcessHostCount()); 97 EXPECT_EQ(host_count, RenderProcessHostCount());
98 EXPECT_EQ(tab2->GetRenderProcessHost(), rph1); 98 EXPECT_EQ(tab2->GetRenderProcessHost(), rph1);
99 99
100 // Create a TYPE_EXTENSION tab. It should be in its own process. 100 // Create a TYPE_EXTENSION tab. It should be in its own process.
101 // (the bookmark manager is implemented as an extension) 101 // (the bookmark manager is implemented as an extension)
102 GURL bookmarks(chrome::kChromeUIBookmarksURL); 102 GURL bookmarks(chrome::kChromeUIBookmarksURL);
103 browser()->ShowSingletonTab(bookmarks); 103 browser()->ShowSingletonTab(bookmarks, false);
104 if (browser()->tab_count() == tab_count) 104 if (browser()->tab_count() == tab_count)
105 ui_test_utils::WaitForNewTab(browser()); 105 ui_test_utils::WaitForNewTab(browser());
106 tab_count++; 106 tab_count++;
107 host_count++; 107 host_count++;
108 EXPECT_EQ(tab_count, browser()->tab_count()); 108 EXPECT_EQ(tab_count, browser()->tab_count());
109 tab1 = browser()->GetTabContentsAt(tab_count - 1); 109 tab1 = browser()->GetTabContentsAt(tab_count - 1);
110 rph3 = tab1->GetRenderProcessHost(); 110 rph3 = tab1->GetRenderProcessHost();
111 EXPECT_EQ(tab1->GetURL(), bookmarks); 111 EXPECT_EQ(tab1->GetURL(), bookmarks);
112 EXPECT_EQ(host_count, RenderProcessHostCount()); 112 EXPECT_EQ(host_count, RenderProcessHostCount());
113 EXPECT_NE(rph1, rph3); 113 EXPECT_NE(rph1, rph3);
114 EXPECT_NE(rph2, rph3); 114 EXPECT_NE(rph2, rph3);
115 } 115 }
OLDNEW
« no previous file with comments | « chrome/browser/dom_ui/bug_report_ui.cc ('k') | chrome/browser/ui/browser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698