| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/print_preview_tab_controller.h" | 5 #include "chrome/browser/printing/print_preview_tab_controller.h" |
| 6 #include "chrome/browser/tab_contents/tab_contents.h" | 6 #include "chrome/browser/tab_contents/tab_contents.h" |
| 7 #include "chrome/browser/tabs/tab_strip_model.h" | 7 #include "chrome/browser/tabs/tab_strip_model.h" |
| 8 #include "chrome/browser/ui/browser_list.h" | 8 #include "chrome/browser/ui/browser_list.h" |
| 9 #include "chrome/test/browser_with_test_window_test.h" | 9 #include "chrome/test/browser_with_test_window_test.h" |
| 10 #include "chrome/test/testing_profile.h" | 10 #include "chrome/test/testing_profile.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 TabContents* preview_tab_2 = tab_controller->GetOrCreatePreviewTab( | 88 TabContents* preview_tab_2 = tab_controller->GetOrCreatePreviewTab( |
| 89 tab_contents_2, tab_contents_2->controller().window_id().id()); | 89 tab_contents_2, tab_contents_2->controller().window_id().id()); |
| 90 | 90 |
| 91 EXPECT_NE(tab_contents_2, preview_tab_2); | 91 EXPECT_NE(tab_contents_2, preview_tab_2); |
| 92 // 2 initiator tab and 2 preview tabs exist in the same browser. | 92 // 2 initiator tab and 2 preview tabs exist in the same browser. |
| 93 EXPECT_EQ(4, browser()->tab_count()); | 93 EXPECT_EQ(4, browser()->tab_count()); |
| 94 | 94 |
| 95 TabStripModel* model = browser()->tabstrip_model(); | 95 TabStripModel* model = browser()->tabstrip_model(); |
| 96 ASSERT_TRUE(model); | 96 ASSERT_TRUE(model); |
| 97 | 97 |
| 98 int preview_tab_1_index = model->GetIndexOfTabContents(preview_tab_1); | 98 int preview_tab_1_index = model->GetWrapperIndex(preview_tab_1); |
| 99 int preview_tab_2_index = model->GetIndexOfTabContents(preview_tab_2); | 99 int preview_tab_2_index = model->GetWrapperIndex(preview_tab_2); |
| 100 | 100 |
| 101 EXPECT_NE(-1, preview_tab_1_index); | 101 EXPECT_NE(-1, preview_tab_1_index); |
| 102 EXPECT_NE(-1, preview_tab_2_index); | 102 EXPECT_NE(-1, preview_tab_2_index); |
| 103 // Current tab is |preview_tab_2|. | 103 // Current tab is |preview_tab_2|. |
| 104 EXPECT_EQ(preview_tab_2_index, browser()->selected_index()); | 104 EXPECT_EQ(preview_tab_2_index, browser()->selected_index()); |
| 105 | 105 |
| 106 // Activate |tab_contents_1| tab. | 106 // Activate |tab_contents_1| tab. |
| 107 tab_contents_1->Activate(); | 107 tab_contents_1->Activate(); |
| 108 | 108 |
| 109 // When we get the preview tab for |tab_contents_1|, | 109 // When we get the preview tab for |tab_contents_1|, |
| 110 // |preview_tab_1| is activated and focused. | 110 // |preview_tab_1| is activated and focused. |
| 111 tab_controller->GetOrCreatePreviewTab( | 111 tab_controller->GetOrCreatePreviewTab( |
| 112 tab_contents_1, tab_contents_1->controller().window_id().id()); | 112 tab_contents_1, tab_contents_1->controller().window_id().id()); |
| 113 EXPECT_EQ(preview_tab_1_index, browser()->selected_index()); | 113 EXPECT_EQ(preview_tab_1_index, browser()->selected_index()); |
| 114 } | 114 } |
| OLD | NEW |