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

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

Issue 12315094: Remove kDefaultHostDesktopType from browser_finder.cc. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix StartupBrowserCreatorTest.ProfilesWithoutPagesNotLaunched Created 7 years, 9 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) 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 "base/memory/scoped_vector.h" 6 #include "base/memory/scoped_vector.h"
7 #include "base/stringprintf.h" 7 #include "base/stringprintf.h"
8 #include "chrome/browser/extensions/extension_apitest.h" 8 #include "chrome/browser/extensions/extension_apitest.h"
9 #include "chrome/browser/extensions/extension_host.h" 9 #include "chrome/browser/extensions/extension_host.h"
10 #include "chrome/browser/extensions/extension_process_manager.h" 10 #include "chrome/browser/extensions/extension_process_manager.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 SCOPED_TRACE( 66 SCOPED_TRACE(
67 StringPrintf("WaitForTabsAndPopups tabs:%d, popups:%d, panels:%d", 67 StringPrintf("WaitForTabsAndPopups tabs:%d, popups:%d, panels:%d",
68 num_tabs, num_popups, num_panels)); 68 num_tabs, num_popups, num_panels));
69 // We start with one tab and one browser already open. 69 // We start with one tab and one browser already open.
70 ++num_tabs; 70 ++num_tabs;
71 size_t num_browsers = static_cast<size_t>(num_popups) + 1; 71 size_t num_browsers = static_cast<size_t>(num_popups) + 1;
72 72
73 const base::TimeDelta kWaitTime = base::TimeDelta::FromSeconds(10); 73 const base::TimeDelta kWaitTime = base::TimeDelta::FromSeconds(10);
74 base::TimeTicks end_time = base::TimeTicks::Now() + kWaitTime; 74 base::TimeTicks end_time = base::TimeTicks::Now() + kWaitTime;
75 while (base::TimeTicks::Now() < end_time) { 75 while (base::TimeTicks::Now() < end_time) {
76 if (chrome::GetBrowserCount(browser->profile()) == num_browsers && 76 if (chrome::GetBrowserCount(browser->profile(),
77 browser->host_desktop_type()) == num_browsers &&
77 browser->tab_strip_model()->count() == num_tabs && 78 browser->tab_strip_model()->count() == num_tabs &&
78 GetPanelCount(browser) == num_panels) 79 GetPanelCount(browser) == num_panels)
79 break; 80 break;
80 81
81 content::RunAllPendingInMessageLoop(); 82 content::RunAllPendingInMessageLoop();
82 } 83 }
83 84
84 EXPECT_EQ(num_browsers, chrome::GetBrowserCount(browser->profile())); 85 EXPECT_EQ(num_browsers,
86 chrome::GetBrowserCount(browser->profile(),
87 browser->host_desktop_type()));
85 EXPECT_EQ(num_tabs, browser->tab_strip_model()->count()); 88 EXPECT_EQ(num_tabs, browser->tab_strip_model()->count());
86 EXPECT_EQ(num_panels, GetPanelCount(browser)); 89 EXPECT_EQ(num_panels, GetPanelCount(browser));
87 90
88 int num_popups_seen = 0; 91 int num_popups_seen = 0;
89 for (chrome::BrowserIterator iter; !iter.done(); iter.Next()) { 92 for (chrome::BrowserIterator iter; !iter.done(); iter.Next()) {
90 if (*iter == browser) 93 if (*iter == browser)
91 continue; 94 continue;
92 95
93 // Check for TYPE_POPUP. 96 // Check for TYPE_POPUP.
94 #if defined(USE_ASH_PANELS) 97 #if defined(USE_ASH_PANELS)
95 // On Ash, panel windows may open as popup windows. 98 // On Ash, panel windows may open as popup windows.
96 EXPECT_TRUE((*iter)->is_type_popup() || (*iter)->is_type_panel()); 99 EXPECT_TRUE((*iter)->is_type_popup() || (*iter)->is_type_panel());
97 #else 100 #else
98 EXPECT_TRUE((*iter)->is_type_popup()); 101 EXPECT_TRUE((*iter)->is_type_popup());
99 #endif 102 #endif
100 ++num_popups_seen; 103 ++num_popups_seen;
101 } 104 }
102 EXPECT_EQ(num_popups, num_popups_seen); 105 EXPECT_EQ(num_popups, num_popups_seen);
103 106
104 return ((num_browsers == chrome::GetBrowserCount(browser->profile())) && 107 return ((num_browsers ==
108 chrome::GetBrowserCount(browser->profile(),
109 browser->host_desktop_type())) &&
105 (num_tabs == browser->tab_strip_model()->count()) && 110 (num_tabs == browser->tab_strip_model()->count()) &&
106 (num_panels == GetPanelCount(browser)) && 111 (num_panels == GetPanelCount(browser)) &&
107 (num_popups == num_popups_seen)); 112 (num_popups == num_popups_seen));
108 } 113 }
109 114
110 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, BrowserIsApp) { 115 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, BrowserIsApp) {
111 host_resolver()->AddRule("a.com", "127.0.0.1"); 116 host_resolver()->AddRule("a.com", "127.0.0.1");
112 ASSERT_TRUE(StartTestServer()); 117 ASSERT_TRUE(StartTestServer());
113 ASSERT_TRUE(LoadExtension( 118 ASSERT_TRUE(LoadExtension(
114 test_data_dir_.AppendASCII("window_open").AppendASCII("browser_is_app"))); 119 test_data_dir_.AppendASCII("window_open").AppendASCII("browser_is_app")));
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 OpenWindow(browser()->tab_strip_model()->GetActiveWebContents(), 453 OpenWindow(browser()->tab_strip_model()->GetActiveWebContents(),
449 GURL(std::string("chrome-extension://") + last_loaded_extension_id_ + 454 GURL(std::string("chrome-extension://") + last_loaded_extension_id_ +
450 "/newtab.html"), false, &newtab)); 455 "/newtab.html"), false, &newtab));
451 456
452 // Extension API should succeed. 457 // Extension API should succeed.
453 bool result = false; 458 bool result = false;
454 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(newtab, "testExtensionApi()", 459 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(newtab, "testExtensionApi()",
455 &result)); 460 &result));
456 EXPECT_TRUE(result); 461 EXPECT_TRUE(result);
457 } 462 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/app_process_apitest.cc ('k') | chrome/browser/popup_blocker_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698