OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/printing/background_printing_manager.h" | 5 #include "chrome/browser/printing/background_printing_manager.h" |
6 #include "chrome/browser/ui/browser_list.h" | 6 #include "chrome/browser/ui/browser_list.h" |
7 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 7 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
8 #include "chrome/common/url_constants.h" | 8 #include "chrome/common/url_constants.h" |
9 #include "chrome/test/base/browser_with_test_window_test.h" | 9 #include "chrome/test/base/browser_with_test_window_test.h" |
10 #include "chrome/test/base/testing_browser_process.h" | 10 #include "chrome/test/base/testing_browser_process.h" |
| 11 #include "content/browser/tab_contents/tab_contents.h" |
11 | 12 |
12 typedef BrowserWithTestWindowTest BrowserListTest; | 13 typedef BrowserWithTestWindowTest BrowserListTest; |
13 | 14 |
14 namespace { | 15 namespace { |
15 | 16 |
16 // Helper function to iterate and count all the tabs. | 17 // Helper function to iterate and count all the tabs. |
17 size_t CountAllTabs() { | 18 size_t CountAllTabs() { |
18 size_t count = 0; | 19 size_t count = 0; |
19 for (TabContentsIterator iterator; !iterator.done(); ++iterator) | 20 for (TabContentsIterator iterator; !iterator.done(); ++iterator) |
20 ++count; | 21 ++count; |
21 return count; | 22 return count; |
22 } | 23 } |
23 | 24 |
24 // Helper function to navigate to the print preview page. | 25 // Helper function to navigate to the print preview page. |
25 void NavigateToPrintUrl(TabContentsWrapper* tab, int page_id) { | 26 void NavigateToPrintUrl(TabContentsWrapper* tab, int page_id) { |
26 static_cast<TestRenderViewHost*>( | 27 static_cast<TestRenderViewHost*>( |
27 tab->render_view_host())->SendNavigate(page_id, | 28 tab->tab_contents()->render_view_host())->SendNavigate( |
28 GURL(chrome::kChromeUIPrintURL)); | 29 page_id, GURL(chrome::kChromeUIPrintURL)); |
29 } | 30 } |
30 | 31 |
31 } // namespace | 32 } // namespace |
32 | 33 |
33 TEST_F(BrowserListTest, TabContentsIteratorVerifyCount) { | 34 TEST_F(BrowserListTest, TabContentsIteratorVerifyCount) { |
34 // Make sure we have 1 window to start with. | 35 // Make sure we have 1 window to start with. |
35 EXPECT_EQ(1U, BrowserList::size()); | 36 EXPECT_EQ(1U, BrowserList::size()); |
36 | 37 |
37 EXPECT_EQ(0U, CountAllTabs()); | 38 EXPECT_EQ(0U, CountAllTabs()); |
38 | 39 |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 | 225 |
225 // Delete all tabs to clean up. | 226 // Delete all tabs to clean up. |
226 for (std::vector<TabContentsWrapper*>::iterator it = owned_tabs.begin(); | 227 for (std::vector<TabContentsWrapper*>::iterator it = owned_tabs.begin(); |
227 it != owned_tabs.end(); ++it) { | 228 it != owned_tabs.end(); ++it) { |
228 delete *it; | 229 delete *it; |
229 } | 230 } |
230 | 231 |
231 EXPECT_EQ(0U, CountAllTabs()); | 232 EXPECT_EQ(0U, CountAllTabs()); |
232 } | 233 } |
233 #endif | 234 #endif |
OLD | NEW |