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 "chrome/browser/ui/tab_contents/tab_contents_iterator.h" | 5 #include "chrome/browser/ui/tab_contents/tab_contents_iterator.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 | 37 |
38 } // namespace | 38 } // namespace |
39 | 39 |
40 TEST_F(BrowserListTest, TabContentsIteratorVerifyCount) { | 40 TEST_F(BrowserListTest, TabContentsIteratorVerifyCount) { |
41 // Make sure we have 1 window to start with. | 41 // Make sure we have 1 window to start with. |
42 EXPECT_EQ(1U, BrowserList::GetInstance()->size()); | 42 EXPECT_EQ(1U, BrowserList::GetInstance()->size()); |
43 | 43 |
44 EXPECT_EQ(0U, CountAllTabs()); | 44 EXPECT_EQ(0U, CountAllTabs()); |
45 | 45 |
46 // Create more browsers/windows. | 46 // Create more browsers/windows. |
47 Browser::CreateParams native_params(profile(), | 47 Browser::CreateParams native_params(profile()); |
48 chrome::HOST_DESKTOP_TYPE_NATIVE); | |
49 scoped_ptr<Browser> browser2( | 48 scoped_ptr<Browser> browser2( |
50 chrome::CreateBrowserWithTestWindowForParams(&native_params)); | 49 chrome::CreateBrowserWithTestWindowForParams(&native_params)); |
51 // Create browser 3 and 4 on the Ash desktop (the TabContentsIterator | 50 // Create browser 3 and 4 on the Ash desktop (the TabContentsIterator |
52 // shouldn't see the difference). | 51 // shouldn't see the difference). |
53 Browser::CreateParams ash_params(profile(), chrome::HOST_DESKTOP_TYPE_ASH); | 52 Browser::CreateParams ash_params(profile()); |
54 scoped_ptr<Browser> browser3( | 53 scoped_ptr<Browser> browser3( |
55 chrome::CreateBrowserWithTestWindowForParams(&ash_params)); | 54 chrome::CreateBrowserWithTestWindowForParams(&ash_params)); |
56 scoped_ptr<Browser> browser4( | 55 scoped_ptr<Browser> browser4( |
57 chrome::CreateBrowserWithTestWindowForParams(&ash_params)); | 56 chrome::CreateBrowserWithTestWindowForParams(&ash_params)); |
58 | 57 |
59 // Sanity checks. | 58 // Sanity checks. |
60 EXPECT_EQ(4U, BrowserList::GetInstance()->size()); | 59 EXPECT_EQ(4U, BrowserList::GetInstance()->size()); |
61 EXPECT_EQ(0, browser()->tab_strip_model()->count()); | 60 EXPECT_EQ(0, browser()->tab_strip_model()->count()); |
62 EXPECT_EQ(0, browser2->tab_strip_model()->count()); | 61 EXPECT_EQ(0, browser2->tab_strip_model()->count()); |
63 EXPECT_EQ(0, browser3->tab_strip_model()->count()); | 62 EXPECT_EQ(0, browser3->tab_strip_model()->count()); |
(...skipping 20 matching lines...) Expand all Loading... |
84 EXPECT_EQ(42U, CountAllTabs()); | 83 EXPECT_EQ(42U, CountAllTabs()); |
85 // Close all remaining tabs to keep all the destructors happy. | 84 // Close all remaining tabs to keep all the destructors happy. |
86 browser3->tab_strip_model()->CloseAllTabs(); | 85 browser3->tab_strip_model()->CloseAllTabs(); |
87 } | 86 } |
88 | 87 |
89 TEST_F(BrowserListTest, TabContentsIteratorVerifyBrowser) { | 88 TEST_F(BrowserListTest, TabContentsIteratorVerifyBrowser) { |
90 // Make sure we have 1 window to start with. | 89 // Make sure we have 1 window to start with. |
91 EXPECT_EQ(1U, BrowserList::GetInstance()->size()); | 90 EXPECT_EQ(1U, BrowserList::GetInstance()->size()); |
92 | 91 |
93 // Create more browsers/windows. | 92 // Create more browsers/windows. |
94 Browser::CreateParams native_params(profile(), | 93 Browser::CreateParams native_params(profile()); |
95 chrome::HOST_DESKTOP_TYPE_NATIVE); | |
96 scoped_ptr<Browser> browser2( | 94 scoped_ptr<Browser> browser2( |
97 chrome::CreateBrowserWithTestWindowForParams(&native_params)); | 95 chrome::CreateBrowserWithTestWindowForParams(&native_params)); |
98 // Create browser 3 on the Ash desktop (the TabContentsIterator shouldn't see | 96 // Create browser 3 on the Ash desktop (the TabContentsIterator shouldn't see |
99 // the difference). | 97 // the difference). |
100 Browser::CreateParams ash_params(profile(), chrome::HOST_DESKTOP_TYPE_ASH); | 98 Browser::CreateParams ash_params(profile()); |
101 scoped_ptr<Browser> browser3( | 99 scoped_ptr<Browser> browser3( |
102 chrome::CreateBrowserWithTestWindowForParams(&ash_params)); | 100 chrome::CreateBrowserWithTestWindowForParams(&ash_params)); |
103 | 101 |
104 // Sanity checks. | 102 // Sanity checks. |
105 EXPECT_EQ(3U, BrowserList::GetInstance()->size()); | 103 EXPECT_EQ(3U, BrowserList::GetInstance()->size()); |
106 EXPECT_EQ(0, browser()->tab_strip_model()->count()); | 104 EXPECT_EQ(0, browser()->tab_strip_model()->count()); |
107 EXPECT_EQ(0, browser2->tab_strip_model()->count()); | 105 EXPECT_EQ(0, browser2->tab_strip_model()->count()); |
108 EXPECT_EQ(0, browser3->tab_strip_model()->count()); | 106 EXPECT_EQ(0, browser3->tab_strip_model()->count()); |
109 | 107 |
110 EXPECT_EQ(0U, CountAllTabs()); | 108 EXPECT_EQ(0U, CountAllTabs()); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 testing_browser_process->SetProfileManager(profile_manager); | 185 testing_browser_process->SetProfileManager(profile_manager); |
188 | 186 |
189 chrome::AttemptRestart(); | 187 chrome::AttemptRestart(); |
190 // Cancel the effects of us calling chrome::AttemptRestart. Otherwise tests | 188 // Cancel the effects of us calling chrome::AttemptRestart. Otherwise tests |
191 // ran after this one will fail. | 189 // ran after this one will fail. |
192 browser_shutdown::SetTryingToQuit(false); | 190 browser_shutdown::SetTryingToQuit(false); |
193 | 191 |
194 EXPECT_TRUE(testing_pref_service.GetBoolean(prefs::kWasRestarted)); | 192 EXPECT_TRUE(testing_pref_service.GetBoolean(prefs::kWasRestarted)); |
195 testing_browser_process->SetLocalState(NULL); | 193 testing_browser_process->SetLocalState(NULL); |
196 } | 194 } |
OLD | NEW |