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

Unified Diff: chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc

Issue 23708028: Reduce calling count of UpdateAppState() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 3 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
« no previous file with comments | « chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc
diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc
index 1ef7aafa9ee4a8269f1b928bb2096d51aeff3d21..d7fa4c49bbe79d90bb78323b83b72e82ced94ad5 100644
--- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc
+++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc
@@ -1026,6 +1026,49 @@ IN_PROC_BROWSER_TEST_F(LauncherAppBrowserTest, Navigation) {
EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut_id)).status);
}
+// Confirm that a tab can be moved between browsers while maintaining the
+// correct running state.
+IN_PROC_BROWSER_TEST_F(LauncherAppBrowserTest, TabDragAndDrop) {
+ TabStripModel* tab_strip_model1 = browser()->tab_strip_model();
+ EXPECT_EQ(1, tab_strip_model1->count());
+ int browser_index = ash::GetBrowserItemIndex(*model_);
+ EXPECT_TRUE(browser_index >= 0);
+ EXPECT_EQ(1u, chrome::GetTotalBrowserCount());
+
+ // Create a shortcut for app1.
+ ash::LauncherID shortcut_id = CreateShortcut("app1");
+ EXPECT_EQ(ash::STATUS_ACTIVE, model_->items()[browser_index].status);
+ EXPECT_EQ(ash::STATUS_CLOSED, (*model_->ItemByID(shortcut_id)).status);
+
+ // Activate app1 and check its item status.
+ ActivateLauncherItem(model_->ItemIndexByID(shortcut_id));
+ EXPECT_EQ(2, tab_strip_model1->count());
+ EXPECT_EQ(ash::STATUS_RUNNING, model_->items()[browser_index].status);
+ EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut_id)).status);
+
+ // Create a new browser with blank tab.
+ Browser* browser2 = CreateBrowser(profile());
+ EXPECT_EQ(2u, chrome::GetTotalBrowserCount());
+ TabStripModel* tab_strip_model2 = browser2->tab_strip_model();
+ EXPECT_EQ(1, tab_strip_model2->count());
+ EXPECT_EQ(ash::STATUS_ACTIVE, model_->items()[browser_index].status);
+ EXPECT_EQ(ash::STATUS_RUNNING, (*model_->ItemByID(shortcut_id)).status);
+
+ // Detach a tab at index 1 (app1) from |tab_strip_model1| and insert it as an
+ // active tab at index 1 to |tab_strip_model2|.
+ content::WebContents* detached_tab = tab_strip_model1->DetachWebContentsAt(1);
+ tab_strip_model2->InsertWebContentsAt(1,
+ detached_tab,
+ TabStripModel::ADD_ACTIVE);
+ EXPECT_EQ(1, tab_strip_model1->count());
+ EXPECT_EQ(2, tab_strip_model2->count());
+ EXPECT_EQ(ash::STATUS_RUNNING, model_->items()[browser_index].status);
+ EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut_id)).status);
+
+ tab_strip_model1->CloseAllTabs();
+ tab_strip_model2->CloseAllTabs();
+}
+
IN_PROC_BROWSER_TEST_F(LauncherAppBrowserTest, MultipleOwnedTabs) {
TabStripModel* tab_strip = browser()->tab_strip_model();
int tab_count = tab_strip->count();
« no previous file with comments | « chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698