OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| 11 #include "chrome/browser/operation_output.h" |
11 #include "chrome/browser/prefs/session_startup_pref.h" | 12 #include "chrome/browser/prefs/session_startup_pref.h" |
12 #include "chrome/browser/profiles/profile_manager.h" | 13 #include "chrome/browser/profiles/profile_manager.h" |
13 #include "chrome/browser/sessions/session_restore.h" | 14 #include "chrome/browser/sessions/session_restore.h" |
14 #include "chrome/browser/ui/browser.h" | 15 #include "chrome/browser/ui/browser.h" |
15 #include "chrome/browser/ui/browser_finder.h" | 16 #include "chrome/browser/ui/browser_finder.h" |
16 #include "chrome/browser/ui/browser_window.h" | 17 #include "chrome/browser/ui/browser_window.h" |
17 #include "chrome/browser/ui/startup/startup_browser_creator.h" | 18 #include "chrome/browser/ui/startup/startup_browser_creator.h" |
18 #include "chrome/test/base/in_process_browser_test.h" | 19 #include "chrome/test/base/in_process_browser_test.h" |
19 #include "chrome/test/base/ui_test_utils.h" | 20 #include "chrome/test/base/ui_test_utils.h" |
20 #include "googleurl/src/gurl.h" | 21 #include "googleurl/src/gurl.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 base::FilePath(base::FilePath::kCurrentDirectory), | 54 base::FilePath(base::FilePath::kCurrentDirectory), |
54 base::FilePath(FILE_PATH_LITERAL("title1.html")))); | 55 base::FilePath(FILE_PATH_LITERAL("title1.html")))); |
55 SessionStartupPref::SetStartupPref(profile_1, pref_urls); | 56 SessionStartupPref::SetStartupPref(profile_1, pref_urls); |
56 SessionStartupPref::SetStartupPref(profile_2, pref_urls); | 57 SessionStartupPref::SetStartupPref(profile_2, pref_urls); |
57 SessionStartupPref::SetStartupPref(profile_3, pref_urls); | 58 SessionStartupPref::SetStartupPref(profile_3, pref_urls); |
58 SessionStartupPref::SetStartupPref(profile_4, pref_urls); | 59 SessionStartupPref::SetStartupPref(profile_4, pref_urls); |
59 | 60 |
60 // Do a simple non-process-startup browser launch. | 61 // Do a simple non-process-startup browser launch. |
61 CommandLine dummy(CommandLine::NO_PROGRAM); | 62 CommandLine dummy(CommandLine::NO_PROGRAM); |
62 | 63 |
63 int return_code; | |
64 StartupBrowserCreator browser_creator; | 64 StartupBrowserCreator browser_creator; |
65 std::vector<Profile*> last_opened_profiles; | 65 std::vector<Profile*> last_opened_profiles; |
66 last_opened_profiles.push_back(profile_1); | 66 last_opened_profiles.push_back(profile_1); |
67 last_opened_profiles.push_back(profile_2); | 67 last_opened_profiles.push_back(profile_2); |
68 last_opened_profiles.push_back(profile_3); | 68 last_opened_profiles.push_back(profile_3); |
69 last_opened_profiles.push_back(profile_4); | 69 last_opened_profiles.push_back(profile_4); |
70 browser_creator.Start(dummy, profile_manager->user_data_dir(), profile_2, | 70 browser_creator.Start(dummy, profile_manager->user_data_dir(), profile_2, |
71 last_opened_profiles, &return_code); | 71 last_opened_profiles, scoped_ptr<OperationOutput>()); |
72 | 72 |
73 while (!browser_creator.ActivatedProfile()) | 73 while (!browser_creator.ActivatedProfile()) |
74 MessageLoop::current()->RunUntilIdle(); | 74 MessageLoop::current()->RunUntilIdle(); |
75 | 75 |
76 Browser* new_browser = NULL; | 76 Browser* new_browser = NULL; |
77 | 77 |
78 // The last used profile (the profile_2 in this case) must be active. | 78 // The last used profile (the profile_2 in this case) must be active. |
79 ASSERT_EQ(1u, chrome::GetBrowserCount(profile_2, | 79 ASSERT_EQ(1u, chrome::GetBrowserCount(profile_2, |
80 browser()->host_desktop_type())); | 80 browser()->host_desktop_type())); |
81 new_browser = FindBrowserWithProfile(profile_2, | 81 new_browser = FindBrowserWithProfile(profile_2, |
(...skipping 18 matching lines...) Expand all Loading... |
100 | 100 |
101 ASSERT_EQ(1u, chrome::GetBrowserCount(profile_4, | 101 ASSERT_EQ(1u, chrome::GetBrowserCount(profile_4, |
102 browser()->host_desktop_type())); | 102 browser()->host_desktop_type())); |
103 new_browser = FindBrowserWithProfile(profile_4, | 103 new_browser = FindBrowserWithProfile(profile_4, |
104 browser()->host_desktop_type()); | 104 browser()->host_desktop_type()); |
105 ASSERT_TRUE(new_browser); | 105 ASSERT_TRUE(new_browser); |
106 EXPECT_FALSE(new_browser->window()->IsActive()); | 106 EXPECT_FALSE(new_browser->window()->IsActive()); |
107 | 107 |
108 } | 108 } |
109 #endif // !OS_MACOSX && !OS_CHROMEOS | 109 #endif // !OS_MACOSX && !OS_CHROMEOS |
OLD | NEW |