This source file includes following definitions.
- GetGoogleURL
- GetSettingsURL
- GetContentSettingsURL
- GetClearBrowsingDataURL
- ShortenUberURL
- MakeNavigateParams
- MakeNavigateParams
- OpenPOSTURLInNewForegroundTabAndGetTitle
- CreateEmptyBrowserForType
- CreateEmptyBrowserForApp
- CreateWebContents
- RunSuppressTest
- RunUseNonIncognitoWindowTest
- RunDoNothingIfIncognitoIsForcedTest
- Observe
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
#include "chrome/browser/ui/browser_navigator_browsertest.h"
#include "base/command_line.h"
#include "base/prefs/pref_service.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/prefs/incognito_mode_prefs.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_navigator.h"
#include "chrome/browser/ui/browser_tabstrip.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/chrome_pages.h"
#include "chrome/browser/ui/singleton_tabs.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
#include "chrome/test/base/ui_test_utils.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/notification_types.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_view.h"
#include "ipc/ipc_message.h"
using content::WebContents;
namespace {
const char kExpectedTitle[] = "PASSED!";
const char kEchoTitleCommand[] = "echotitle";
GURL GetGoogleURL() {
return GURL("http://www.google.com/");
}
GURL GetSettingsURL() {
return GURL(chrome::kChromeUISettingsURL);
}
GURL GetContentSettingsURL() {
return GetSettingsURL().Resolve(chrome::kContentSettingsExceptionsSubPage);
}
GURL GetClearBrowsingDataURL() {
return GetSettingsURL().Resolve(chrome::kClearBrowserDataSubPage);
}
GURL ShortenUberURL(const GURL& url) {
std::string url_string = url.spec();
const std::string long_prefix = "chrome://chrome/";
const std::string short_prefix = "chrome://";
if (url_string.find(long_prefix) != 0)
return url;
url_string.replace(0, long_prefix.length(), short_prefix);
return GURL(url_string);
}
}
chrome::NavigateParams BrowserNavigatorTest::MakeNavigateParams() const {
return MakeNavigateParams(browser());
}
chrome::NavigateParams BrowserNavigatorTest::MakeNavigateParams(
Browser* browser) const {
chrome::NavigateParams params(browser, GetGoogleURL(),
content::PAGE_TRANSITION_LINK);
params.window_action = chrome::NavigateParams::SHOW_WINDOW;
return params;
}
bool BrowserNavigatorTest::OpenPOSTURLInNewForegroundTabAndGetTitle(
const GURL& url, const std::string& post_data, bool is_browser_initiated,
base::string16* title) {
chrome::NavigateParams param(MakeNavigateParams());
param.disposition = NEW_FOREGROUND_TAB;
param.url = url;
param.is_renderer_initiated = !is_browser_initiated;
param.uses_post = true;
param.browser_initiated_post_data = new base::RefCountedStaticMemory(
post_data.data(), post_data.size());
ui_test_utils::NavigateToURL(¶m);
if (!param.target_contents)
return false;
EXPECT_EQ(browser(), param.browser);
EXPECT_EQ(browser()->tab_strip_model()->GetActiveWebContents(),
param.target_contents);
EXPECT_EQ(1u, chrome::GetTotalBrowserCount());
EXPECT_EQ(2, browser()->tab_strip_model()->count());
*title = param.target_contents->GetTitle();
return true;
}
Browser* BrowserNavigatorTest::CreateEmptyBrowserForType(Browser::Type type,
Profile* profile) {
Browser* browser = new Browser(
Browser::CreateParams(type, profile, chrome::GetActiveDesktop()));
chrome::AddTabAt(browser, GURL(), -1, true);
return browser;
}
Browser* BrowserNavigatorTest::CreateEmptyBrowserForApp(Browser::Type type,
Profile* profile) {
Browser* browser = new Browser(
Browser::CreateParams::CreateForApp(
Browser::TYPE_POPUP, "Test", gfx::Rect(), profile,
chrome::GetActiveDesktop()));
chrome::AddTabAt(browser, GURL(), -1, true);
return browser;
}
WebContents* BrowserNavigatorTest::CreateWebContents() {
content::WebContents::CreateParams create_params(browser()->profile());
content::WebContents* base_web_contents =
browser()->tab_strip_model()->GetActiveWebContents();
if (base_web_contents) {
create_params.initial_size =
base_web_contents->GetView()->GetContainerSize();
}
return WebContents::Create(create_params);
}
void BrowserNavigatorTest::RunSuppressTest(WindowOpenDisposition disposition) {
GURL old_url = browser()->tab_strip_model()->GetActiveWebContents()->GetURL();
chrome::NavigateParams p(MakeNavigateParams());
p.disposition = disposition;
chrome::Navigate(&p);
EXPECT_EQ(1, browser()->tab_strip_model()->count());
EXPECT_EQ(1u, chrome::GetTotalBrowserCount());
EXPECT_EQ(old_url,
browser()->tab_strip_model()->GetActiveWebContents()->GetURL());
}
void BrowserNavigatorTest::RunUseNonIncognitoWindowTest(const GURL& url) {
Browser* incognito_browser = CreateIncognitoBrowser();
EXPECT_EQ(2u, chrome::GetTotalBrowserCount());
EXPECT_EQ(1, browser()->tab_strip_model()->count());
EXPECT_EQ(1, incognito_browser->tab_strip_model()->count());
chrome::NavigateParams p(MakeNavigateParams(incognito_browser));
p.disposition = SINGLETON_TAB;
p.url = url;
p.window_action = chrome::NavigateParams::SHOW_WINDOW;
chrome::Navigate(&p);
EXPECT_NE(incognito_browser, p.browser);
EXPECT_EQ(browser(), p.browser);
EXPECT_EQ(2, browser()->tab_strip_model()->count());
EXPECT_EQ(url,
browser()->tab_strip_model()->GetActiveWebContents()->GetURL());
}
void BrowserNavigatorTest::RunDoNothingIfIncognitoIsForcedTest(
const GURL& url) {
Browser* browser = CreateIncognitoBrowser();
PrefService* prefs1 = browser->profile()->GetPrefs();
prefs1->SetInteger(prefs::kIncognitoModeAvailability,
IncognitoModePrefs::FORCED);
PrefService* prefs2 = browser->profile()->GetOriginalProfile()->GetPrefs();
prefs2->SetInteger(prefs::kIncognitoModeAvailability,
IncognitoModePrefs::FORCED);
chrome::NavigateParams p(MakeNavigateParams(browser));
p.disposition = OFF_THE_RECORD;
p.url = url;
p.window_action = chrome::NavigateParams::SHOW_WINDOW;
chrome::Navigate(&p);
EXPECT_EQ(browser, p.browser);
EXPECT_EQ(1, browser->tab_strip_model()->count());
EXPECT_EQ(GURL(content::kAboutBlankURL),
browser->tab_strip_model()->GetActiveWebContents()->GetURL());
}
void BrowserNavigatorTest::Observe(
int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
switch (type) {
case content::NOTIFICATION_WEB_CONTENTS_RENDER_VIEW_HOST_CREATED: {
++this->created_tab_contents_count_;
break;
}
default:
break;
}
}
namespace {
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_CurrentTab) {
ui_test_utils::NavigateToURL(browser(), GetGoogleURL());
EXPECT_EQ(GetGoogleURL(),
browser()->tab_strip_model()->GetActiveWebContents()->GetURL());
EXPECT_EQ(1u, chrome::GetTotalBrowserCount());
EXPECT_EQ(1, browser()->tab_strip_model()->count());
}
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_SingletonTabExisting) {
GURL singleton_url1("http://maps.google.com/");
content::NotificationRegistrar registrar;
registrar.Add(this,
content::NOTIFICATION_WEB_CONTENTS_RENDER_VIEW_HOST_CREATED,
content::NotificationService::AllSources());
chrome::AddSelectedTabWithURL(browser(), singleton_url1,
content::PAGE_TRANSITION_LINK);
chrome::AddSelectedTabWithURL(browser(), GetGoogleURL(),
content::PAGE_TRANSITION_LINK);
EXPECT_EQ(1u, chrome::GetTotalBrowserCount());
EXPECT_EQ(2, browser()->tab_strip_model()->active_index());
unsigned int previous_tab_contents_count =
created_tab_contents_count_ = 0;
chrome::NavigateParams p(MakeNavigateParams());
p.disposition = SINGLETON_TAB;
p.url = singleton_url1;
chrome::Navigate(&p);
EXPECT_EQ(browser(), p.browser);
EXPECT_EQ(1, browser()->tab_strip_model()->active_index());
EXPECT_EQ(previous_tab_contents_count,
created_tab_contents_count_);
}
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
Disposition_SingletonTabRespectingRef) {
GURL singleton_ref_url1("http://maps.google.com/#a");
GURL singleton_ref_url2("http://maps.google.com/#b");
GURL singleton_ref_url3("http://maps.google.com/");
chrome::AddSelectedTabWithURL(browser(), singleton_ref_url1,
content::PAGE_TRANSITION_LINK);
EXPECT_EQ(1u, chrome::GetTotalBrowserCount());
EXPECT_EQ(2, browser()->tab_strip_model()->count());
EXPECT_EQ(1, browser()->tab_strip_model()->active_index());
chrome::NavigateParams p(MakeNavigateParams());
p.disposition = SINGLETON_TAB;
p.url = singleton_ref_url2;
chrome::Navigate(&p);
EXPECT_EQ(browser(), p.browser);
EXPECT_EQ(2, browser()->tab_strip_model()->count());
EXPECT_EQ(1, browser()->tab_strip_model()->active_index());
p = MakeNavigateParams();
p.disposition = SINGLETON_TAB;
p.url = singleton_ref_url2;
p.ref_behavior = chrome::NavigateParams::RESPECT_REF;
chrome::Navigate(&p);
EXPECT_EQ(browser(), p.browser);
EXPECT_EQ(3, browser()->tab_strip_model()->count());
EXPECT_EQ(2, browser()->tab_strip_model()->active_index());
p = MakeNavigateParams();
p.disposition = SINGLETON_TAB;
p.url = singleton_ref_url3;
p.ref_behavior = chrome::NavigateParams::RESPECT_REF;
chrome::Navigate(&p);
EXPECT_EQ(browser(), p.browser);
EXPECT_EQ(4, browser()->tab_strip_model()->count());
EXPECT_EQ(3, browser()->tab_strip_model()->active_index());
}
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
Disposition_SingletonTabNoneExisting) {
GURL singleton_url1("http://maps.google.com/");
EXPECT_EQ(1u, chrome::GetTotalBrowserCount());
EXPECT_EQ(0, browser()->tab_strip_model()->active_index());
chrome::NavigateParams p(MakeNavigateParams());
p.disposition = SINGLETON_TAB;
p.url = singleton_url1;
chrome::Navigate(&p);
EXPECT_EQ(browser(), p.browser);
EXPECT_EQ(2, browser()->tab_strip_model()->count());
EXPECT_EQ(1, browser()->tab_strip_model()->active_index());
}
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_NewForegroundTab) {
WebContents* old_contents =
browser()->tab_strip_model()->GetActiveWebContents();
chrome::NavigateParams p(MakeNavigateParams());
p.disposition = NEW_FOREGROUND_TAB;
chrome::Navigate(&p);
EXPECT_NE(old_contents,
browser()->tab_strip_model()->GetActiveWebContents());
EXPECT_EQ(browser()->tab_strip_model()->GetActiveWebContents(),
p.target_contents);
EXPECT_EQ(2, browser()->tab_strip_model()->count());
}
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_NewBackgroundTab) {
WebContents* old_contents =
browser()->tab_strip_model()->GetActiveWebContents();
chrome::NavigateParams p(MakeNavigateParams());
p.disposition = NEW_BACKGROUND_TAB;
chrome::Navigate(&p);
WebContents* new_contents =
browser()->tab_strip_model()->GetActiveWebContents();
EXPECT_EQ(old_contents, new_contents);
EXPECT_EQ(2, browser()->tab_strip_model()->count());
}
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
Disposition_IncompatibleWindow_Existing) {
Browser* popup = CreateEmptyBrowserForType(Browser::TYPE_POPUP,
browser()->profile());
chrome::NavigateParams p(MakeNavigateParams(popup));
p.disposition = NEW_FOREGROUND_TAB;
chrome::Navigate(&p);
EXPECT_NE(popup, p.browser);
EXPECT_EQ(browser(), p.browser);
EXPECT_EQ(2u, chrome::GetTotalBrowserCount());
EXPECT_EQ(1, popup->tab_strip_model()->count());
EXPECT_EQ(2, browser()->tab_strip_model()->count());
}
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
Disposition_IncompatibleWindow_NoExisting) {
Browser* popup = CreateEmptyBrowserForType(
Browser::TYPE_POPUP,
browser()->profile()->GetOffTheRecordProfile());
chrome::NavigateParams p(MakeNavigateParams(popup));
p.disposition = NEW_FOREGROUND_TAB;
chrome::Navigate(&p);
EXPECT_NE(popup, p.browser);
EXPECT_NE(browser(), p.browser);
EXPECT_EQ(3u, chrome::GetTotalBrowserCount());
EXPECT_EQ(1, browser()->tab_strip_model()->count());
EXPECT_EQ(1, popup->tab_strip_model()->count());
EXPECT_EQ(1, p.browser->tab_strip_model()->count());
EXPECT_TRUE(p.browser->is_type_tabbed());
}
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_NewPopup) {
chrome::NavigateParams p(MakeNavigateParams());
p.disposition = NEW_POPUP;
p.window_bounds = gfx::Rect(0, 0, 200, 200);
ui_test_utils::NavigateToURL(&p);
EXPECT_NE(browser(), p.browser);
#if 0
EXPECT_TRUE(p.browser->window()->IsActive());
#endif
EXPECT_TRUE(p.browser->is_type_popup());
EXPECT_FALSE(p.browser->is_app());
EXPECT_EQ(2u, chrome::GetTotalBrowserCount());
EXPECT_EQ(1, browser()->tab_strip_model()->count());
EXPECT_EQ(1, p.browser->tab_strip_model()->count());
}
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_NewPopup_ExtensionId) {
chrome::NavigateParams p(MakeNavigateParams());
p.disposition = NEW_POPUP;
p.extension_app_id = "extensionappid";
p.window_bounds = gfx::Rect(0, 0, 200, 200);
ui_test_utils::NavigateToURL(&p);
EXPECT_NE(browser(), p.browser);
EXPECT_TRUE(p.browser->is_type_popup());
EXPECT_TRUE(p.browser->is_app());
EXPECT_EQ(2u, chrome::GetTotalBrowserCount());
EXPECT_EQ(1, browser()->tab_strip_model()->count());
EXPECT_EQ(1, p.browser->tab_strip_model()->count());
}
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_NewPopupFromPopup) {
chrome::NavigateParams p1(MakeNavigateParams());
p1.disposition = NEW_POPUP;
p1.window_bounds = gfx::Rect(0, 0, 200, 200);
chrome::Navigate(&p1);
chrome::NavigateParams p2(MakeNavigateParams(p1.browser));
p2.disposition = NEW_POPUP;
p2.window_bounds = gfx::Rect(0, 0, 200, 200);
chrome::Navigate(&p2);
EXPECT_NE(p1.browser, p2.browser);
EXPECT_TRUE(p2.browser->is_type_popup());
EXPECT_FALSE(p2.browser->is_app());
EXPECT_EQ(3u, chrome::GetTotalBrowserCount());
EXPECT_EQ(1, browser()->tab_strip_model()->count());
EXPECT_EQ(1, p1.browser->tab_strip_model()->count());
EXPECT_EQ(1, p2.browser->tab_strip_model()->count());
}
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
Disposition_NewPopupFromAppWindow) {
Browser* app_browser = CreateEmptyBrowserForApp(Browser::TYPE_TABBED,
browser()->profile());
chrome::NavigateParams p(MakeNavigateParams(app_browser));
p.disposition = NEW_POPUP;
p.window_bounds = gfx::Rect(0, 0, 200, 200);
chrome::Navigate(&p);
EXPECT_NE(app_browser, p.browser);
EXPECT_NE(browser(), p.browser);
EXPECT_TRUE(p.browser->is_type_popup());
EXPECT_TRUE(p.browser->is_app());
EXPECT_EQ(3u, chrome::GetTotalBrowserCount());
EXPECT_EQ(1, browser()->tab_strip_model()->count());
EXPECT_EQ(1, app_browser->tab_strip_model()->count());
EXPECT_EQ(1, p.browser->tab_strip_model()->count());
}
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
Disposition_NewPopupFromAppPopup) {
Browser* app_browser = CreateEmptyBrowserForApp(Browser::TYPE_TABBED,
browser()->profile());
chrome::NavigateParams p1(MakeNavigateParams(app_browser));
p1.disposition = NEW_POPUP;
p1.window_bounds = gfx::Rect(0, 0, 200, 200);
chrome::Navigate(&p1);
chrome::NavigateParams p2(MakeNavigateParams(p1.browser));
p2.disposition = NEW_POPUP;
p2.window_bounds = gfx::Rect(0, 0, 200, 200);
chrome::Navigate(&p2);
EXPECT_NE(browser(), p1.browser);
EXPECT_NE(p1.browser, p2.browser);
EXPECT_TRUE(p2.browser->is_type_popup());
EXPECT_TRUE(p2.browser->is_app());
EXPECT_EQ(4u, chrome::GetTotalBrowserCount());
EXPECT_EQ(1, browser()->tab_strip_model()->count());
EXPECT_EQ(1, app_browser->tab_strip_model()->count());
EXPECT_EQ(1, p1.browser->tab_strip_model()->count());
EXPECT_EQ(1, p2.browser->tab_strip_model()->count());
}
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
Disposition_NewPopupFromExtensionApp) {
}
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_NewPopupUnfocused) {
chrome::NavigateParams p(MakeNavigateParams());
p.disposition = NEW_POPUP;
p.window_bounds = gfx::Rect(0, 0, 200, 200);
p.window_action = chrome::NavigateParams::SHOW_WINDOW_INACTIVE;
ui_test_utils::NavigateToURL(&p);
EXPECT_NE(browser(), p.browser);
EXPECT_EQ(Browser::TYPE_POPUP, p.browser->type());
#if 0
EXPECT_FALSE(p.browser->window()->IsActive());
#endif
}
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_NewWindow) {
chrome::NavigateParams p(MakeNavigateParams());
p.disposition = NEW_WINDOW;
chrome::Navigate(&p);
EXPECT_NE(browser(), p.browser);
EXPECT_TRUE(p.browser->is_type_tabbed());
EXPECT_EQ(2u, chrome::GetTotalBrowserCount());
EXPECT_EQ(1, browser()->tab_strip_model()->count());
EXPECT_EQ(1, p.browser->tab_strip_model()->count());
}
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_Incognito) {
chrome::NavigateParams p(MakeNavigateParams());
p.disposition = OFF_THE_RECORD;
chrome::Navigate(&p);
EXPECT_NE(browser(), p.browser);
EXPECT_EQ(browser()->profile()->GetOffTheRecordProfile(),
p.browser->profile());
EXPECT_EQ(NULL, p.source_contents);
EXPECT_EQ(2u, chrome::GetTotalBrowserCount());
EXPECT_EQ(1, browser()->tab_strip_model()->count());
EXPECT_EQ(1, p.browser->tab_strip_model()->count());
}
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_IncognitoRefocus) {
Browser* incognito_browser =
CreateEmptyBrowserForType(Browser::TYPE_TABBED,
browser()->profile()->GetOffTheRecordProfile());
chrome::NavigateParams p(MakeNavigateParams());
p.disposition = OFF_THE_RECORD;
chrome::Navigate(&p);
EXPECT_NE(browser(), p.browser);
EXPECT_EQ(p.browser, incognito_browser);
EXPECT_EQ(2u, chrome::GetTotalBrowserCount());
EXPECT_EQ(1, browser()->tab_strip_model()->count());
EXPECT_EQ(2, incognito_browser->tab_strip_model()->count());
}
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_SuppressOpen) {
RunSuppressTest(SUPPRESS_OPEN);
}
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_SaveToDisk) {
RunSuppressTest(SAVE_TO_DISK);
}
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_IgnoreAction) {
RunSuppressTest(IGNORE_ACTION);
}
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, TargetContents_ForegroundTab) {
chrome::NavigateParams p(MakeNavigateParams());
p.disposition = NEW_FOREGROUND_TAB;
p.target_contents = CreateWebContents();
chrome::Navigate(&p);
EXPECT_EQ(browser(), p.browser);
EXPECT_EQ(browser()->tab_strip_model()->GetActiveWebContents(),
p.target_contents);
EXPECT_EQ(1u, chrome::GetTotalBrowserCount());
EXPECT_EQ(2, browser()->tab_strip_model()->count());
}
#if defined(OS_WIN)
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, DISABLED_TargetContents_Popup) {
chrome::NavigateParams p(MakeNavigateParams());
p.disposition = NEW_POPUP;
p.target_contents = CreateWebContents();
p.window_bounds = gfx::Rect(10, 10, 500, 500);
chrome::Navigate(&p);
EXPECT_NE(browser(), p.browser);
EXPECT_TRUE(p.browser->is_type_popup());
EXPECT_FALSE(p.browser->is_app());
EXPECT_EQ(p.window_bounds.origin(),
p.browser->window()->GetRestoredBounds().origin());
EXPECT_EQ(p.window_bounds.size(),
p.target_contents->GetView()->GetContainerSize());
EXPECT_EQ(2u, chrome::GetTotalBrowserCount());
EXPECT_EQ(1, browser()->tab_strip_model()->count());
EXPECT_EQ(1, p.browser->tab_strip_model()->count());
}
#endif
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Tabstrip_InsertAtIndex) {
chrome::NavigateParams p(MakeNavigateParams());
p.disposition = NEW_FOREGROUND_TAB;
p.tabstrip_index = 0;
p.tabstrip_add_types = TabStripModel::ADD_FORCE_INDEX;
chrome::Navigate(&p);
EXPECT_EQ(browser(), p.browser);
EXPECT_EQ(0, browser()->tab_strip_model()->GetIndexOfWebContents(
static_cast<const WebContents*>(p.target_contents)));
EXPECT_EQ(1u, chrome::GetTotalBrowserCount());
EXPECT_EQ(2, browser()->tab_strip_model()->count());
}
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
Disposition_SingletonTabNew_IgnorePath) {
chrome::AddSelectedTabWithURL(browser(), GetGoogleURL(),
content::PAGE_TRANSITION_LINK);
EXPECT_EQ(1u, chrome::GetTotalBrowserCount());
EXPECT_EQ(2, browser()->tab_strip_model()->count());
EXPECT_EQ(1, browser()->tab_strip_model()->active_index());
chrome::NavigateParams p(MakeNavigateParams());
p.disposition = SINGLETON_TAB;
p.url = GetContentSettingsURL();
p.window_action = chrome::NavigateParams::SHOW_WINDOW;
p.path_behavior = chrome::NavigateParams::IGNORE_AND_NAVIGATE;
chrome::Navigate(&p);
EXPECT_EQ(browser(), p.browser);
EXPECT_EQ(3, browser()->tab_strip_model()->count());
EXPECT_EQ(2, browser()->tab_strip_model()->active_index());
EXPECT_EQ(GetContentSettingsURL(),
ShortenUberURL(browser()->tab_strip_model()->
GetActiveWebContents()->GetURL()));
}
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
Disposition_SingletonTabExisting_IgnorePath) {
GURL singleton_url1(GetSettingsURL());
chrome::AddSelectedTabWithURL(browser(), singleton_url1,
content::PAGE_TRANSITION_LINK);
chrome::AddSelectedTabWithURL(browser(), GetGoogleURL(),
content::PAGE_TRANSITION_LINK);
EXPECT_EQ(1u, chrome::GetTotalBrowserCount());
EXPECT_EQ(3, browser()->tab_strip_model()->count());
EXPECT_EQ(2, browser()->tab_strip_model()->active_index());
chrome::NavigateParams p(MakeNavigateParams());
p.disposition = SINGLETON_TAB;
p.url = GetContentSettingsURL();
p.window_action = chrome::NavigateParams::SHOW_WINDOW;
p.path_behavior = chrome::NavigateParams::IGNORE_AND_NAVIGATE;
chrome::Navigate(&p);
EXPECT_EQ(browser(), p.browser);
EXPECT_EQ(3, browser()->tab_strip_model()->count());
EXPECT_EQ(1, browser()->tab_strip_model()->active_index());
EXPECT_EQ(GetContentSettingsURL(),
ShortenUberURL(browser()->tab_strip_model()->
GetActiveWebContents()->GetURL()));
}
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
Disposition_SingletonTabExistingSubPath_IgnorePath) {
GURL singleton_url1(GetContentSettingsURL());
chrome::AddSelectedTabWithURL(browser(), singleton_url1,
content::PAGE_TRANSITION_LINK);
chrome::AddSelectedTabWithURL(browser(), GetGoogleURL(),
content::PAGE_TRANSITION_LINK);
EXPECT_EQ(1u, chrome::GetTotalBrowserCount());
EXPECT_EQ(3, browser()->tab_strip_model()->count());
EXPECT_EQ(2, browser()->tab_strip_model()->active_index());
chrome::NavigateParams p(MakeNavigateParams());
p.disposition = SINGLETON_TAB;
p.url = GetClearBrowsingDataURL();
p.window_action = chrome::NavigateParams::SHOW_WINDOW;
p.path_behavior = chrome::NavigateParams::IGNORE_AND_NAVIGATE;
chrome::Navigate(&p);
EXPECT_EQ(browser(), p.browser);
EXPECT_EQ(3, browser()->tab_strip_model()->count());
EXPECT_EQ(1, browser()->tab_strip_model()->active_index());
EXPECT_EQ(GetClearBrowsingDataURL(),
ShortenUberURL(browser()->tab_strip_model()->
GetActiveWebContents()->GetURL()));
}
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
Disposition_SingletonTabExistingSubPath_IgnorePath2) {
GURL singleton_url1(GetContentSettingsURL());
chrome::AddSelectedTabWithURL(browser(), singleton_url1,
content::PAGE_TRANSITION_LINK);
chrome::AddSelectedTabWithURL(browser(), GetGoogleURL(),
content::PAGE_TRANSITION_LINK);
EXPECT_EQ(1u, chrome::GetTotalBrowserCount());
EXPECT_EQ(3, browser()->tab_strip_model()->count());
EXPECT_EQ(2, browser()->tab_strip_model()->active_index());
chrome::NavigateParams p(MakeNavigateParams());
p.disposition = SINGLETON_TAB;
p.url = GetClearBrowsingDataURL();
p.window_action = chrome::NavigateParams::SHOW_WINDOW;
p.path_behavior = chrome::NavigateParams::IGNORE_AND_STAY_PUT;
chrome::Navigate(&p);
EXPECT_EQ(browser(), p.browser);
EXPECT_EQ(3, browser()->tab_strip_model()->count());
EXPECT_EQ(1, browser()->tab_strip_model()->active_index());
EXPECT_EQ(singleton_url1,
ShortenUberURL(browser()->tab_strip_model()->
GetActiveWebContents()->GetURL()));
}
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
Disposition_SingletonTabFocused_IgnorePath) {
GURL singleton_url_current(GetContentSettingsURL());
chrome::AddSelectedTabWithURL(browser(), singleton_url_current,
content::PAGE_TRANSITION_LINK);
EXPECT_EQ(1u, chrome::GetTotalBrowserCount());
EXPECT_EQ(2, browser()->tab_strip_model()->count());
EXPECT_EQ(1, browser()->tab_strip_model()->active_index());
GURL singleton_url_target(GetClearBrowsingDataURL());
chrome::NavigateParams p(MakeNavigateParams());
p.disposition = SINGLETON_TAB;
p.url = singleton_url_target;
p.window_action = chrome::NavigateParams::SHOW_WINDOW;
p.path_behavior = chrome::NavigateParams::IGNORE_AND_NAVIGATE;
chrome::Navigate(&p);
EXPECT_EQ(browser(), p.browser);
EXPECT_EQ(2, browser()->tab_strip_model()->count());
EXPECT_EQ(1, browser()->tab_strip_model()->active_index());
EXPECT_EQ(singleton_url_target,
ShortenUberURL(browser()->tab_strip_model()->
GetActiveWebContents()->GetURL()));
}
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
Disposition_SingletonTabExisting_IgnoreQuery) {
int initial_tab_count = browser()->tab_strip_model()->count();
GURL singleton_url_current("chrome://settings/internet");
chrome::AddSelectedTabWithURL(browser(), singleton_url_current,
content::PAGE_TRANSITION_LINK);
EXPECT_EQ(initial_tab_count + 1, browser()->tab_strip_model()->count());
EXPECT_EQ(initial_tab_count, browser()->tab_strip_model()->active_index());
GURL singleton_url_target(
"chrome://settings/internet?"
"servicePath=/profile/ethernet_00aa00aa00aa&networkType=1");
chrome::NavigateParams p(MakeNavigateParams());
p.disposition = SINGLETON_TAB;
p.url = singleton_url_target;
p.window_action = chrome::NavigateParams::SHOW_WINDOW;
p.path_behavior = chrome::NavigateParams::IGNORE_AND_NAVIGATE;
chrome::Navigate(&p);
EXPECT_EQ(browser(), p.browser);
EXPECT_EQ(initial_tab_count + 1, browser()->tab_strip_model()->count());
EXPECT_EQ(initial_tab_count, browser()->tab_strip_model()->active_index());
}
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
DISABLED_Disposition_Settings_UseNonIncognitoWindow) {
RunUseNonIncognitoWindowTest(GetSettingsURL());
}
IN_PROC_BROWSER_TEST_F(
BrowserNavigatorTest,
Disposition_ViewSource_Settings_DoNothingIfIncognitoForced) {
std::string view_source(content::kViewSourceScheme);
view_source.append(":");
view_source.append(chrome::kChromeUISettingsURL);
RunDoNothingIfIncognitoIsForcedTest(GURL(view_source));
}
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
Disposition_ViewSource_Settings_UseNonIncognitoWindow) {
std::string view_source(content::kViewSourceScheme);
view_source.append(":");
view_source.append(chrome::kChromeUISettingsURL);
RunUseNonIncognitoWindowTest(GURL(view_source));
}
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
DISABLED_Disposition_Settings_UseNonIncognitoWindowForBookmark) {
chrome::NavigateParams params(browser(), GetSettingsURL(),
content::PAGE_TRANSITION_AUTO_BOOKMARK);
params.disposition = OFF_THE_RECORD;
{
content::WindowedNotificationObserver observer(
content::NOTIFICATION_LOAD_STOP,
content::NotificationService::AllSources());
chrome::Navigate(¶ms);
observer.Wait();
}
EXPECT_EQ(1u, chrome::GetTotalBrowserCount());
EXPECT_EQ(GetSettingsURL(),
ShortenUberURL(browser()->tab_strip_model()->
GetActiveWebContents()->GetURL()));
}
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
DISABLED_Disposition_Settings_DoNothingIfIncognitoIsForced) {
RunDoNothingIfIncognitoIsForcedTest(GetSettingsURL());
}
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
Disposition_Bookmarks_UseNonIncognitoWindow) {
RunUseNonIncognitoWindowTest(GURL(chrome::kChromeUIBookmarksURL));
}
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
Disposition_Bookmarks_DoNothingIfIncognitoIsForced) {
RunDoNothingIfIncognitoIsForcedTest(GURL(chrome::kChromeUIBookmarksURL));
}
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
NavigateToCrashedSingletonTab) {
GURL singleton_url(GetContentSettingsURL());
WebContents* web_contents = chrome::AddSelectedTabWithURL(
browser(), singleton_url, content::PAGE_TRANSITION_LINK);
EXPECT_EQ(1u, chrome::GetTotalBrowserCount());
EXPECT_EQ(2, browser()->tab_strip_model()->count());
EXPECT_EQ(1, browser()->tab_strip_model()->active_index());
web_contents->SetIsCrashed(base::TERMINATION_STATUS_PROCESS_CRASHED, -1);
EXPECT_TRUE(web_contents->IsCrashed());
chrome::NavigateParams p(MakeNavigateParams());
p.disposition = SINGLETON_TAB;
p.url = singleton_url;
p.window_action = chrome::NavigateParams::SHOW_WINDOW;
p.path_behavior = chrome::NavigateParams::IGNORE_AND_NAVIGATE;
ui_test_utils::NavigateToURL(&p);
EXPECT_FALSE(web_contents->IsCrashed());
}
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
NavigateFromDefaultToOptionsInSameTab) {
{
content::WindowedNotificationObserver observer(
content::NOTIFICATION_LOAD_STOP,
content::NotificationService::AllSources());
chrome::ShowSettings(browser());
observer.Wait();
}
EXPECT_EQ(1, browser()->tab_strip_model()->count());
EXPECT_EQ(GetSettingsURL(),
ShortenUberURL(browser()->tab_strip_model()->
GetActiveWebContents()->GetURL()));
}
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
NavigateFromBlankToOptionsInSameTab) {
chrome::NavigateParams p(MakeNavigateParams());
p.url = GURL(content::kAboutBlankURL);
ui_test_utils::NavigateToURL(&p);
{
content::WindowedNotificationObserver observer(
content::NOTIFICATION_LOAD_STOP,
content::NotificationService::AllSources());
chrome::ShowSettings(browser());
observer.Wait();
}
EXPECT_EQ(1, browser()->tab_strip_model()->count());
EXPECT_EQ(GetSettingsURL(),
ShortenUberURL(browser()->tab_strip_model()->
GetActiveWebContents()->GetURL()));
}
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
NavigateFromNTPToOptionsInSameTab) {
chrome::NavigateParams p(MakeNavigateParams());
p.url = GURL(chrome::kChromeUINewTabURL);
ui_test_utils::NavigateToURL(&p);
EXPECT_EQ(1, browser()->tab_strip_model()->count());
EXPECT_EQ(GURL(chrome::kChromeUINewTabURL),
browser()->tab_strip_model()->GetActiveWebContents()->GetURL());
{
content::WindowedNotificationObserver observer(
content::NOTIFICATION_LOAD_STOP,
content::NotificationService::AllSources());
chrome::ShowSettings(browser());
observer.Wait();
}
EXPECT_EQ(1, browser()->tab_strip_model()->count());
EXPECT_EQ(GetSettingsURL(),
ShortenUberURL(browser()->tab_strip_model()->
GetActiveWebContents()->GetURL()));
}
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
NavigateFromPageToOptionsInNewTab) {
chrome::NavigateParams p(MakeNavigateParams());
ui_test_utils::NavigateToURL(&p);
EXPECT_EQ(GetGoogleURL(),
browser()->tab_strip_model()->GetActiveWebContents()->GetURL());
EXPECT_EQ(1u, chrome::GetTotalBrowserCount());
EXPECT_EQ(1, browser()->tab_strip_model()->count());
{
content::WindowedNotificationObserver observer(
content::NOTIFICATION_LOAD_STOP,
content::NotificationService::AllSources());
chrome::ShowSettings(browser());
observer.Wait();
}
EXPECT_EQ(2, browser()->tab_strip_model()->count());
EXPECT_EQ(GetSettingsURL(),
ShortenUberURL(browser()->tab_strip_model()->
GetActiveWebContents()->GetURL()));
}
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
NavigateFromNTPToOptionsSingleton) {
{
content::WindowedNotificationObserver observer(
content::NOTIFICATION_LOAD_STOP,
content::NotificationService::AllSources());
chrome::ShowSettings(browser());
observer.Wait();
}
EXPECT_EQ(1, browser()->tab_strip_model()->count());
chrome::NewTab(browser());
EXPECT_EQ(2, browser()->tab_strip_model()->count());
{
content::WindowedNotificationObserver observer(
content::NOTIFICATION_LOAD_STOP,
content::NotificationService::AllSources());
chrome::ShowSettings(browser());
observer.Wait();
}
EXPECT_EQ(2, browser()->tab_strip_model()->count());
EXPECT_EQ(GetSettingsURL(),
ShortenUberURL(browser()->tab_strip_model()->
GetActiveWebContents()->GetURL()));
}
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
NavigateFromNTPToOptionsPageInSameTab) {
{
content::WindowedNotificationObserver observer(
content::NOTIFICATION_LOAD_STOP,
content::NotificationService::AllSources());
chrome::ShowClearBrowsingDataDialog(browser());
observer.Wait();
}
EXPECT_EQ(1, browser()->tab_strip_model()->count());
EXPECT_EQ(GetClearBrowsingDataURL(),
browser()->tab_strip_model()->GetActiveWebContents()->GetURL());
chrome::NewTab(browser());
EXPECT_EQ(2, browser()->tab_strip_model()->count());
{
content::WindowedNotificationObserver observer(
content::NOTIFICATION_LOAD_STOP,
content::NotificationService::AllSources());
chrome::ShowClearBrowsingDataDialog(browser());
observer.Wait();
}
EXPECT_EQ(2, browser()->tab_strip_model()->count());
EXPECT_EQ(GetClearBrowsingDataURL(),
browser()->tab_strip_model()->GetActiveWebContents()->GetURL());
}
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
NavigateFromOtherTabToSingletonOptions) {
{
content::WindowedNotificationObserver observer(
content::NOTIFICATION_LOAD_STOP,
content::NotificationService::AllSources());
chrome::ShowSettings(browser());
observer.Wait();
}
{
content::WindowedNotificationObserver observer(
content::NOTIFICATION_LOAD_STOP,
content::NotificationService::AllSources());
chrome::AddSelectedTabWithURL(browser(), GetGoogleURL(),
content::PAGE_TRANSITION_LINK);
observer.Wait();
}
chrome::ShowSettings(browser());
EXPECT_EQ(2, browser()->tab_strip_model()->count());
EXPECT_EQ(GetSettingsURL(),
ShortenUberURL(browser()->tab_strip_model()->
GetActiveWebContents()->GetURL()));
}
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, CloseSingletonTab) {
for (int i = 0; i < 2; ++i) {
content::WindowedNotificationObserver observer(
content::NOTIFICATION_LOAD_STOP,
content::NotificationService::AllSources());
chrome::AddSelectedTabWithURL(browser(), GetGoogleURL(),
content::PAGE_TRANSITION_TYPED);
observer.Wait();
}
browser()->tab_strip_model()->ActivateTabAt(0, true);
{
content::WindowedNotificationObserver observer(
content::NOTIFICATION_LOAD_STOP,
content::NotificationService::AllSources());
chrome::ShowSettings(browser());
observer.Wait();
}
EXPECT_TRUE(browser()->tab_strip_model()->CloseWebContentsAt(
2, TabStripModel::CLOSE_USER_GESTURE));
EXPECT_EQ(0, browser()->tab_strip_model()->active_index());
}
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
DISABLED_NavigateFromDefaultToHistoryInSameTab) {
{
content::WindowedNotificationObserver observer(
content::NOTIFICATION_LOAD_STOP,
content::NotificationService::AllSources());
chrome::ShowHistory(browser());
observer.Wait();
}
EXPECT_EQ(1, browser()->tab_strip_model()->count());
EXPECT_EQ(GURL(chrome::kChromeUIHistoryFrameURL),
browser()->tab_strip_model()->GetActiveWebContents()->GetURL());
}
#if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(USE_AURA)
#define MAYBE_NavigateFromDefaultToBookmarksInSameTab DISABLED_NavigateFromDefaultToBookmarksInSameTab
#else
#define MAYBE_NavigateFromDefaultToBookmarksInSameTab NavigateFromDefaultToBookmarksInSameTab
#endif
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
MAYBE_NavigateFromDefaultToBookmarksInSameTab) {
{
content::WindowedNotificationObserver observer(
content::NOTIFICATION_LOAD_STOP,
content::NotificationService::AllSources());
chrome::ShowBookmarkManager(browser());
observer.Wait();
}
EXPECT_EQ(1, browser()->tab_strip_model()->count());
EXPECT_TRUE(StartsWithASCII(
browser()->tab_strip_model()->GetActiveWebContents()->GetURL().spec(),
chrome::kChromeUIBookmarksURL,
true));
}
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
NavigateFromDefaultToDownloadsInSameTab) {
{
content::WindowedNotificationObserver observer(
content::NOTIFICATION_LOAD_STOP,
content::NotificationService::AllSources());
chrome::ShowDownloads(browser());
observer.Wait();
}
EXPECT_EQ(1, browser()->tab_strip_model()->count());
EXPECT_EQ(GURL(chrome::kChromeUIDownloadsURL),
browser()->tab_strip_model()->GetActiveWebContents()->GetURL());
}
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
NavigateWithoutBrowser) {
chrome::NavigateParams params(browser()->profile(), GetGoogleURL(),
content::PAGE_TRANSITION_LINK);
ui_test_utils::NavigateToURL(¶ms);
EXPECT_EQ(1u, chrome::GetTotalBrowserCount());
chrome::NavigateParams params_incognito(
browser()->profile()->GetOffTheRecordProfile(),
GetGoogleURL(), content::PAGE_TRANSITION_LINK);
ui_test_utils::NavigateToURL(¶ms_incognito);
EXPECT_EQ(2u, chrome::GetTotalBrowserCount());
}
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, ViewSourceIsntSingleton) {
const std::string viewsource_ntp_url =
std::string(content::kViewSourceScheme) + ":" +
chrome::kChromeUIVersionURL;
chrome::NavigateParams viewsource_params(browser(),
GURL(viewsource_ntp_url),
content::PAGE_TRANSITION_LINK);
ui_test_utils::NavigateToURL(&viewsource_params);
chrome::NavigateParams singleton_params(browser(),
GURL(chrome::kChromeUIVersionURL),
content::PAGE_TRANSITION_LINK);
singleton_params.disposition = SINGLETON_TAB;
EXPECT_EQ(-1, chrome::GetIndexOfSingletonTab(&singleton_params));
}
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
SendBrowserInitiatedRequestUsingPOST) {
ASSERT_TRUE(test_server()->Start());
base::string16 expected_title(base::ASCIIToUTF16(kExpectedTitle));
std::string post_data = kExpectedTitle;
base::string16 title;
ASSERT_TRUE(OpenPOSTURLInNewForegroundTabAndGetTitle(
test_server()->GetURL(kEchoTitleCommand), post_data, true, &title));
EXPECT_EQ(expected_title, title);
}
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
SendRendererInitiatedRequestUsingPOST) {
ASSERT_TRUE(test_server()->Start());
base::string16 expected_title(base::ASCIIToUTF16(kExpectedTitle));
std::string post_data = kExpectedTitle;
base::string16 title;
ASSERT_TRUE(OpenPOSTURLInNewForegroundTabAndGetTitle(
test_server()->GetURL(kEchoTitleCommand), post_data, false, &title));
EXPECT_NE(expected_title, title);
}
}