File: browser_process_platform_part_chromeos_browsertest.cc

package info (click to toggle)
chromium 120.0.6099.224-1~deb11u1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 6,112,112 kB
  • sloc: cpp: 32,907,025; ansic: 8,148,123; javascript: 3,679,536; python: 2,031,248; asm: 959,718; java: 804,675; xml: 617,256; sh: 111,417; objc: 100,835; perl: 88,443; cs: 53,032; makefile: 29,579; fortran: 24,137; php: 21,162; tcl: 21,147; sql: 20,809; ruby: 17,735; pascal: 12,864; yacc: 8,045; lisp: 3,388; lex: 1,323; ada: 727; awk: 329; jsp: 267; csh: 117; exp: 43; sed: 37
file content (430 lines) | stat: -rw-r--r-- 19,728 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "base/containers/contains.h"
#include "base/run_loop.h"
#include "base/test/bind.h"
#include "base/test/scoped_feature_list.h"
#include "build/build_config.h"
#include "build/buildflag.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/chromeos/app_mode/kiosk_browser_session.h"
#include "chrome/browser/prefs/incognito_mode_prefs.h"
#include "chrome/browser/prefs/session_startup_pref.h"
#include "chrome/browser/profiles/keep_alive/profile_keep_alive_types.h"
#include "chrome/browser/profiles/keep_alive/scoped_profile_keep_alive.h"
#include "chrome/browser/profiles/profile_attributes_storage.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/profiles/profile_test_util.h"
#include "chrome/browser/sessions/exit_type_service.h"
#include "chrome/browser/sessions/session_restore.h"
#include "chrome/browser/sessions/session_restore_test_utils.h"
#include "chrome/browser/signin/identity_manager_factory.h"
#include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/profiles/profile_picker.h"
#include "chrome/browser/ui/profiles/profile_ui_test_utils.h"
#include "chrome/browser/ui/startup/startup_browser_creator.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/webui_url_constants.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/testing_browser_process.h"
#include "chrome/test/base/ui_test_utils.h"
#include "chromeos/startup/browser_init_params.h"
#include "components/keep_alive_registry/keep_alive_types.h"
#include "components/keep_alive_registry/scoped_keep_alive.h"
#include "components/signin/public/base/signin_switches.h"
#include "content/public/test/browser_test.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/aura/window.h"
#include "url/url_constants.h"

namespace {

Browser* FindOneOtherBrowserForProfile(Profile* profile,
                                       Browser* not_this_browser) {
  for (auto* browser : *BrowserList::GetInstance()) {
    if (browser != not_this_browser && browser->profile() == profile)
      return browser;
  }
  return nullptr;
}

void WaitForLoadStopForBrowser(Browser* browser) {
  TabStripModel* tab_strip_model = browser->tab_strip_model();
  for (int i = 0; i < tab_strip_model->count(); ++i) {
    content::WebContents* contents = tab_strip_model->GetWebContentsAt(i);
    EXPECT_TRUE(content::WaitForLoadStop(contents));
  }
}

}  // namespace

using BrowserProcessPlatformPartChromeOSBrowsertest = InProcessBrowserTest;

