Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(69)

Side by Side Diff: chrome/browser/ui/webui/web_dialog_web_contents_delegate_unittest.cc

Issue 10868116: Pass result of blockage across content API when new tab blocked. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698