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 30 matching lines...) Expand all Loading... |
41 | 41 |
42 } // namespace | 42 } // namespace |
43 | 43 |
44 TEST_F(BrowserListTest, TabContentsIteratorVerifyCount) { | 44 TEST_F(BrowserListTest, TabContentsIteratorVerifyCount) { |
45 // Make sure we have 1 window to start with. | 45 // Make sure we have 1 window to start with. |
46 EXPECT_EQ(1U, BrowserList::GetInstance()->size()); | 46 EXPECT_EQ(1U, BrowserList::GetInstance()->size()); |
47 | 47 |
48 EXPECT_EQ(0U, CountAllTabs()); | 48 EXPECT_EQ(0U, CountAllTabs()); |
49 | 49 |
50 // Create more browsers/windows. | 50 // Create more browsers/windows. |
51 Browser::CreateParams native_params(profile()); | 51 Browser::CreateParams native_params(profile(), true); |
52 std::unique_ptr<Browser> browser2( | 52 std::unique_ptr<Browser> browser2( |
53 chrome::CreateBrowserWithTestWindowForParams(&native_params)); | 53 chrome::CreateBrowserWithTestWindowForParams(&native_params)); |
54 // Create browser 3 and 4 on the Ash desktop (the TabContentsIterator | 54 // Create browser 3 and 4 on the Ash desktop (the TabContentsIterator |
55 // shouldn't see the difference). | 55 // shouldn't see the difference). |
56 Browser::CreateParams ash_params(profile()); | 56 Browser::CreateParams ash_params(profile(), true); |
57 std::unique_ptr<Browser> browser3( | 57 std::unique_ptr<Browser> browser3( |
58 chrome::CreateBrowserWithTestWindowForParams(&ash_params)); | 58 chrome::CreateBrowserWithTestWindowForParams(&ash_params)); |
59 std::unique_ptr<Browser> browser4( | 59 std::unique_ptr<Browser> browser4( |
60 chrome::CreateBrowserWithTestWindowForParams(&ash_params)); | 60 chrome::CreateBrowserWithTestWindowForParams(&ash_params)); |
61 | 61 |
62 // Sanity checks. | 62 // Sanity checks. |
63 EXPECT_EQ(4U, BrowserList::GetInstance()->size()); | 63 EXPECT_EQ(4U, BrowserList::GetInstance()->size()); |
64 EXPECT_EQ(0, browser()->tab_strip_model()->count()); | 64 EXPECT_EQ(0, browser()->tab_strip_model()->count()); |
65 EXPECT_EQ(0, browser2->tab_strip_model()->count()); | 65 EXPECT_EQ(0, browser2->tab_strip_model()->count()); |
66 EXPECT_EQ(0, browser3->tab_strip_model()->count()); | 66 EXPECT_EQ(0, browser3->tab_strip_model()->count()); |
(...skipping 20 matching lines...) Expand all Loading... |
87 EXPECT_EQ(42U, CountAllTabs()); | 87 EXPECT_EQ(42U, CountAllTabs()); |
88 // Close all remaining tabs to keep all the destructors happy. | 88 // Close all remaining tabs to keep all the destructors happy. |
89 browser3->tab_strip_model()->CloseAllTabs(); | 89 browser3->tab_strip_model()->CloseAllTabs(); |
90 } | 90 } |
91 | 91 |
92 TEST_F(BrowserListTest, TabContentsIteratorVerifyBrowser) { | 92 TEST_F(BrowserListTest, TabContentsIteratorVerifyBrowser) { |
93 // Make sure we have 1 window to start with. | 93 // Make sure we have 1 window to start with. |
94 EXPECT_EQ(1U, BrowserList::GetInstance()->size()); | 94 EXPECT_EQ(1U, BrowserList::GetInstance()->size()); |
95 | 95 |
96 // Create more browsers/windows. | 96 // Create more browsers/windows. |
97 Browser::CreateParams native_params(profile()); | 97 Browser::CreateParams native_params(profile(), true); |
98 std::unique_ptr<Browser> browser2( | 98 std::unique_ptr<Browser> browser2( |
99 chrome::CreateBrowserWithTestWindowForParams(&native_params)); | 99 chrome::CreateBrowserWithTestWindowForParams(&native_params)); |
100 // Create browser 3 on the Ash desktop (the TabContentsIterator shouldn't see | 100 // Create browser 3 on the Ash desktop (the TabContentsIterator shouldn't see |
101 // the difference). | 101 // the difference). |
102 Browser::CreateParams ash_params(profile()); | 102 Browser::CreateParams ash_params(profile(), true); |
103 std::unique_ptr<Browser> browser3( | 103 std::unique_ptr<Browser> browser3( |
104 chrome::CreateBrowserWithTestWindowForParams(&ash_params)); | 104 chrome::CreateBrowserWithTestWindowForParams(&ash_params)); |
105 | 105 |
106 // Sanity checks. | 106 // Sanity checks. |
107 EXPECT_EQ(3U, BrowserList::GetInstance()->size()); | 107 EXPECT_EQ(3U, BrowserList::GetInstance()->size()); |
108 EXPECT_EQ(0, browser()->tab_strip_model()->count()); | 108 EXPECT_EQ(0, browser()->tab_strip_model()->count()); |
109 EXPECT_EQ(0, browser2->tab_strip_model()->count()); | 109 EXPECT_EQ(0, browser2->tab_strip_model()->count()); |
110 EXPECT_EQ(0, browser3->tab_strip_model()->count()); | 110 EXPECT_EQ(0, browser3->tab_strip_model()->count()); |
111 | 111 |
112 EXPECT_EQ(0U, CountAllTabs()); | 112 EXPECT_EQ(0U, CountAllTabs()); |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 | 196 |
197 chrome::AttemptRestart(); | 197 chrome::AttemptRestart(); |
198 EXPECT_TRUE(testing_pref_service.GetBoolean(prefs::kWasRestarted)); | 198 EXPECT_TRUE(testing_pref_service.GetBoolean(prefs::kWasRestarted)); |
199 | 199 |
200 // Cancel the effects of us calling chrome::AttemptRestart. Otherwise tests | 200 // Cancel the effects of us calling chrome::AttemptRestart. Otherwise tests |
201 // ran after this one will fail. | 201 // ran after this one will fail. |
202 browser_shutdown::SetTryingToQuit(false); | 202 browser_shutdown::SetTryingToQuit(false); |
203 | 203 |
204 testing_browser_process->SetLocalState(NULL); | 204 testing_browser_process->SetLocalState(NULL); |
205 } | 205 } |
OLD | NEW |