diff options
author | stoyan@chromium.org <stoyan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-23 18:24:32 +0000 |
---|---|---|
committer | stoyan@chromium.org <stoyan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-23 18:24:32 +0000 |
commit | dd07d60bc0f068a4749c91b481ccc948e1b00483 (patch) | |
tree | 4ae6e3714bbe65674d89ac1a2c8a8fcea6a90a83 /chrome | |
parent | c01e17b8352b02ced5677f05efd8bee3c2f89aed (diff) | |
download | chromium_src-dd07d60bc0f068a4749c91b481ccc948e1b00483.zip chromium_src-dd07d60bc0f068a4749c91b481ccc948e1b00483.tar.gz chromium_src-dd07d60bc0f068a4749c91b481ccc948e1b00483.tar.bz2 |
Allow creating external tab in incognito mode.
Review URL: http://codereview.chromium.org/88051
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14335 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/automation/automation_provider.cc | 4 | ||||
-rw-r--r-- | chrome/browser/automation/automation_provider.h | 4 | ||||
-rw-r--r-- | chrome/test/automation/automation_messages_internal.h | 4 | ||||
-rw-r--r-- | chrome/test/automation/automation_proxy.cc | 2 | ||||
-rw-r--r-- | chrome/test/automation/automation_proxy.h | 3 | ||||
-rw-r--r-- | chrome/test/automation/automation_proxy_uitest.cc | 29 |
6 files changed, 39 insertions, 7 deletions
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc index 1a5fd90..8a3c324 100644 --- a/chrome/browser/automation/automation_provider.cc +++ b/chrome/browser/automation/automation_provider.cc @@ -2290,13 +2290,15 @@ void AutomationProvider::CloseBrowserAsync(int browser_handle) { void AutomationProvider::CreateExternalTab(HWND parent, const gfx::Rect& dimensions, unsigned int style, + bool incognito, HWND* tab_container_window, int* tab_handle) { *tab_handle = 0; *tab_container_window = NULL; ExternalTabContainer *external_tab_container = new ExternalTabContainer(this); - external_tab_container->Init(profile_, parent, dimensions, style); + Profile* profile = incognito? profile_->GetOffTheRecordProfile() : profile_; + external_tab_container->Init(profile, parent, dimensions, style); TabContents* tab_contents = external_tab_container->tab_contents(); if (tab_contents) { *tab_handle = tab_tracker_->Add(&tab_contents->controller()); diff --git a/chrome/browser/automation/automation_provider.h b/chrome/browser/automation/automation_provider.h index 65f8906..4e33c2d 100644 --- a/chrome/browser/automation/automation_provider.h +++ b/chrome/browser/automation/automation_provider.h @@ -277,8 +277,8 @@ class AutomationProvider : public base::RefCounted<AutomationProvider>, #if defined(OS_WIN) // TODO(port): Re-enable. void CreateExternalTab(HWND parent, const gfx::Rect& dimensions, - unsigned int style, HWND* tab_container_window, - int* tab_handle); + unsigned int style, bool incognito, + HWND* tab_container_window, int* tab_handle); void NavigateInExternalTab( int handle, const GURL& url, AutomationMsg_NavigationResponseValues* status); diff --git a/chrome/test/automation/automation_messages_internal.h b/chrome/test/automation/automation_messages_internal.h index 16b0a42..4f56764 100644 --- a/chrome/test/automation/automation_messages_internal.h +++ b/chrome/test/automation/automation_messages_internal.h @@ -425,10 +425,12 @@ IPC_BEGIN_MESSAGES(Automation) // HWND - handle to a window acting as a parent/owner for the new tab. // gfx::Rect - initial dimensions. // style - window style to be used at the time of cration. - IPC_SYNC_MESSAGE_ROUTED3_2(AutomationMsg_CreateExternalTab, + // incognito - use off-the-record profile + IPC_SYNC_MESSAGE_ROUTED4_2(AutomationMsg_CreateExternalTab, HWND /* owner_or_parent*/, gfx::Rect /* dimensions */, unsigned int /* style */, + bool /* off-the-record profile */, HWND /* The window handle is returned here */, int /* Handle to the new tab */) #endif // defined(OS_WIN) diff --git a/chrome/test/automation/automation_proxy.cc b/chrome/test/automation/automation_proxy.cc index c6b1bb9..10dbbfc 100644 --- a/chrome/test/automation/automation_proxy.cc +++ b/chrome/test/automation/automation_proxy.cc @@ -519,12 +519,14 @@ bool AutomationProxy::OpenNewBrowserWindow(bool show) { TabProxy* AutomationProxy::CreateExternalTab(HWND parent, const gfx::Rect& dimensions, unsigned int style, + bool incognito, HWND* external_tab_container) { IPC::Message* response = NULL; int handle = 0; bool succeeded = Send(new AutomationMsg_CreateExternalTab(0, parent, dimensions, style, + incognito, external_tab_container, &handle)); if (!succeeded) { diff --git a/chrome/test/automation/automation_proxy.h b/chrome/test/automation/automation_proxy.h index 5c2cb22..a3a5b68 100644 --- a/chrome/test/automation/automation_proxy.h +++ b/chrome/test/automation/automation_proxy.h @@ -178,7 +178,8 @@ class AutomationProxy : public IPC::Channel::Listener, // returns a TabProxy representing the tab as well as a window handle // that can be reparented in another process. TabProxy* CreateExternalTab(HWND parent, const gfx::Rect& dimensions, - unsigned int style, HWND* external_tab_container); + unsigned int style, bool incognito, + HWND* external_tab_container); #endif // defined(OS_WIN) int command_execution_timeout_ms() const { diff --git a/chrome/test/automation/automation_proxy_uitest.cc b/chrome/test/automation/automation_proxy_uitest.cc index 0454611..5b73301 100644 --- a/chrome/test/automation/automation_proxy_uitest.cc +++ b/chrome/test/automation/automation_proxy_uitest.cc @@ -887,7 +887,7 @@ typedef CustomAutomationProxyTest<AutomationProxyForExternalTab> TEST_F(ExternalTabTestType, CreateExternalTab) { HWND external_tab_container = NULL; scoped_ptr<TabProxy> tab(automation()->CreateExternalTab(NULL, gfx::Rect(), - WS_POPUP, &external_tab_container)); + WS_POPUP, false, &external_tab_container)); EXPECT_TRUE(tab != NULL); EXPECT_NE(FALSE, ::IsWindow(external_tab_container)); if (tab != NULL) { @@ -899,13 +899,38 @@ TEST_F(ExternalTabTestType, CreateExternalTab) { } } +TEST_F(ExternalTabTestType, IncognitoMode) { + HWND external_tab_container = NULL; + GURL url(L"http://anatomyofmelancholy.net"); + std::string value_result; + + // Create incognito tab + scoped_ptr<TabProxy> tab(automation()->CreateExternalTab(NULL, gfx::Rect(), + WS_POPUP, true, &external_tab_container)); + EXPECT_TRUE(tab->SetCookie(url, "robert=burton; " + "expires=Thu, 13 Oct 2011 05:04:03 UTC;")); + EXPECT_TRUE(tab->GetCookieByName(url, "robert", &value_result)); + EXPECT_EQ("burton", value_result); + tab.reset(NULL); + CloseBrowserAndServer(); + + value_result.empty(); + clear_profile_ = false; + external_tab_container = NULL; + LaunchBrowserAndServer(); + tab.reset(automation()->CreateExternalTab(NULL, gfx::Rect(), + WS_POPUP, false, &external_tab_container)); + EXPECT_TRUE(tab->GetCookieByName(url, "robert", &value_result)); + EXPECT_EQ("", value_result); +} + TEST_F(ExternalTabTestType, ExternalTabPostMessage) { AutomationProxyForExternalTab* proxy = static_cast<AutomationProxyForExternalTab*>(automation()); HWND external_tab_container = NULL; scoped_ptr<TabProxy> tab(proxy->CreateExternalTab(NULL, gfx::Rect(), - WS_POPUP, &external_tab_container)); + WS_POPUP, false, &external_tab_container)); EXPECT_TRUE(tab != NULL); EXPECT_NE(FALSE, ::IsWindow(external_tab_container)); if (tab != NULL) { |