| 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 "ui/web_dialogs/web_dialog_web_contents_delegate.h" | 5 #include "ui/web_dialogs/web_dialog_web_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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_LINK, false)); | 85 NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_LINK, false)); |
| 86 // This should create a new foreground tab in the existing browser. | 86 // This should create a new foreground tab in the existing browser. |
| 87 EXPECT_EQ(1, browser()->tab_count()); | 87 EXPECT_EQ(1, browser()->tab_count()); |
| 88 EXPECT_EQ(1U, BrowserList::size()); | 88 EXPECT_EQ(1U, BrowserList::size()); |
| 89 } | 89 } |
| 90 | 90 |
| 91 TEST_F(WebDialogWebContentsDelegateTest, AddNewContentsForegroundTabTest) { | 91 TEST_F(WebDialogWebContentsDelegateTest, AddNewContentsForegroundTabTest) { |
| 92 WebContents* contents = | 92 WebContents* contents = |
| 93 WebContentsTester::CreateTestWebContents(profile(), NULL); | 93 WebContentsTester::CreateTestWebContents(profile(), NULL); |
| 94 test_web_contents_delegate_->AddNewContents( | 94 test_web_contents_delegate_->AddNewContents( |
| 95 NULL, contents, NEW_FOREGROUND_TAB, gfx::Rect(), false); | 95 NULL, contents, NEW_FOREGROUND_TAB, gfx::Rect(), false, NULL); |
| 96 // This should create a new foreground tab in the existing browser. | 96 // This should create a new foreground tab in the existing browser. |
| 97 EXPECT_EQ(1, browser()->tab_count()); | 97 EXPECT_EQ(1, browser()->tab_count()); |
| 98 EXPECT_EQ(1U, BrowserList::size()); | 98 EXPECT_EQ(1U, BrowserList::size()); |
| 99 } | 99 } |
| 100 | 100 |
| 101 TEST_F(WebDialogWebContentsDelegateTest, DetachTest) { | 101 TEST_F(WebDialogWebContentsDelegateTest, DetachTest) { |
| 102 EXPECT_EQ(profile(), test_web_contents_delegate_->browser_context()); | 102 EXPECT_EQ(profile(), test_web_contents_delegate_->browser_context()); |
| 103 test_web_contents_delegate_->Detach(); | 103 test_web_contents_delegate_->Detach(); |
| 104 EXPECT_EQ(NULL, test_web_contents_delegate_->browser_context()); | 104 EXPECT_EQ(NULL, test_web_contents_delegate_->browser_context()); |
| 105 // Now, none of the following calls should do anything. | 105 // Now, none of the following calls should do anything. |
| 106 test_web_contents_delegate_->OpenURLFromTab( | 106 test_web_contents_delegate_->OpenURLFromTab( |
| 107 NULL, OpenURLParams(GURL(chrome::kAboutBlankURL), Referrer(), | 107 NULL, OpenURLParams(GURL(chrome::kAboutBlankURL), Referrer(), |
| 108 NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_LINK, false)); | 108 NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_LINK, false)); |
| 109 test_web_contents_delegate_->AddNewContents(NULL, NULL, NEW_FOREGROUND_TAB, | 109 test_web_contents_delegate_->AddNewContents(NULL, NULL, NEW_FOREGROUND_TAB, |
| 110 gfx::Rect(), false); | 110 gfx::Rect(), false, NULL); |
| 111 EXPECT_EQ(0, browser()->tab_count()); | 111 EXPECT_EQ(0, browser()->tab_count()); |
| 112 EXPECT_EQ(1U, BrowserList::size()); | 112 EXPECT_EQ(1U, BrowserList::size()); |
| 113 } | 113 } |
| 114 | 114 |
| 115 } // namespace | 115 } // namespace |
| OLD | NEW |