// We should not apply startup URLs if Chrome has previously exited from a
// crash.
IN_PROC_BROWSER_TEST_F(BrowserProcessPlatformPartChromeOSBrowsertest,
                       UrlsNotRestoredAfterCrash) {
  ASSERT_TRUE(embedded_test_server()->Start());

  // Keep the browser process running while browsers are closed.
  auto* profile = browser()->profile();
  ScopedKeepAlive keep_alive(KeepAliveOrigin::BROWSER,
                             KeepAliveRestartOption::DISABLED);
  ScopedProfileKeepAlive profile_keep_alive(
      profile, ProfileKeepAliveOrigin::kBrowserWindow);
  ASSERT_EQ(1u, chrome::GetBrowserCount(profile));
  CloseBrowserSynchronously(browser());
  ASSERT_EQ(0u, chrome::GetBrowserCount(profile));

  // Set the exit type to crashed.
  g_browser_process->local_state()->SetInteger(
      prefs::kBrowserProfilePickerAvailabilityOnStartup,
      static_cast<int>(ProfilePicker::AvailabilityOnStartup::kDisabled));
  ExitTypeService::GetInstanceForProfile(profile)
      ->SetLastSessionExitTypeForTest(ExitType::kCrashed);
  StartupBrowserCreator::ClearLaunchedProfilesForTesting();

  // Set the startup URLs pref.
  const GURL restore_url_1 = embedded_test_server()->GetURL("/title1.html");
  const GURL restore_url_2 = embedded_test_server()->GetURL("/title2.html");
  const GURL restore_url_3 = embedded_test_server()->GetURL("/title3.html");
  SessionStartupPref startup_pref(SessionStartupPref::URLS);
  std::vector<GURL> urls_to_open;
  urls_to_open.push_back(restore_url_1);
  urls_to_open.push_back(restore_url_2);
  urls_to_open.push_back(restore_url_3);
  startup_pref.urls = urls_to_open;
  SessionStartupPref::SetStartupPref(profile, startup_pref);

  // Open a new window.
  chrome::NewEmptyWindow(profile, /*should_trigger_session_restore=*/true);

  // Startup URLs should not have been applied to the browser window.
  ASSERT_EQ(1u, chrome::GetBrowserCount(profile));
  auto* new_browser = chrome::FindLastActiveWithProfile(profile);
  EXPECT_NO_FATAL_FAILURE(WaitForLoadStopForBrowser(new_browser));
  auto* tab_strip_model = new_browser->tab_strip_model();
  EXPECT_EQ(1, tab_strip_model->GetTabCount());
  EXPECT_EQ(GURL(url::kAboutBlankURL),
            tab_strip_model->GetWebContentsAt(0)->GetVisibleURL());
}

// If startup pref is set to URLS, the first browser window opened should open
// a single window with these startup URLs in its tabstrip.
IN_PROC_BROWSER_TEST_F(BrowserProcessPlatformPartChromeOSBrowsertest,
                       StartupPrefSetURLs) {
  ASSERT_TRUE(embedded_test_server()->Start());
  const GURL original_url = embedded_test_server()->GetURL("/simple.html");

  // Open `original_url` in a tab.
  TabStripModel* tab_strip_model = browser()->tab_strip_model();
  ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), original_url));
  ASSERT_EQ(1, tab_strip_model->count());
  EXPECT_EQ(original_url,
            tab_strip_model->GetWebContentsAt(0)->GetLastCommittedURL());

  // Keep the browser process running while browsers are closed.
  auto* profile = browser()->profile();
  ScopedKeepAlive keep_alive(KeepAliveOrigin::BROWSER,
                             KeepAliveRestartOption::DISABLED);
  ScopedProfileKeepAlive profile_keep_alive(
      profile, ProfileKeepAliveOrigin::kBrowserWindow);
  ASSERT_EQ(1u, chrome::GetBrowserCount(profile));
  CloseBrowserSynchronously(browser());

  // Set the startup URLS pref.
  const GURL restore_url_1 = embedded_test_server()->GetURL("/title1.html");
  const GURL restore_url_2 = embedded_test_server()->GetURL("/title2.html");
  const GURL restore_url_3 = embedded_test_server()->GetURL("/title3.html");
  SessionStartupPref startup_pref(SessionStartupPref::URLS);
  std::vector<GURL> urls_to_open;
  urls_to_open.push_back(restore_url_1);
  urls_to_open.push_back(restore_url_2);
  urls_to_open.push_back(restore_url_3);
  startup_pref.urls = urls_to_open;
  SessionStartupPref::SetStartupPref(profile, startup_pref);

  // Request a new browser window.
  chrome::NewEmptyWindow(profile);

  ASSERT_EQ(1u, chrome::GetBrowserCount(profile));

  auto* pref_urls_opened_browser = chrome::FindLastActiveWithProfile(profile);
  ASSERT_TRUE(pref_urls_opened_browser);

  // Check pref_urls_opened_browser.
  EXPECT_NO_FATAL_FAILURE(WaitForLoadStopForBrowser(pref_urls_opened_browser));
  tab_strip_model = pref_urls_opened_browser->tab_strip_model();
  EXPECT_EQ(3, tab_strip_model->GetTabCount());
  EXPECT_EQ(restore_url_1,
            tab_strip_model->GetWebContentsAt(0)->GetVisibleURL());
  EXPECT_EQ(restore_url_2,
            tab_strip_model->GetWebContentsAt(1)->GetVisibleURL());
  EXPECT_EQ(restore_url_3,
            tab_strip_model->GetWebContentsAt(2)->GetVisibleURL());

  // If there are existing open browsers opening a new browser should not
  // trigger a restore or open another window with startup URLs.
  chrome::NewEmptyWindow(profile, /*should_trigger_session_restore=*/true);
  ASSERT_EQ(2u, chrome::GetBrowserCount(profile));
  auto* new_browser = chrome::FindLastActiveWithProfile(profile);
  EXPECT_NO_FATAL_FAILURE(WaitForLoadStopForBrowser(new_browser));
  tab_strip_model = new_browser->tab_strip_model();
  EXPECT_EQ(1, tab_strip_model->GetTabCount());
  EXPECT_EQ(GURL(chrome::kChromeUINewTabURL),
            tab_strip_model->GetWebContentsAt(0)->GetVisibleURL());
}

// If startup pref is set as LAST_AND_URLS, startup urls should be opened in a
// new browser window separated from the last session restored browser.
IN_PROC_BROWSER_TEST_F(BrowserProcessPlatformPartChromeOSBrowsertest,
                       StartupPrefSetAsLastAndURLs) {
  ASSERT_TRUE(embedded_test_server()->Start());
  const GURL original_url = embedded_test_server()->GetURL("/simple.html");

  // Open `original_url` in a tab.
  TabStripModel* tab_strip_model = browser()->tab_strip_model();
  ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), original_url));
  ASSERT_EQ(1, tab_strip_model->count());
  EXPECT_EQ(original_url,
            tab_strip_model->GetWebContentsAt(0)->GetLastCommittedURL());

  // Keep the browser process running while browsers are closed.
  auto* profile = browser()->profile();
  ScopedKeepAlive keep_alive(KeepAliveOrigin::BROWSER,
                             KeepAliveRestartOption::DISABLED);
  ScopedProfileKeepAlive profile_keep_alive(
      profile, ProfileKeepAliveOrigin::kBrowserWindow);
  ASSERT_EQ(1u, chrome::GetBrowserCount(profile));
  CloseBrowserSynchronously(browser());

  // Set the startup LAST_AND_URLS pref.
  const GURL restore_url_1 = embedded_test_server()->GetURL("/title1.html");
  const GURL restore_url_2 = embedded_test_server()->GetURL("/title2.html");
  const GURL restore_url_3 = embedded_test_server()->GetURL("/title3.html");
  SessionStartupPref startup_pref(SessionStartupPref::LAST_AND_URLS);
  std::vector<GURL> urls_to_open;
  urls_to_open.push_back(restore_url_1);
  urls_to_open.push_back(restore_url_2);
  urls_to_open.push_back(restore_url_3);
  startup_pref.urls = urls_to_open;
  SessionStartupPref::SetStartupPref(profile, startup_pref);

  // Request a new browser window.
  chrome::NewEmptyWindow(profile);

  // This startup pref should restore a single window.
  base::RunLoop run_loop;
  testing::SessionsRestoredWaiter restore_waiter(run_loop.QuitClosure(), 1);
  run_loop.Run();

  ASSERT_EQ(2u, chrome::GetBrowserCount(profile));

  auto* pref_urls_opened_browser = chrome::FindLastActiveWithProfile(profile);
  ASSERT_TRUE(pref_urls_opened_browser);
  auto* last_session_opened_browser =
      FindOneOtherBrowserForProfile(profile, pref_urls_opened_browser);
  ASSERT_TRUE(last_session_opened_browser);

  // Check the last_session_opened_browser.
  EXPECT_NO_FATAL_FAILURE(
      WaitForLoadStopForBrowser(last_session_opened_browser));
  tab_strip_model = last_session_opened_browser->tab_strip_model();
  ASSERT_EQ(1, tab_strip_model->count());
  EXPECT_EQ(original_url,
            tab_strip_model->GetWebContentsAt(0)->GetVisibleURL());

  // Check the pref_urls_opened_browser.
  EXPECT_NO_FATAL_FAILURE(WaitForLoadStopForBrowser(pref_urls_opened_browser));
  tab_strip_model = pref_urls_opened_browser->tab_strip_model();
  EXPECT_EQ(3, tab_strip_model->GetTabCount());
  EXPECT_EQ(restore_url_1,
            tab_strip_model->GetWebContentsAt(0)->GetVisibleURL());
  EXPECT_EQ(restore_url_2,
            tab_strip_model->GetWebContentsAt(1)->GetVisibleURL());
  EXPECT_EQ(restore_url_3,
            tab_strip_model->GetWebContentsAt(2)->GetVisibleURL());

  // If there are existing open browsers opening a new browser should not
  // trigger a restore or open another window with last URLs.
  chrome::NewEmptyWindow(profile, /*should_trigger_session_restore=*/true);
  ASSERT_EQ(3u, chrome::GetBrowserCount(profile));
  auto* new_browser = chrome::FindLastActiveWithProfile(profile);
  EXPECT_NO_FATAL_FAILURE(WaitForLoadStopForBrowser(new_browser));
  tab_strip_model = new_browser->tab_strip_model();
  EXPECT_EQ(1, tab_strip_model->GetTabCount());
  EXPECT_EQ(GURL(chrome::kChromeUINewTabURL),
            tab_strip_model->GetWebContentsAt(0)->GetVisibleURL());
}

