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

Side by Side Diff: chrome/browser/extensions/window_open_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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/memory/scoped_vector.h" 8 #include "base/memory/scoped_vector.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 SCOPED_TRACE( 76 SCOPED_TRACE(
77 base::StringPrintf("WaitForTabsAndPopups tabs:%d, popups:%d, panels:%d", 77 base::StringPrintf("WaitForTabsAndPopups tabs:%d, popups:%d, panels:%d",
78 num_tabs, num_popups, num_panels)); 78 num_tabs, num_popups, num_panels));
79 // We start with one tab and one browser already open. 79 // We start with one tab and one browser already open.
80 ++num_tabs; 80 ++num_tabs;
81 size_t num_browsers = static_cast<size_t>(num_popups) + 1; 81 size_t num_browsers = static_cast<size_t>(num_popups) + 1;
82 82
83 const base::TimeDelta kWaitTime = base::TimeDelta::FromSeconds(10); 83 const base::TimeDelta kWaitTime = base::TimeDelta::FromSeconds(10);
84 base::TimeTicks end_time = base::TimeTicks::Now() + kWaitTime; 84 base::TimeTicks end_time = base::TimeTicks::Now() + kWaitTime;
85 while (base::TimeTicks::Now() < end_time) { 85 while (base::TimeTicks::Now() < end_time) {
86 if (chrome::GetBrowserCount(browser->profile(), 86 if (chrome::GetBrowserCount(browser->profile()) == num_browsers &&
87 browser->host_desktop_type()) == num_browsers &&
88 browser->tab_strip_model()->count() == num_tabs && 87 browser->tab_strip_model()->count() == num_tabs &&
89 GetPanelCount(browser) == num_panels) 88 GetPanelCount(browser) == num_panels)
90 break; 89 break;
91 90
92 content::RunAllPendingInMessageLoop(); 91 content::RunAllPendingInMessageLoop();
93 } 92 }
94 93
95 EXPECT_EQ(num_browsers, 94 EXPECT_EQ(num_browsers, chrome::GetBrowserCount(browser->profile()));
96 chrome::GetBrowserCount(browser->profile(),
97 browser->host_desktop_type()));
98 EXPECT_EQ(num_tabs, browser->tab_strip_model()->count()); 95 EXPECT_EQ(num_tabs, browser->tab_strip_model()->count());
99 EXPECT_EQ(num_panels, GetPanelCount(browser)); 96 EXPECT_EQ(num_panels, GetPanelCount(browser));
100 97
101 int num_popups_seen = 0; 98 int num_popups_seen = 0;
102 for (auto* b : *BrowserList::GetInstance()) { 99 for (auto* b : *BrowserList::GetInstance()) {
103 if (b == browser) 100 if (b == browser)
104 continue; 101 continue;
105 102
106 EXPECT_TRUE(b->is_type_popup()); 103 EXPECT_TRUE(b->is_type_popup());
107 ++num_popups_seen; 104 ++num_popups_seen;
108 } 105 }
109 EXPECT_EQ(num_popups, num_popups_seen); 106 EXPECT_EQ(num_popups, num_popups_seen);
110 107
111 return ((num_browsers == 108 return ((num_browsers == chrome::GetBrowserCount(browser->profile())) &&
112 chrome::GetBrowserCount(browser->profile(),
113 browser->host_desktop_type())) &&
114 (num_tabs == browser->tab_strip_model()->count()) && 109 (num_tabs == browser->tab_strip_model()->count()) &&
115 (num_panels == GetPanelCount(browser)) && 110 (num_panels == GetPanelCount(browser)) &&
116 (num_popups == num_popups_seen)); 111 (num_popups == num_popups_seen));
117 } 112 }
118 113
119 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, BrowserIsApp) { 114 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, BrowserIsApp) {
120 host_resolver()->AddRule("a.com", "127.0.0.1"); 115 host_resolver()->AddRule("a.com", "127.0.0.1");
121 ASSERT_TRUE(StartEmbeddedTestServer()); 116 ASSERT_TRUE(StartEmbeddedTestServer());
122 ASSERT_TRUE(LoadExtension( 117 ASSERT_TRUE(LoadExtension(
123 test_data_dir_.AppendASCII("window_open").AppendASCII("browser_is_app"))); 118 test_data_dir_.AppendASCII("window_open").AppendASCII("browser_is_app")));
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 last_loaded_extension_id() + "/newtab.html"), 529 last_loaded_extension_id() + "/newtab.html"),
535 false, 530 false,
536 &newtab)); 531 &newtab));
537 532
538 // Extension API should succeed. 533 // Extension API should succeed.
539 bool result = false; 534 bool result = false;
540 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(newtab, "testExtensionApi()", 535 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(newtab, "testExtensionApi()",
541 &result)); 536 &result));
542 EXPECT_TRUE(result); 537 EXPECT_TRUE(result);
543 } 538 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/theme_installed_infobar_delegate.cc ('k') | chrome/browser/platform_util_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698