OLD | NEW |
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/file_path.h" | 6 #include "base/file_path.h" |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
9 #include "chrome/browser/extensions/extension_browsertest.h" | 9 #include "chrome/browser/extensions/extension_browsertest.h" |
10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 browser()->window()->Close(); | 162 browser()->window()->Close(); |
163 | 163 |
164 // Do a simple non-process-startup browser launch. | 164 // Do a simple non-process-startup browser launch. |
165 CommandLine dummy(CommandLine::NO_PROGRAM); | 165 CommandLine dummy(CommandLine::NO_PROGRAM); |
166 BrowserInit::IsFirstRun first_run = first_run::IsChromeFirstRun() ? | 166 BrowserInit::IsFirstRun first_run = first_run::IsChromeFirstRun() ? |
167 BrowserInit::IS_FIRST_RUN : BrowserInit::IS_NOT_FIRST_RUN; | 167 BrowserInit::IS_FIRST_RUN : BrowserInit::IS_NOT_FIRST_RUN; |
168 BrowserInit::LaunchWithProfile launch(FilePath(), dummy, first_run); | 168 BrowserInit::LaunchWithProfile launch(FilePath(), dummy, first_run); |
169 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false)); | 169 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false)); |
170 | 170 |
171 // This should have created a new browser window. |browser()| is still | 171 // This should have created a new browser window. |browser()| is still |
172 // around at this point, even though we've closed it's window. | 172 // around at this point, even though we've closed its window. |
173 Browser* new_browser = NULL; | 173 Browser* new_browser = NULL; |
174 ASSERT_NO_FATAL_FAILURE(FindOneOtherBrowser(&new_browser)); | 174 ASSERT_NO_FATAL_FAILURE(FindOneOtherBrowser(&new_browser)); |
175 | 175 |
176 // The new browser should have one tab for each URL. | 176 // The new browser should have one tab for each URL. |
177 ASSERT_EQ(static_cast<int>(urls.size()), new_browser->tab_count()); | 177 ASSERT_EQ(static_cast<int>(urls.size()), new_browser->tab_count()); |
178 for (size_t i=0; i < urls.size(); i++) { | 178 for (size_t i=0; i < urls.size(); i++) { |
179 EXPECT_EQ(urls[i], new_browser->GetWebContentsAt(i)->GetURL()); | 179 EXPECT_EQ(urls[i], new_browser->GetWebContentsAt(i)->GetURL()); |
180 } | 180 } |
181 } | 181 } |
182 | 182 |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 BrowserInit browser_init; | 393 BrowserInit browser_init; |
394 std::vector<Profile*> last_opened_profiles; | 394 std::vector<Profile*> last_opened_profiles; |
395 last_opened_profiles.push_back(default_profile); | 395 last_opened_profiles.push_back(default_profile); |
396 last_opened_profiles.push_back(other_profile); | 396 last_opened_profiles.push_back(other_profile); |
397 browser_init.Start(dummy, profile_manager->user_data_dir(), default_profile, | 397 browser_init.Start(dummy, profile_manager->user_data_dir(), default_profile, |
398 last_opened_profiles, &return_code); | 398 last_opened_profiles, &return_code); |
399 | 399 |
400 // urls1 were opened in a browser for default_profile, and urls2 were opened | 400 // urls1 were opened in a browser for default_profile, and urls2 were opened |
401 // in a browser for other_profile. | 401 // in a browser for other_profile. |
402 Browser* new_browser = NULL; | 402 Browser* new_browser = NULL; |
403 // |browser()| is still around at this point, even though we've closed it's | 403 // |browser()| is still around at this point, even though we've closed its |
404 // window. Thus the browser count for default_profile is 2. | 404 // window. Thus the browser count for default_profile is 2. |
405 ASSERT_EQ(2u, BrowserList::GetBrowserCount(default_profile)); | 405 ASSERT_EQ(2u, BrowserList::GetBrowserCount(default_profile)); |
406 new_browser = FindOneOtherBrowserForProfile(default_profile, browser()); | 406 new_browser = FindOneOtherBrowserForProfile(default_profile, browser()); |
407 ASSERT_TRUE(new_browser); | 407 ASSERT_TRUE(new_browser); |
408 ASSERT_EQ(1, new_browser->tab_count()); | 408 ASSERT_EQ(1, new_browser->tab_count()); |
409 EXPECT_EQ(urls1[0], new_browser->GetWebContentsAt(0)->GetURL()); | 409 EXPECT_EQ(urls1[0], new_browser->GetWebContentsAt(0)->GetURL()); |
410 | 410 |
411 ASSERT_EQ(1u, BrowserList::GetBrowserCount(other_profile)); | 411 ASSERT_EQ(1u, BrowserList::GetBrowserCount(other_profile)); |
412 new_browser = FindOneOtherBrowserForProfile(other_profile, NULL); | 412 new_browser = FindOneOtherBrowserForProfile(other_profile, NULL); |
413 ASSERT_TRUE(new_browser); | 413 ASSERT_TRUE(new_browser); |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
665 // The profile which normally opens URLs opens them (in addition to displaying | 665 // The profile which normally opens URLs opens them (in addition to displaying |
666 // the crash info bar). | 666 // the crash info bar). |
667 ASSERT_EQ(1u, BrowserList::GetBrowserCount(profile_urls)); | 667 ASSERT_EQ(1u, BrowserList::GetBrowserCount(profile_urls)); |
668 new_browser = FindOneOtherBrowserForProfile(profile_urls, NULL); | 668 new_browser = FindOneOtherBrowserForProfile(profile_urls, NULL); |
669 ASSERT_TRUE(new_browser); | 669 ASSERT_TRUE(new_browser); |
670 ASSERT_EQ(1, new_browser->tab_count()); | 670 ASSERT_EQ(1, new_browser->tab_count()); |
671 EXPECT_EQ(urls[0], new_browser->GetWebContentsAt(0)->GetURL()); | 671 EXPECT_EQ(urls[0], new_browser->GetWebContentsAt(0)->GetURL()); |
672 EXPECT_EQ(1U, new_browser->GetTabContentsWrapperAt(0)->infobar_tab_helper()-> | 672 EXPECT_EQ(1U, new_browser->GetTabContentsWrapperAt(0)->infobar_tab_helper()-> |
673 infobar_count()); | 673 infobar_count()); |
674 } | 674 } |
OLD | NEW |