summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/automation/automation_provider.cc12
-rw-r--r--chrome/browser/automation/automation_provider.h1
-rw-r--r--chrome/browser/sessions/session_restore_uitest.cc24
-rw-r--r--chrome/test/automation/automation_messages_internal.h6
-rw-r--r--chrome/test/automation/browser_proxy.cc15
-rw-r--r--chrome/test/automation/browser_proxy.h4
6 files changed, 54 insertions, 8 deletions
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc
index 468e5e1..aa35bab 100644
--- a/chrome/browser/automation/automation_provider.cc
+++ b/chrome/browser/automation/automation_provider.cc
@@ -462,6 +462,8 @@ void AutomationProvider::OnMessageReceived(const IPC::Message& message) {
InstallExtension)
IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_LoadExpandedExtension,
LoadExpandedExtension)
+ IPC_MESSAGE_HANDLER(AutomationMsg_ShutdownSessionService,
+ ShutdownSessionService)
IPC_END_MESSAGE_MAP()
}
@@ -745,6 +747,16 @@ void AutomationProvider::ClickAppModalDialogButton(int button, bool* success) {
}
}
+void AutomationProvider::ShutdownSessionService(int handle, bool* result) {
+ if (browser_tracker_->ContainsHandle(handle)) {
+ Browser* browser = browser_tracker_->GetResource(handle);
+ browser->profile()->ShutdownSessionService();
+ *result = true;
+ } else {
+ *result = false;
+ }
+}
+
void AutomationProvider::GetBrowserWindow(int index, int* handle) {
*handle = 0;
if (index >= 0) {
diff --git a/chrome/browser/automation/automation_provider.h b/chrome/browser/automation/automation_provider.h
index 5b5ac29..08df2e2 100644
--- a/chrome/browser/automation/automation_provider.h
+++ b/chrome/browser/automation/automation_provider.h
@@ -155,6 +155,7 @@ class AutomationProvider : public base::RefCounted<AutomationProvider>,
void GetNormalBrowserWindowCount(int* window_count);
void GetShowingAppModalDialog(bool* showing_dialog, int* dialog_button);
void ClickAppModalDialogButton(int button, bool* success);
+ void ShutdownSessionService(int handle, bool* result);
// Be aware that the browser window returned might be of non TYPE_NORMAL
// or in incognito mode.
void GetBrowserWindow(int index, int* handle);
diff --git a/chrome/browser/sessions/session_restore_uitest.cc b/chrome/browser/sessions/session_restore_uitest.cc
index ec4c8bc..a1eaa4a 100644
--- a/chrome/browser/sessions/session_restore_uitest.cc
+++ b/chrome/browser/sessions/session_restore_uitest.cc
@@ -86,13 +86,6 @@ class SessionRestoreUITest : public UITest {
DISALLOW_COPY_AND_ASSIGN(SessionRestoreUITest);
};
-#if defined(OS_LINUX) && defined(TOOLKIT_VIEWS)
-// This test is flaky on linux/views builds.
-// See http://crbug.com/28808.
-#define NormalAndPopup FLAKY_NormalAndPopup
-#endif
-
-
TEST_F(SessionRestoreUITest, Basic) {
NavigateToURL(url1_);
NavigateToURL(url2_);
@@ -279,6 +272,22 @@ TEST_F(SessionRestoreUITest, NormalAndPopup) {
ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count));
ASSERT_EQ(2, window_count);
+ scoped_refptr<BrowserProxy> popup(automation()->GetBrowserWindow(1));
+ ASSERT_TRUE(popup.get());
+
+ scoped_refptr<TabProxy> tab(popup->GetTab(0));
+ ASSERT_TRUE(tab.get());
+
+ tab->NavigateToURL(url1_);
+
+ // Simulate an exit by shuting down the session service. If we don't do this
+ // the first window close is treated as though the user closed the window
+ // and won't be restored.
+ ASSERT_TRUE(popup->ShutdownSessionService());
+
+ tab = NULL;
+ popup = NULL;
+
// Restart and make sure we have only one window with one tab and the url
// is url1_.
QuitBrowserAndRestore(1);
@@ -308,7 +317,6 @@ TEST_F(SessionRestoreUITest, NormalAndPopup) {
}
}
-
#if defined(OS_WIN)
// Creates a browser, goes incognito, closes browser, launches and make sure
// we don't restore.
diff --git a/chrome/test/automation/automation_messages_internal.h b/chrome/test/automation/automation_messages_internal.h
index b90280b..2103646 100644
--- a/chrome/test/automation/automation_messages_internal.h
+++ b/chrome/test/automation/automation_messages_internal.h
@@ -1183,4 +1183,10 @@ IPC_BEGIN_MESSAGES(Automation)
int /* tab_handle */,
int /* request_id */)
+ // Shuts down the session service for the browser identified by
+ // |browser_handle|. On success |result| is set to true.
+ IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_ShutdownSessionService,
+ int /* browser_handle */,
+ bool /* result */)
+
IPC_END_MESSAGES(Automation)
diff --git a/chrome/test/automation/browser_proxy.cc b/chrome/test/automation/browser_proxy.cc
index 7da15e2..7ecb9d9 100644
--- a/chrome/test/automation/browser_proxy.cc
+++ b/chrome/test/automation/browser_proxy.cc
@@ -477,3 +477,18 @@ bool BrowserProxy::IsFullscreenBubbleVisible(bool* is_visible) {
return sender_->Send(new AutomationMsg_IsFullscreenBubbleVisible(0, handle_,
is_visible));
}
+
+bool BrowserProxy::ShutdownSessionService() {
+ bool did_shutdown = false;
+ bool succeeded = sender_->Send(
+ new AutomationMsg_ShutdownSessionService(0, handle_, &did_shutdown));
+
+ if (!succeeded) {
+ DLOG(ERROR) <<
+ "ShutdownSessionService did not complete in a timely fashion";
+ return false;
+ }
+
+ return did_shutdown;
+}
+
diff --git a/chrome/test/automation/browser_proxy.h b/chrome/test/automation/browser_proxy.h
index 88a1d58..76de8f0 100644
--- a/chrome/test/automation/browser_proxy.h
+++ b/chrome/test/automation/browser_proxy.h
@@ -211,6 +211,10 @@ class BrowserProxy : public AutomationResourceProxy {
// Sets |is_visible| to whether the browser's fullscreen bubble is visible.
bool IsFullscreenBubbleVisible(bool* is_visible);
+ // Shuts down the session service for the browser's profile. Returns true
+ // on success.
+ bool ShutdownSessionService();
+
protected:
virtual ~BrowserProxy() {}
private: