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

Unified Diff: chrome/browser/sessions/tab_restore_service_browsertest.cc

Issue 9359022: Aura: Support hovering restore & close buttons for full screen apps (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added new test for tab restore Created 8 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sessions/tab_restore_service_browsertest.cc
diff --git a/chrome/browser/sessions/tab_restore_service_browsertest.cc b/chrome/browser/sessions/tab_restore_service_browsertest.cc
index 4cb97d1eec74be5a4fe94f3ba8f30ed6796e764f..4b183126d8973d7c3ca75c4e090d69317df19823 100644
--- a/chrome/browser/sessions/tab_restore_service_browsertest.cc
+++ b/chrome/browser/sessions/tab_restore_service_browsertest.cc
@@ -8,9 +8,11 @@
#include "chrome/browser/sessions/session_service.h"
#include "chrome/browser/sessions/session_types.h"
#include "chrome/browser/sessions/tab_restore_service.h"
+#include "chrome/browser/ui/browser_window.h"
#include "chrome/common/url_constants.h"
#include "chrome/test/base/chrome_render_view_host_test_harness.h"
#include "chrome/test/base/chrome_render_view_test.h"
+#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/testing_profile.h"
#include "content/browser/tab_contents/test_tab_contents.h"
#include "content/public/browser/navigation_controller.h"
@@ -20,6 +22,7 @@
#include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h"
typedef TabRestoreService::Tab Tab;
+typedef TabRestoreService::Window Window;
using content::NavigationEntry;
@@ -97,7 +100,7 @@ class TabRestoreServiceTest : public ChromeRenderViewHostTestHarness {
SessionServiceFactory::GetForProfile(profile());
SessionID tab_id;
SessionID window_id;
- session_service->SetWindowType(window_id, Browser::TYPE_TABBED);
+ session_service->SetWindowType(window_id, Browser::TYPE_TABBED, false);
session_service->SetTabWindow(window_id, tab_id);
session_service->SetTabIndexInWindow(window_id, tab_id, 0);
session_service->SetSelectedTabInWindow(window_id, 0);
@@ -108,6 +111,23 @@ class TabRestoreServiceTest : public ChromeRenderViewHostTestHarness {
session_service->UpdateTabNavigation(window_id, tab_id, 0, *entry.get());
}
+ // Adds a window with one tab and url to the profile's session service.
+ // If |pinned| is true, the tab is marked as pinned in the session service.
+ void AddApplicationWindowToSessionService() {
+ SessionService* session_service =
+ SessionServiceFactory::GetForProfile(profile());
+ SessionID tab_id;
+ SessionID window_id;
+ session_service->SetWindowType(window_id, Browser::TYPE_POPUP, true);
+ session_service->SetWindowAppName(window_id, "TestApp");
+ session_service->SetTabWindow(window_id, tab_id);
+ session_service->SetTabIndexInWindow(window_id, tab_id, 0);
+ session_service->SetSelectedTabInWindow(window_id, 0);
+ scoped_ptr<NavigationEntry> entry(NavigationEntry::Create());;
+ entry->SetURL(url1_);
+ session_service->UpdateTabNavigation(window_id, tab_id, 0, *entry.get());
+ }
+
// Creates a SessionService and assigns it to the Profile. The SessionService
// is configured with a single window with a single tab pointing at url1_ by
// way of AddWindowWithOneTabToSessionService. If |pinned| is true, the
@@ -249,6 +269,34 @@ TEST_F(TabRestoreServiceTest, RestorePinnedAndApp) {
EXPECT_TRUE(extension_app_id == tab->extension_app_id);
}
+// We only restore apps on chromeos.
+#if defined(OS_CHROMEOS)
+typedef InProcessBrowserTest TabRestoreServiceBrowserTest;
+IN_PROC_BROWSER_TEST_F(TabRestoreServiceBrowserTest, RestoreApp) {
+ Profile* profile = browser()->profile();
+ const char* app_name = "TestApp";
+
+ Browser* app_browser =
+ Browser::CreateForApp(Browser::TYPE_POPUP,
+ app_name,
+ gfx::Rect(),
+ profile);
+
+ app_browser->window()->Close();
+ TabRestoreService trs(profile);
+ // One entry should be created.
+ ASSERT_EQ(1U, trs.entries().size());
+ const TabRestoreService::Entry* restored_entry = trs.entries().front();
+
+ // It should be a window with an app.
+ ASSERT_EQ(TabRestoreService::WINDOW, restored_entry->type);
+ const Window* restored_window =
+ static_cast<const Window*>(restored_entry);
+ EXPECT_EQ(app_name, restored_window->app_name);
+
+}
+#endif
+
// Make sure we persist entries to disk that have post data.
TEST_F(TabRestoreServiceTest, DontPersistPostData) {
AddThreeNavigations();

Powered by Google App Engine
This is Rietveld 408576698