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

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

Issue 11017079: Remove Shell::shelf()|status_area_widget()|launcher() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 2 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/ash/launcher/chrome_launcher_controller.h" 5 #include "chrome/browser/ui/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"
10 #include "ash/wm/window_util.h" 9 #include "ash/wm/window_util.h"
11 #include "base/command_line.h" 10 #include "base/command_line.h"
12 #include "base/utf_string_conversions.h" 11 #include "base/utf_string_conversions.h"
13 #include "chrome/browser/automation/automation_util.h" 12 #include "chrome/browser/automation/automation_util.h"
14 #include "chrome/browser/extensions/extension_apitest.h" 13 #include "chrome/browser/extensions/extension_apitest.h"
15 #include "chrome/browser/extensions/extension_browsertest.h" 14 #include "chrome/browser/extensions/extension_browsertest.h"
16 #include "chrome/browser/extensions/extension_function_test_utils.h" 15 #include "chrome/browser/extensions/extension_function_test_utils.h"
17 #include "chrome/browser/extensions/extension_service.h" 16 #include "chrome/browser/extensions/extension_service.h"
18 #include "chrome/browser/extensions/extension_test_message_listener.h" 17 #include "chrome/browser/extensions/extension_test_message_listener.h"
19 #include "chrome/browser/extensions/platform_app_browsertest_util.h" 18 #include "chrome/browser/extensions/platform_app_browsertest_util.h"
(...skipping 23 matching lines...) Expand all
43 : public extensions::PlatformAppBrowserTest { 42 : public extensions::PlatformAppBrowserTest {
44 protected: 43 protected:
45 LauncherPlatformAppBrowserTest() 44 LauncherPlatformAppBrowserTest()
46 : launcher_(NULL), 45 : launcher_(NULL),
47 controller_(NULL) { 46 controller_(NULL) {
48 } 47 }
49 48
50 virtual ~LauncherPlatformAppBrowserTest() {} 49 virtual ~LauncherPlatformAppBrowserTest() {}
51 50
52 virtual void RunTestOnMainThreadLoop() { 51 virtual void RunTestOnMainThreadLoop() {
53 launcher_ = ash::Shell::GetInstance()->launcher(); 52 launcher_ = ash::Launcher::ForPrimaryDisplay();
54 controller_ = static_cast<ChromeLauncherController*>(launcher_->delegate()); 53 controller_ = static_cast<ChromeLauncherController*>(launcher_->delegate());
55 return extensions::PlatformAppBrowserTest::RunTestOnMainThreadLoop(); 54 return extensions::PlatformAppBrowserTest::RunTestOnMainThreadLoop();
56 } 55 }
57 56
58 ash::LauncherID CreateAppShortcutLauncherItem(const std::string& name) { 57 ash::LauncherID CreateAppShortcutLauncherItem(const std::string& name) {
59 return controller_->CreateAppShortcutLauncherItem( 58 return controller_->CreateAppShortcutLauncherItem(
60 name, controller_->model()->item_count()); 59 name, controller_->model()->item_count());
61 } 60 }
62 61
63 ash::Launcher* launcher_; 62 ash::Launcher* launcher_;
64 ChromeLauncherController* controller_; 63 ChromeLauncherController* controller_;
65 }; 64 };
66 65
67 class LauncherAppBrowserTest : public ExtensionBrowserTest { 66 class LauncherAppBrowserTest : public ExtensionBrowserTest {
68 protected: 67 protected:
69 LauncherAppBrowserTest() 68 LauncherAppBrowserTest()
70 : launcher_(NULL), 69 : launcher_(NULL),
71 model_(NULL) { 70 model_(NULL) {
72 } 71 }
73 72
74 virtual ~LauncherAppBrowserTest() {} 73 virtual ~LauncherAppBrowserTest() {}
75 74
76 virtual void RunTestOnMainThreadLoop() { 75 virtual void RunTestOnMainThreadLoop() {
77 launcher_ = ash::Shell::GetInstance()->launcher(); 76 launcher_ = ash::Launcher::ForPrimaryDisplay();
78 model_ = launcher_->model(); 77 model_ = launcher_->model();
79 return ExtensionBrowserTest::RunTestOnMainThreadLoop(); 78 return ExtensionBrowserTest::RunTestOnMainThreadLoop();
80 } 79 }
81 80
82 const Extension* LoadAndLaunchExtension( 81 const Extension* LoadAndLaunchExtension(
83 const char* name, 82 const char* name,
84 extension_misc::LaunchContainer container, 83 extension_misc::LaunchContainer container,
85 WindowOpenDisposition disposition) { 84 WindowOpenDisposition disposition) {
86 EXPECT_TRUE(LoadExtension(test_data_dir_.AppendASCII(name))); 85 EXPECT_TRUE(LoadExtension(test_data_dir_.AppendASCII(name)));
87 86
(...skipping 28 matching lines...) Expand all
116 EXPECT_EQ(ash::TYPE_APP_SHORTCUT, item.type); 115 EXPECT_EQ(ash::TYPE_APP_SHORTCUT, item.type);
117 return item.id; 116 return item.id;
118 } 117 }
119 118
120 ash::Launcher* launcher_; 119 ash::Launcher* launcher_;
121 ash::LauncherModel* model_; 120 ash::LauncherModel* model_;
122 }; 121 };
123 122
124 // Test that we can launch a platform app and get a running item. 123 // Test that we can launch a platform app and get a running item.
125 IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, LaunchUnpinned) { 124 IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, LaunchUnpinned) {
126 ash::Launcher* launcher = ash::Shell::GetInstance()->launcher(); 125 ash::Launcher* launcher = ash::Launcher::ForPrimaryDisplay();
127 int item_count = launcher->model()->item_count(); 126 int item_count = launcher->model()->item_count();
128 const Extension* extension = LoadAndLaunchPlatformApp("launch"); 127 const Extension* extension = LoadAndLaunchPlatformApp("launch");
129 ShellWindow* window = CreateShellWindow(extension); 128 ShellWindow* window = CreateShellWindow(extension);
130 ++item_count; 129 ++item_count;
131 ASSERT_EQ(item_count, launcher->model()->item_count()); 130 ASSERT_EQ(item_count, launcher->model()->item_count());
132 ash::LauncherItem item = 131 ash::LauncherItem item =
133 launcher->model()->items()[launcher->model()->item_count() - 2]; 132 launcher->model()->items()[launcher->model()->item_count() - 2];
134 EXPECT_EQ(ash::TYPE_PLATFORM_APP, item.type); 133 EXPECT_EQ(ash::TYPE_PLATFORM_APP, item.type);
135 EXPECT_EQ(ash::STATUS_ACTIVE, item.status); 134 EXPECT_EQ(ash::STATUS_ACTIVE, item.status);
136 CloseShellWindow(window); 135 CloseShellWindow(window);
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after
707 706
708 // Activating app should launch new tab, because second tab isn't 707 // Activating app should launch new tab, because second tab isn't
709 // in its refocus url path. 708 // in its refocus url path.
710 launcher_->ActivateLauncherItem(model_->ItemIndexByID(shortcut_id)); 709 launcher_->ActivateLauncherItem(model_->ItemIndexByID(shortcut_id));
711 EXPECT_EQ(++tab_count, tab_strip->count()); 710 EXPECT_EQ(++tab_count, tab_strip->count());
712 TabContents* second_tab = tab_strip->GetActiveTabContents(); 711 TabContents* second_tab = tab_strip->GetActiveTabContents();
713 EXPECT_EQ(ash::STATUS_ACTIVE, model_->ItemByID(shortcut_id)->status); 712 EXPECT_EQ(ash::STATUS_ACTIVE, model_->ItemByID(shortcut_id)->status);
714 EXPECT_NE(first_tab, second_tab); 713 EXPECT_NE(first_tab, second_tab);
715 EXPECT_EQ(tab_strip->GetActiveTabContents(), second_tab); 714 EXPECT_EQ(tab_strip->GetActiveTabContents(), second_tab);
716 } 715 }
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/system/ash_system_tray_delegate.cc ('k') | chrome/browser/ui/ash/shelf_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698