#if BUILDFLAG(IS_CHROMEOS_LACROS)
// Test that multiple profiles with different URLS and LAST_AND_URLS startup
// prefs work as intended.
IN_PROC_BROWSER_TEST_F(BrowserProcessPlatformPartChromeOSBrowsertest,
                       StartupPrefSetAsLastAndURLsMultiProfile) {
  ASSERT_TRUE(embedded_test_server()->Start());
  // Disable "What's New" and the profile picker.
  PrefService* pref_service = g_browser_process->local_state();
  pref_service->SetInteger(prefs::kLastWhatsNewVersion, CHROME_VERSION_MAJOR);
  g_browser_process->local_state()->SetInteger(
      prefs::kBrowserProfilePickerAvailabilityOnStartup,
      static_cast<int>(ProfilePicker::AvailabilityOnStartup::kDisabled));

  // Initial browser will be navigated to original_url.
  const GURL original_url = embedded_test_server()->GetURL("/simple.html");

  // Open `original_url` in a tab for profile_urls's browser.
  auto* profile_urls = browser()->profile();
  profile_urls->GetPrefs()->SetBoolean(prefs::kHasSeenWelcomePage, true);
  TabStripModel* tab_strip_model = browser()->tab_strip_model();
  ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), original_url));
  ASSERT_EQ(1, tab_strip_model->count());
  EXPECT_EQ(original_url,
            tab_strip_model->GetWebContentsAt(0)->GetLastCommittedURL());

  // Create a second profile.
  ProfileManager* profile_manager = g_browser_process->profile_manager();
  base::FilePath dest_path =
      profile_manager->user_data_dir().Append(FILE_PATH_LITERAL("New Profile"));
  base::ScopedAllowBlockingForTesting allow_blocking;
  Profile* profile_last_and_urls = profile_manager->GetProfile(dest_path);
  ASSERT_TRUE(profile_last_and_urls);
  profile_last_and_urls->GetPrefs()->SetBoolean(prefs::kHasSeenWelcomePage,
                                                true);

  // Open `original_url` in a tab for profile_last_and_urls's browser.
  Browser* new_browser = Browser::Create(
      Browser::CreateParams(Browser::TYPE_NORMAL, profile_last_and_urls, true));
  chrome::NewTab(new_browser);
  ASSERT_TRUE(ui_test_utils::NavigateToURL(new_browser, original_url));
  tab_strip_model = new_browser->tab_strip_model();
  ASSERT_EQ(1, tab_strip_model->count());
  EXPECT_EQ(original_url,
            tab_strip_model->GetWebContentsAt(0)->GetLastCommittedURL());

  // Keep the browser process running while browsers for both profiles are
  // closed.
  ScopedKeepAlive keep_alive(KeepAliveOrigin::BROWSER,
                             KeepAliveRestartOption::DISABLED);
  ScopedProfileKeepAlive profile_keep_alive_urls(
      profile_urls, ProfileKeepAliveOrigin::kBrowserWindow);
  ScopedProfileKeepAlive profile_keep_alive_last_and_urls(
      profile_last_and_urls, ProfileKeepAliveOrigin::kBrowserWindow);
  ASSERT_EQ(1u, chrome::GetBrowserCount(profile_urls));
  CloseBrowserSynchronously(browser());
  ASSERT_EQ(1u, chrome::GetBrowserCount(profile_last_and_urls));
  CloseBrowserSynchronously(new_browser);
  ASSERT_TRUE(BrowserList::GetInstance()->empty());

  // Create the startup pref configuration.
  const GURL restore_url_1 = embedded_test_server()->GetURL("/title1.html");
  const GURL restore_url_2 = embedded_test_server()->GetURL("/title2.html");
  const GURL restore_url_3 = embedded_test_server()->GetURL("/title3.html");
  SessionStartupPref startup_pref(SessionStartupPref::URLS);
  std::vector<GURL> urls_to_open;
  urls_to_open.push_back(restore_url_1);
  urls_to_open.push_back(restore_url_2);
  urls_to_open.push_back(restore_url_3);
  startup_pref.urls = urls_to_open;

  // Set `profile_urls` to the URLS pref.
  SessionStartupPref::SetStartupPref(profile_urls, startup_pref);

  // Set `profile_last_and_urls` to the LAST_AND_URLS pref.
  startup_pref.type = SessionStartupPref::LAST_AND_URLS;
  SessionStartupPref::SetStartupPref(profile_last_and_urls, startup_pref);

  // Open a window for `profile_urls` and test to make sure URLs are set as
  // expected.
  {
    chrome::NewEmptyWindow(profile_urls);
    ASSERT_EQ(1u, chrome::GetBrowserCount(profile_urls));
    ASSERT_EQ(0u, chrome::GetBrowserCount(profile_last_and_urls));

    auto* pref_urls_opened_browser =
        chrome::FindLastActiveWithProfile(profile_urls);
    ASSERT_TRUE(pref_urls_opened_browser);

    EXPECT_NO_FATAL_FAILURE(
        WaitForLoadStopForBrowser(pref_urls_opened_browser));
    tab_strip_model = pref_urls_opened_browser->tab_strip_model();
    EXPECT_EQ(3, tab_strip_model->GetTabCount());
    EXPECT_EQ(restore_url_1,
              tab_strip_model->GetWebContentsAt(0)->GetVisibleURL());
    EXPECT_EQ(restore_url_2,
              tab_strip_model->GetWebContentsAt(1)->GetVisibleURL());
    EXPECT_EQ(restore_url_3,
              tab_strip_model->GetWebContentsAt(2)->GetVisibleURL());

    // If there are existing open browsers opening a new browser should not
    // trigger a restore or open another window with startup URLs.
    chrome::NewEmptyWindow(profile_urls);
    ASSERT_EQ(2u, chrome::GetBrowserCount(profile_urls));
    auto* last_active_browser = chrome::FindLastActiveWithProfile(profile_urls);
    EXPECT_NO_FATAL_FAILURE(WaitForLoadStopForBrowser(last_active_browser));
    tab_strip_model = last_active_browser->tab_strip_model();
    EXPECT_EQ(1, tab_strip_model->GetTabCount());
    EXPECT_EQ(GURL(chrome::kChromeUINewTabURL),
              tab_strip_model->GetWebContentsAt(0)->GetVisibleURL());
  }

  // Open a window for `profile_last_and_urls` and test to make sure the
  // previous window is restored and startup URLs are opened in a new window as
  // expected.
  {
    // Request a new browser window.
    chrome::NewEmptyWindow(profile_last_and_urls);

    // This startup pref should restore a single window.
    base::RunLoop run_loop;
    testing::SessionsRestoredWaiter restore_waiter(run_loop.QuitClosure(), 1);
    run_loop.Run();

    ASSERT_EQ(2u, chrome::GetBrowserCount(profile_urls));
    ASSERT_EQ(2u, chrome::GetBrowserCount(profile_last_and_urls));

    auto* pref_urls_opened_browser =
        chrome::FindLastActiveWithProfile(profile_last_and_urls);
    ASSERT_TRUE(pref_urls_opened_browser);
    auto* last_session_opened_browser = FindOneOtherBrowserForProfile(
        profile_last_and_urls, pref_urls_opened_browser);
    ASSERT_TRUE(last_session_opened_browser);

    EXPECT_NO_FATAL_FAILURE(
        WaitForLoadStopForBrowser(last_session_opened_browser));
    tab_strip_model = last_session_opened_browser->tab_strip_model();
    ASSERT_EQ(1, tab_strip_model->count());
    EXPECT_EQ(original_url,
              tab_strip_model->GetWebContentsAt(0)->GetVisibleURL());

    EXPECT_NO_FATAL_FAILURE(
        WaitForLoadStopForBrowser(pref_urls_opened_browser));
    tab_strip_model = pref_urls_opened_browser->tab_strip_model();
    EXPECT_EQ(3, tab_strip_model->GetTabCount());
    EXPECT_EQ(restore_url_1,
              tab_strip_model->GetWebContentsAt(0)->GetVisibleURL());
    EXPECT_EQ(restore_url_2,
              tab_strip_model->GetWebContentsAt(1)->GetVisibleURL());
    EXPECT_EQ(restore_url_3,
              tab_strip_model->GetWebContentsAt(2)->GetVisibleURL());

    // If there are existing open browsers opening a new browser should not
    // trigger a restore or open another window with last URLs.
    chrome::NewEmptyWindow(profile_last_and_urls);
    ASSERT_EQ(3u, chrome::GetBrowserCount(profile_last_and_urls));
    auto* last_active_browser =
        chrome::FindLastActiveWithProfile(profile_last_and_urls);
    EXPECT_NO_FATAL_FAILURE(WaitForLoadStopForBrowser(last_active_browser));
    tab_strip_model = last_active_browser->tab_strip_model();
    EXPECT_EQ(1, tab_strip_model->GetTabCount());
    EXPECT_EQ(GURL(chrome::kChromeUINewTabURL),
              tab_strip_model->GetWebContentsAt(0)->GetVisibleURL());
  }
}
#endif  // BUILDFLAG(IS_CHROMEOS_LACROS)