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

Side by Side Diff: chrome/browser/extensions/extension_install_ui_browsertest.cc

Issue 9015022: Replace most of Browser::GetSelectedTabContents calls into Browser::GetSelectedWebContents. I've ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 8 years, 11 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) 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 "base/string_util.h" 5 #include "base/string_util.h"
6 #include "chrome/browser/extensions/extension_browsertest.h" 6 #include "chrome/browser/extensions/extension_browsertest.h"
7 #include "chrome/browser/extensions/extension_service.h" 7 #include "chrome/browser/extensions/extension_service.h"
8 #include "chrome/browser/extensions/theme_installed_infobar_delegate.h" 8 #include "chrome/browser/extensions/theme_installed_infobar_delegate.h"
9 #include "chrome/browser/infobars/infobar_tab_helper.h" 9 #include "chrome/browser/infobars/infobar_tab_helper.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/browser/ui/browser.h" 11 #include "chrome/browser/ui/browser.h"
12 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 12 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
13 #include "chrome/browser/themes/theme_service_factory.h" 13 #include "chrome/browser/themes/theme_service_factory.h"
14 #include "chrome/test/base/ui_test_utils.h" 14 #include "chrome/test/base/ui_test_utils.h"
15 #include "content/browser/tab_contents/tab_contents.h" 15 #include "content/public/browser/web_contents.h"
16
17 using content::WebContents;
16 18
17 class ExtensionInstallUIBrowserTest : public ExtensionBrowserTest { 19 class ExtensionInstallUIBrowserTest : public ExtensionBrowserTest {
18 public: 20 public:
19 // Checks that a theme info bar is currently visible and issues an undo to 21 // Checks that a theme info bar is currently visible and issues an undo to
20 // revert to the previous theme. 22 // revert to the previous theme.
21 void VerifyThemeInfoBarAndUndoInstall() { 23 void VerifyThemeInfoBarAndUndoInstall() {
22 TabContentsWrapper* tab = browser()->GetSelectedTabContentsWrapper(); 24 TabContentsWrapper* tab = browser()->GetSelectedTabContentsWrapper();
23 ASSERT_TRUE(tab); 25 ASSERT_TRUE(tab);
24 InfoBarTabHelper* infobar_helper = tab->infobar_tab_helper(); 26 InfoBarTabHelper* infobar_helper = tab->infobar_tab_helper();
25 ASSERT_EQ(1U, infobar_helper->infobar_count()); 27 ASSERT_EQ(1U, infobar_helper->infobar_count());
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 103
102 IN_PROC_BROWSER_TEST_F(ExtensionInstallUIBrowserTest, 104 IN_PROC_BROWSER_TEST_F(ExtensionInstallUIBrowserTest,
103 AppInstallConfirmation) { 105 AppInstallConfirmation) {
104 int num_tabs = browser()->tab_count(); 106 int num_tabs = browser()->tab_count();
105 107
106 FilePath app_dir = test_data_dir_.AppendASCII("app"); 108 FilePath app_dir = test_data_dir_.AppendASCII("app");
107 ASSERT_TRUE(InstallExtensionWithUIAutoConfirm(app_dir, 1, 109 ASSERT_TRUE(InstallExtensionWithUIAutoConfirm(app_dir, 1,
108 browser()->profile())); 110 browser()->profile()));
109 111
110 EXPECT_EQ(num_tabs + 1, browser()->tab_count()); 112 EXPECT_EQ(num_tabs + 1, browser()->tab_count());
111 TabContents* tab_contents = browser()->GetSelectedTabContents(); 113 WebContents* web_contents = browser()->GetSelectedWebContents();
112 ASSERT_TRUE(tab_contents); 114 ASSERT_TRUE(web_contents);
113 EXPECT_TRUE(StartsWithASCII(tab_contents->GetURL().spec(), 115 EXPECT_TRUE(StartsWithASCII(web_contents->GetURL().spec(),
114 "chrome://newtab/", false)); 116 "chrome://newtab/", false));
115 } 117 }
116 118
117 IN_PROC_BROWSER_TEST_F(ExtensionInstallUIBrowserTest, 119 IN_PROC_BROWSER_TEST_F(ExtensionInstallUIBrowserTest,
118 AppInstallConfirmation_Incognito) { 120 AppInstallConfirmation_Incognito) {
119 Profile* incognito_profile = browser()->profile()->GetOffTheRecordProfile(); 121 Profile* incognito_profile = browser()->profile()->GetOffTheRecordProfile();
120 Browser* incognito_browser = Browser::GetOrCreateTabbedBrowser( 122 Browser* incognito_browser = Browser::GetOrCreateTabbedBrowser(
121 incognito_profile); 123 incognito_profile);
122 124
123 int num_incognito_tabs = incognito_browser->tab_count(); 125 int num_incognito_tabs = incognito_browser->tab_count();
124 int num_normal_tabs = browser()->tab_count(); 126 int num_normal_tabs = browser()->tab_count();
125 127
126 FilePath app_dir = test_data_dir_.AppendASCII("app"); 128 FilePath app_dir = test_data_dir_.AppendASCII("app");
127 ASSERT_TRUE(InstallExtensionWithUIAutoConfirm(app_dir, 1, 129 ASSERT_TRUE(InstallExtensionWithUIAutoConfirm(app_dir, 1,
128 incognito_profile)); 130 incognito_profile));
129 131
130 EXPECT_EQ(num_incognito_tabs, incognito_browser->tab_count()); 132 EXPECT_EQ(num_incognito_tabs, incognito_browser->tab_count());
131 EXPECT_EQ(num_normal_tabs + 1, browser()->tab_count()); 133 EXPECT_EQ(num_normal_tabs + 1, browser()->tab_count());
132 TabContents* tab_contents = browser()->GetSelectedTabContents(); 134 WebContents* web_contents = browser()->GetSelectedWebContents();
133 ASSERT_TRUE(tab_contents); 135 ASSERT_TRUE(web_contents);
134 EXPECT_TRUE(StartsWithASCII(tab_contents->GetURL().spec(), 136 EXPECT_TRUE(StartsWithASCII(web_contents->GetURL().spec(),
135 "chrome://newtab/", false)); 137 "chrome://newtab/", false));
136 } 138 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_incognito_apitest.cc ('k') | chrome/browser/extensions/extension_nacl_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698