summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser')
-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
3 files changed, 29 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.