OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/dom_ui/html_dialog_tab_contents_delegate.h" | 5 #include "chrome/browser/dom_ui/html_dialog_tab_contents_delegate.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 EXPECT_EQ(0, browser()->tab_count()); | 134 EXPECT_EQ(0, browser()->tab_count()); |
135 EXPECT_EQ(2U, BrowserList::size()); | 135 EXPECT_EQ(2U, BrowserList::size()); |
136 } | 136 } |
137 | 137 |
138 TEST_F(HtmlDialogTabContentsDelegateTest, AddNewContentsTest) { | 138 TEST_F(HtmlDialogTabContentsDelegateTest, AddNewContentsTest) { |
139 MockTestBrowserWindow* window = new MockTestBrowserWindow(); | 139 MockTestBrowserWindow* window = new MockTestBrowserWindow(); |
140 EXPECT_CALL(*window, Show()).Times(1); | 140 EXPECT_CALL(*window, Show()).Times(1); |
141 test_tab_contents_delegate_->SetWindowForNextCreatedBrowser(window); | 141 test_tab_contents_delegate_->SetWindowForNextCreatedBrowser(window); |
142 | 142 |
143 TabContents* contents = | 143 TabContents* contents = |
144 new TabContents(profile(), NULL, MSG_ROUTING_NONE, NULL); | 144 new TabContents(profile(), NULL, MSG_ROUTING_NONE, NULL, NULL); |
145 test_tab_contents_delegate_->AddNewContents( | 145 test_tab_contents_delegate_->AddNewContents( |
146 NULL, contents, NEW_FOREGROUND_TAB, gfx::Rect(), false); | 146 NULL, contents, NEW_FOREGROUND_TAB, gfx::Rect(), false); |
147 EXPECT_EQ(0, browser()->tab_count()); | 147 EXPECT_EQ(0, browser()->tab_count()); |
148 EXPECT_EQ(2U, BrowserList::size()); | 148 EXPECT_EQ(2U, BrowserList::size()); |
149 } | 149 } |
150 | 150 |
151 TEST_F(HtmlDialogTabContentsDelegateTest, DetachTest) { | 151 TEST_F(HtmlDialogTabContentsDelegateTest, DetachTest) { |
152 EXPECT_EQ(profile(), test_tab_contents_delegate_->profile()); | 152 EXPECT_EQ(profile(), test_tab_contents_delegate_->profile()); |
153 test_tab_contents_delegate_->Detach(); | 153 test_tab_contents_delegate_->Detach(); |
154 EXPECT_EQ(NULL, test_tab_contents_delegate_->profile()); | 154 EXPECT_EQ(NULL, test_tab_contents_delegate_->profile()); |
155 // Now, none of the following calls should do anything. | 155 // Now, none of the following calls should do anything. |
156 test_tab_contents_delegate_->OpenURLFromTab( | 156 test_tab_contents_delegate_->OpenURLFromTab( |
157 NULL, GURL(chrome::kAboutBlankURL), GURL(), | 157 NULL, GURL(chrome::kAboutBlankURL), GURL(), |
158 NEW_FOREGROUND_TAB, PageTransition::LINK); | 158 NEW_FOREGROUND_TAB, PageTransition::LINK); |
159 test_tab_contents_delegate_->AddNewContents(NULL, NULL, NEW_FOREGROUND_TAB, | 159 test_tab_contents_delegate_->AddNewContents(NULL, NULL, NEW_FOREGROUND_TAB, |
160 gfx::Rect(), false); | 160 gfx::Rect(), false); |
161 EXPECT_EQ(0, browser()->tab_count()); | 161 EXPECT_EQ(0, browser()->tab_count()); |
162 EXPECT_EQ(1U, BrowserList::size()); | 162 EXPECT_EQ(1U, BrowserList::size()); |
163 } | 163 } |
164 | 164 |
165 } // namespace | 165 } // namespace |
166 | 166 |
OLD | NEW |