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/ui/webui/html_dialog_tab_contents_delegate.h" | 5 #include "chrome/browser/ui/webui/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/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 test_tab_contents_delegate_->LoadingStateChanged(NULL); | 65 test_tab_contents_delegate_->LoadingStateChanged(NULL); |
66 test_tab_contents_delegate_->CloseContents(NULL); | 66 test_tab_contents_delegate_->CloseContents(NULL); |
67 test_tab_contents_delegate_->UpdateTargetURL(NULL, 0, GURL()); | 67 test_tab_contents_delegate_->UpdateTargetURL(NULL, 0, GURL()); |
68 test_tab_contents_delegate_->MoveContents(NULL, gfx::Rect()); | 68 test_tab_contents_delegate_->MoveContents(NULL, gfx::Rect()); |
69 EXPECT_EQ(0, browser()->tab_count()); | 69 EXPECT_EQ(0, browser()->tab_count()); |
70 EXPECT_EQ(1U, BrowserList::size()); | 70 EXPECT_EQ(1U, BrowserList::size()); |
71 } | 71 } |
72 | 72 |
73 TEST_F(HtmlDialogTabContentsDelegateTest, OpenURLFromTabTest) { | 73 TEST_F(HtmlDialogTabContentsDelegateTest, OpenURLFromTabTest) { |
74 test_tab_contents_delegate_->OpenURLFromTab( | 74 test_tab_contents_delegate_->OpenURLFromTab( |
75 NULL, OpenURLParams(GURL(chrome::kAboutBlankURL), GURL(), | 75 NULL, OpenURLParams(GURL(chrome::kAboutBlankURL), content::Referrer(), |
76 NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_LINK, false)); | 76 NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_LINK, false)); |
77 // This should create a new foreground tab in the existing browser. | 77 // This should create a new foreground tab in the existing browser. |
78 EXPECT_EQ(1, browser()->tab_count()); | 78 EXPECT_EQ(1, browser()->tab_count()); |
79 EXPECT_EQ(1U, BrowserList::size()); | 79 EXPECT_EQ(1U, BrowserList::size()); |
80 } | 80 } |
81 | 81 |
82 TEST_F(HtmlDialogTabContentsDelegateTest, AddNewContentsForegroundTabTest) { | 82 TEST_F(HtmlDialogTabContentsDelegateTest, AddNewContentsForegroundTabTest) { |
83 TabContents* contents = | 83 TabContents* contents = |
84 new TabContents(profile(), NULL, MSG_ROUTING_NONE, NULL, NULL); | 84 new TabContents(profile(), NULL, MSG_ROUTING_NONE, NULL, NULL); |
85 test_tab_contents_delegate_->AddNewContents( | 85 test_tab_contents_delegate_->AddNewContents( |
86 NULL, contents, NEW_FOREGROUND_TAB, gfx::Rect(), false); | 86 NULL, contents, NEW_FOREGROUND_TAB, gfx::Rect(), false); |
87 // This should create a new foreground tab in the existing browser. | 87 // This should create a new foreground tab in the existing browser. |
88 EXPECT_EQ(1, browser()->tab_count()); | 88 EXPECT_EQ(1, browser()->tab_count()); |
89 EXPECT_EQ(1U, BrowserList::size()); | 89 EXPECT_EQ(1U, BrowserList::size()); |
90 } | 90 } |
91 | 91 |
92 TEST_F(HtmlDialogTabContentsDelegateTest, DetachTest) { | 92 TEST_F(HtmlDialogTabContentsDelegateTest, DetachTest) { |
93 EXPECT_EQ(profile(), test_tab_contents_delegate_->profile()); | 93 EXPECT_EQ(profile(), test_tab_contents_delegate_->profile()); |
94 test_tab_contents_delegate_->Detach(); | 94 test_tab_contents_delegate_->Detach(); |
95 EXPECT_EQ(NULL, test_tab_contents_delegate_->profile()); | 95 EXPECT_EQ(NULL, test_tab_contents_delegate_->profile()); |
96 // Now, none of the following calls should do anything. | 96 // Now, none of the following calls should do anything. |
97 test_tab_contents_delegate_->OpenURLFromTab( | 97 test_tab_contents_delegate_->OpenURLFromTab( |
98 NULL, OpenURLParams(GURL(chrome::kAboutBlankURL), GURL(), | 98 NULL, OpenURLParams(GURL(chrome::kAboutBlankURL), content::Referrer(), |
99 NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_LINK, false)); | 99 NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_LINK, false)); |
100 test_tab_contents_delegate_->AddNewContents(NULL, NULL, NEW_FOREGROUND_TAB, | 100 test_tab_contents_delegate_->AddNewContents(NULL, NULL, NEW_FOREGROUND_TAB, |
101 gfx::Rect(), false); | 101 gfx::Rect(), false); |
102 EXPECT_EQ(0, browser()->tab_count()); | 102 EXPECT_EQ(0, browser()->tab_count()); |
103 EXPECT_EQ(1U, BrowserList::size()); | 103 EXPECT_EQ(1U, BrowserList::size()); |
104 } | 104 } |
105 | 105 |
106 } // namespace | 106 } // namespace |
OLD | NEW |