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

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

Issue 2248873002: Convert WindowOpenDisposition to an enum class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 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
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 <memory> 7 #include <memory>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 test_web_contents_delegate_->LoadingStateChanged(NULL, true); 73 test_web_contents_delegate_->LoadingStateChanged(NULL, true);
74 test_web_contents_delegate_->CloseContents(NULL); 74 test_web_contents_delegate_->CloseContents(NULL);
75 test_web_contents_delegate_->UpdateTargetURL(NULL, GURL()); 75 test_web_contents_delegate_->UpdateTargetURL(NULL, GURL());
76 test_web_contents_delegate_->MoveContents(NULL, gfx::Rect()); 76 test_web_contents_delegate_->MoveContents(NULL, gfx::Rect());
77 EXPECT_EQ(0, browser()->tab_strip_model()->count()); 77 EXPECT_EQ(0, browser()->tab_strip_model()->count());
78 EXPECT_EQ(1U, chrome::GetTotalBrowserCount()); 78 EXPECT_EQ(1U, chrome::GetTotalBrowserCount());
79 } 79 }
80 80
81 TEST_F(WebDialogWebContentsDelegateTest, OpenURLFromTabTest) { 81 TEST_F(WebDialogWebContentsDelegateTest, OpenURLFromTabTest) {
82 test_web_contents_delegate_->OpenURLFromTab( 82 test_web_contents_delegate_->OpenURLFromTab(
83 NULL, 83 NULL, OpenURLParams(GURL(url::kAboutBlankURL), Referrer(),
84 OpenURLParams(GURL(url::kAboutBlankURL), 84 WindowOpenDisposition::NEW_FOREGROUND_TAB,
85 Referrer(), 85 ui::PAGE_TRANSITION_LINK, false));
86 NEW_FOREGROUND_TAB,
87 ui::PAGE_TRANSITION_LINK,
88 false));
89 // This should create a new foreground tab in the existing browser. 86 // This should create a new foreground tab in the existing browser.
90 EXPECT_EQ(1, browser()->tab_strip_model()->count()); 87 EXPECT_EQ(1, browser()->tab_strip_model()->count());
91 EXPECT_EQ(1U, chrome::GetTotalBrowserCount()); 88 EXPECT_EQ(1U, chrome::GetTotalBrowserCount());
92 } 89 }
93 90
94 TEST_F(WebDialogWebContentsDelegateTest, AddNewContentsForegroundTabTest) { 91 TEST_F(WebDialogWebContentsDelegateTest, AddNewContentsForegroundTabTest) {
95 WebContents* contents = 92 WebContents* contents =
96 WebContentsTester::CreateTestWebContents(profile(), NULL); 93 WebContentsTester::CreateTestWebContents(profile(), NULL);
97 test_web_contents_delegate_->AddNewContents( 94 test_web_contents_delegate_->AddNewContents(
98 NULL, contents, NEW_FOREGROUND_TAB, gfx::Rect(), false, NULL); 95 NULL, contents, WindowOpenDisposition::NEW_FOREGROUND_TAB, gfx::Rect(),
96 false, NULL);
99 // This should create a new foreground tab in the existing browser. 97 // This should create a new foreground tab in the existing browser.
100 EXPECT_EQ(1, browser()->tab_strip_model()->count()); 98 EXPECT_EQ(1, browser()->tab_strip_model()->count());
101 EXPECT_EQ(1U, chrome::GetTotalBrowserCount()); 99 EXPECT_EQ(1U, chrome::GetTotalBrowserCount());
102 } 100 }
103 101
104 TEST_F(WebDialogWebContentsDelegateTest, DetachTest) { 102 TEST_F(WebDialogWebContentsDelegateTest, DetachTest) {
105 EXPECT_EQ(profile(), test_web_contents_delegate_->browser_context()); 103 EXPECT_EQ(profile(), test_web_contents_delegate_->browser_context());
106 test_web_contents_delegate_->Detach(); 104 test_web_contents_delegate_->Detach();
107 EXPECT_EQ(NULL, test_web_contents_delegate_->browser_context()); 105 EXPECT_EQ(NULL, test_web_contents_delegate_->browser_context());
108 // Now, none of the following calls should do anything. 106 // Now, none of the following calls should do anything.
109 test_web_contents_delegate_->OpenURLFromTab( 107 test_web_contents_delegate_->OpenURLFromTab(
110 NULL, 108 NULL, OpenURLParams(GURL(url::kAboutBlankURL), Referrer(),
111 OpenURLParams(GURL(url::kAboutBlankURL), 109 WindowOpenDisposition::NEW_FOREGROUND_TAB,
112 Referrer(), 110 ui::PAGE_TRANSITION_LINK, false));
113 NEW_FOREGROUND_TAB, 111 test_web_contents_delegate_->AddNewContents(
114 ui::PAGE_TRANSITION_LINK, 112 NULL, NULL, WindowOpenDisposition::NEW_FOREGROUND_TAB, gfx::Rect(), false,
115 false)); 113 NULL);
116 test_web_contents_delegate_->AddNewContents(NULL, NULL, NEW_FOREGROUND_TAB,
117 gfx::Rect(), false, NULL);
118 EXPECT_EQ(0, browser()->tab_strip_model()->count()); 114 EXPECT_EQ(0, browser()->tab_strip_model()->count());
119 EXPECT_EQ(1U, chrome::GetTotalBrowserCount()); 115 EXPECT_EQ(1U, chrome::GetTotalBrowserCount());
120 } 116 }
121 117
122 } // namespace 118 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/signin/signin_supervised_user_import_handler.cc ('k') | chrome/browser/ui/webui/webui_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698