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

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

Issue 562603002: Move PageTransition from //content/public/common to //ui/base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 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
« no previous file with comments | « chrome/browser/ui/webui/sync_setup_handler_unittest.cc ('k') | chrome/common/instant_types.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 59
60 protected: 60 protected:
61 scoped_ptr<TestWebContentsDelegate> test_web_contents_delegate_; 61 scoped_ptr<TestWebContentsDelegate> test_web_contents_delegate_;
62 }; 62 };
63 63
64 TEST_F(WebDialogWebContentsDelegateTest, DoNothingMethodsTest) { 64 TEST_F(WebDialogWebContentsDelegateTest, DoNothingMethodsTest) {
65 // None of the following calls should do anything. 65 // None of the following calls should do anything.
66 EXPECT_TRUE(test_web_contents_delegate_->IsPopupOrPanel(NULL)); 66 EXPECT_TRUE(test_web_contents_delegate_->IsPopupOrPanel(NULL));
67 history::HistoryAddPageArgs should_add_args( 67 history::HistoryAddPageArgs should_add_args(
68 GURL(), base::Time::Now(), 0, 0, GURL(), history::RedirectList(), 68 GURL(), base::Time::Now(), 0, 0, GURL(), history::RedirectList(),
69 content::PAGE_TRANSITION_TYPED, history::SOURCE_SYNCED, false); 69 ui::PAGE_TRANSITION_TYPED, history::SOURCE_SYNCED, false);
70 test_web_contents_delegate_->NavigationStateChanged( 70 test_web_contents_delegate_->NavigationStateChanged(
71 NULL, content::InvalidateTypes(0)); 71 NULL, content::InvalidateTypes(0));
72 test_web_contents_delegate_->ActivateContents(NULL); 72 test_web_contents_delegate_->ActivateContents(NULL);
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, 0, GURL()); 75 test_web_contents_delegate_->UpdateTargetURL(NULL, 0, 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,
84 OpenURLParams(GURL(url::kAboutBlankURL), 84 OpenURLParams(GURL(url::kAboutBlankURL),
85 Referrer(), 85 Referrer(),
86 NEW_FOREGROUND_TAB, 86 NEW_FOREGROUND_TAB,
87 content::PAGE_TRANSITION_LINK, 87 ui::PAGE_TRANSITION_LINK,
88 false)); 88 false));
89 // This should create a new foreground tab in the existing browser. 89 // This should create a new foreground tab in the existing browser.
90 EXPECT_EQ(1, browser()->tab_strip_model()->count()); 90 EXPECT_EQ(1, browser()->tab_strip_model()->count());
91 EXPECT_EQ(1U, chrome::GetTotalBrowserCount()); 91 EXPECT_EQ(1U, chrome::GetTotalBrowserCount());
92 } 92 }
93 93
94 TEST_F(WebDialogWebContentsDelegateTest, AddNewContentsForegroundTabTest) { 94 TEST_F(WebDialogWebContentsDelegateTest, AddNewContentsForegroundTabTest) {
95 WebContents* contents = 95 WebContents* contents =
96 WebContentsTester::CreateTestWebContents(profile(), NULL); 96 WebContentsTester::CreateTestWebContents(profile(), NULL);
97 test_web_contents_delegate_->AddNewContents( 97 test_web_contents_delegate_->AddNewContents(
98 NULL, contents, NEW_FOREGROUND_TAB, gfx::Rect(), false, NULL); 98 NULL, contents, NEW_FOREGROUND_TAB, gfx::Rect(), false, NULL);
99 // This should create a new foreground tab in the existing browser. 99 // This should create a new foreground tab in the existing browser.
100 EXPECT_EQ(1, browser()->tab_strip_model()->count()); 100 EXPECT_EQ(1, browser()->tab_strip_model()->count());
101 EXPECT_EQ(1U, chrome::GetTotalBrowserCount()); 101 EXPECT_EQ(1U, chrome::GetTotalBrowserCount());
102 } 102 }
103 103
104 TEST_F(WebDialogWebContentsDelegateTest, DetachTest) { 104 TEST_F(WebDialogWebContentsDelegateTest, DetachTest) {
105 EXPECT_EQ(profile(), test_web_contents_delegate_->browser_context()); 105 EXPECT_EQ(profile(), test_web_contents_delegate_->browser_context());
106 test_web_contents_delegate_->Detach(); 106 test_web_contents_delegate_->Detach();
107 EXPECT_EQ(NULL, test_web_contents_delegate_->browser_context()); 107 EXPECT_EQ(NULL, test_web_contents_delegate_->browser_context());
108 // Now, none of the following calls should do anything. 108 // Now, none of the following calls should do anything.
109 test_web_contents_delegate_->OpenURLFromTab( 109 test_web_contents_delegate_->OpenURLFromTab(
110 NULL, 110 NULL,
111 OpenURLParams(GURL(url::kAboutBlankURL), 111 OpenURLParams(GURL(url::kAboutBlankURL),
112 Referrer(), 112 Referrer(),
113 NEW_FOREGROUND_TAB, 113 NEW_FOREGROUND_TAB,
114 content::PAGE_TRANSITION_LINK, 114 ui::PAGE_TRANSITION_LINK,
115 false)); 115 false));
116 test_web_contents_delegate_->AddNewContents(NULL, NULL, NEW_FOREGROUND_TAB, 116 test_web_contents_delegate_->AddNewContents(NULL, NULL, NEW_FOREGROUND_TAB,
117 gfx::Rect(), false, NULL); 117 gfx::Rect(), false, NULL);
118 EXPECT_EQ(0, browser()->tab_strip_model()->count()); 118 EXPECT_EQ(0, browser()->tab_strip_model()->count());
119 EXPECT_EQ(1U, chrome::GetTotalBrowserCount()); 119 EXPECT_EQ(1U, chrome::GetTotalBrowserCount());
120 } 120 }
121 121
122 } // namespace 122 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/sync_setup_handler_unittest.cc ('k') | chrome/common/instant_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698