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

Side by Side Diff: chrome/browser/ui/views/ash/launcher/chrome_launcher_controller_browsertest.cc

Issue 10807047: Create content\public\test\test_utils.h to hold common test classes that are used by unit and brows… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/views/ash/launcher/chrome_launcher_controller.h" 5 #include "chrome/browser/ui/views/ash/launcher/chrome_launcher_controller.h"
6 6
7 #include "ash/launcher/launcher.h" 7 #include "ash/launcher/launcher.h"
8 #include "ash/launcher/launcher_model.h" 8 #include "ash/launcher/launcher_model.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/wm/window_util.h" 10 #include "ash/wm/window_util.h"
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 // Test that we can launch an app with a shortcut. 427 // Test that we can launch an app with a shortcut.
428 IN_PROC_BROWSER_TEST_F(LauncherAppBrowserTest, LaunchPinned) { 428 IN_PROC_BROWSER_TEST_F(LauncherAppBrowserTest, LaunchPinned) {
429 TabStripModel* tab_strip = browser()->tab_strip_model(); 429 TabStripModel* tab_strip = browser()->tab_strip_model();
430 int tab_count = tab_strip->count(); 430 int tab_count = tab_strip->count();
431 ash::LauncherID shortcut_id = CreateShortcut("app1"); 431 ash::LauncherID shortcut_id = CreateShortcut("app1");
432 EXPECT_EQ(ash::STATUS_CLOSED, (*model_->ItemByID(shortcut_id)).status); 432 EXPECT_EQ(ash::STATUS_CLOSED, (*model_->ItemByID(shortcut_id)).status);
433 launcher_->ActivateLauncherItem(model_->ItemIndexByID(shortcut_id)); 433 launcher_->ActivateLauncherItem(model_->ItemIndexByID(shortcut_id));
434 EXPECT_EQ(++tab_count, tab_strip->count()); 434 EXPECT_EQ(++tab_count, tab_strip->count());
435 EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut_id)).status); 435 EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut_id)).status);
436 TabContents* tab = tab_strip->GetActiveTabContents(); 436 TabContents* tab = tab_strip->GetActiveTabContents();
437 ui_test_utils::WindowedNotificationObserver close_observer( 437 content::WindowedNotificationObserver close_observer(
438 chrome::NOTIFICATION_TAB_CONTENTS_DESTROYED, 438 chrome::NOTIFICATION_TAB_CONTENTS_DESTROYED,
439 content::Source<TabContents>(tab)); 439 content::Source<TabContents>(tab));
440 browser()->tab_strip_model()->CloseSelectedTabs(); 440 browser()->tab_strip_model()->CloseSelectedTabs();
441 close_observer.Wait(); 441 close_observer.Wait();
442 EXPECT_EQ(--tab_count, tab_strip->count()); 442 EXPECT_EQ(--tab_count, tab_strip->count());
443 EXPECT_EQ(ash::STATUS_CLOSED, (*model_->ItemByID(shortcut_id)).status); 443 EXPECT_EQ(ash::STATUS_CLOSED, (*model_->ItemByID(shortcut_id)).status);
444 } 444 }
445 445
446 // Launch the app first and then create the shortcut. 446 // Launch the app first and then create the shortcut.
447 IN_PROC_BROWSER_TEST_F(LauncherAppBrowserTest, LaunchUnpinned) { 447 IN_PROC_BROWSER_TEST_F(LauncherAppBrowserTest, LaunchUnpinned) {
448 TabStripModel* tab_strip = browser()->tab_strip_model(); 448 TabStripModel* tab_strip = browser()->tab_strip_model();
449 int tab_count = tab_strip->count(); 449 int tab_count = tab_strip->count();
450 LoadAndLaunchExtension("app1", extension_misc::LAUNCH_TAB, 450 LoadAndLaunchExtension("app1", extension_misc::LAUNCH_TAB,
451 NEW_FOREGROUND_TAB); 451 NEW_FOREGROUND_TAB);
452 EXPECT_EQ(++tab_count, tab_strip->count()); 452 EXPECT_EQ(++tab_count, tab_strip->count());
453 ash::LauncherID shortcut_id = CreateShortcut("app1"); 453 ash::LauncherID shortcut_id = CreateShortcut("app1");
454 EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut_id)).status); 454 EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut_id)).status);
455 TabContents* tab = tab_strip->GetActiveTabContents(); 455 TabContents* tab = tab_strip->GetActiveTabContents();
456 ui_test_utils::WindowedNotificationObserver close_observer( 456 content::WindowedNotificationObserver close_observer(
457 chrome::NOTIFICATION_TAB_CONTENTS_DESTROYED, 457 chrome::NOTIFICATION_TAB_CONTENTS_DESTROYED,
458 content::Source<TabContents>(tab)); 458 content::Source<TabContents>(tab));
459 browser()->tab_strip_model()->CloseSelectedTabs(); 459 browser()->tab_strip_model()->CloseSelectedTabs();
460 close_observer.Wait(); 460 close_observer.Wait();
461 EXPECT_EQ(--tab_count, tab_strip->count()); 461 EXPECT_EQ(--tab_count, tab_strip->count());
462 EXPECT_EQ(ash::STATUS_CLOSED, (*model_->ItemByID(shortcut_id)).status); 462 EXPECT_EQ(ash::STATUS_CLOSED, (*model_->ItemByID(shortcut_id)).status);
463 } 463 }
464 464
465 // Launches an app in the background and then tries to open it. This is test for 465 // Launches an app in the background and then tries to open it. This is test for
466 // a crash we had. 466 // a crash we had.
467 IN_PROC_BROWSER_TEST_F(LauncherAppBrowserTest, LaunchInBackground) { 467 IN_PROC_BROWSER_TEST_F(LauncherAppBrowserTest, LaunchInBackground) {
468 TabStripModel* tab_strip = browser()->tab_strip_model(); 468 TabStripModel* tab_strip = browser()->tab_strip_model();
469 int tab_count = tab_strip->count(); 469 int tab_count = tab_strip->count();
470 LoadAndLaunchExtension("app1", extension_misc::LAUNCH_TAB, 470 LoadAndLaunchExtension("app1", extension_misc::LAUNCH_TAB,
471 NEW_BACKGROUND_TAB); 471 NEW_BACKGROUND_TAB);
472 EXPECT_EQ(++tab_count, tab_strip->count()); 472 EXPECT_EQ(++tab_count, tab_strip->count());
473 ChromeLauncherController::instance()->OpenAppID(last_loaded_extension_id_, 0); 473 ChromeLauncherController::instance()->OpenAppID(last_loaded_extension_id_, 0);
474 } 474 }
475 475
476 // Confirm that clicking a icon for an app running in one of 2 maxmized windows 476 // Confirm that clicking a icon for an app running in one of 2 maxmized windows
477 // activates the right window. 477 // activates the right window.
478 IN_PROC_BROWSER_TEST_F(LauncherAppBrowserTest, LaunchMaximized) { 478 IN_PROC_BROWSER_TEST_F(LauncherAppBrowserTest, LaunchMaximized) {
479 aura::Window* window1 = browser()->window()->GetNativeWindow(); 479 aura::Window* window1 = browser()->window()->GetNativeWindow();
480 ash::wm::MaximizeWindow(window1); 480 ash::wm::MaximizeWindow(window1);
481 ui_test_utils::WindowedNotificationObserver open_observer( 481 content::WindowedNotificationObserver open_observer(
482 chrome::NOTIFICATION_BROWSER_WINDOW_READY, 482 chrome::NOTIFICATION_BROWSER_WINDOW_READY,
483 content::NotificationService::AllSources()); 483 content::NotificationService::AllSources());
484 chrome::NewEmptyWindow(browser()->profile()); 484 chrome::NewEmptyWindow(browser()->profile());
485 open_observer.Wait(); 485 open_observer.Wait();
486 Browser* browser2 = content::Source<Browser>(open_observer.source()).ptr(); 486 Browser* browser2 = content::Source<Browser>(open_observer.source()).ptr();
487 aura::Window* window2 = browser2->window()->GetNativeWindow(); 487 aura::Window* window2 = browser2->window()->GetNativeWindow();
488 TabStripModel* tab_strip = browser2->tab_strip_model(); 488 TabStripModel* tab_strip = browser2->tab_strip_model();
489 int tab_count = tab_strip->count(); 489 int tab_count = tab_strip->count();
490 ash::wm::MaximizeWindow(window2); 490 ash::wm::MaximizeWindow(window2);
491 491
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 // Navigate away. 583 // Navigate away.
584 ui_test_utils::NavigateToURL( 584 ui_test_utils::NavigateToURL(
585 browser(), GURL("http://www.example.com/path0/bar.html")); 585 browser(), GURL("http://www.example.com/path0/bar.html"));
586 EXPECT_EQ(ash::STATUS_CLOSED, (*model_->ItemByID(shortcut_id)).status); 586 EXPECT_EQ(ash::STATUS_CLOSED, (*model_->ItemByID(shortcut_id)).status);
587 587
588 // Navigate back. 588 // Navigate back.
589 ui_test_utils::NavigateToURL( 589 ui_test_utils::NavigateToURL(
590 browser(), GURL("http://www.example.com/path1/foo.html")); 590 browser(), GURL("http://www.example.com/path1/foo.html"));
591 EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut_id)).status); 591 EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut_id)).status);
592 } 592 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/pdf/pdf_browsertest.cc ('k') | chrome/browser/ui/views/browser_actions_container_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698