OLD | NEW |
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/ash_switches.h" | |
8 #include "ash/launcher/launcher.h" | 7 #include "ash/launcher/launcher.h" |
9 #include "ash/launcher/launcher_model.h" | 8 #include "ash/launcher/launcher_model.h" |
10 #include "ash/launcher/launcher_util.h" | 9 #include "ash/launcher/launcher_util.h" |
11 #include "ash/shell.h" | 10 #include "ash/shell.h" |
12 #include "ash/test/shell_test_api.h" | 11 #include "ash/test/shell_test_api.h" |
13 #include "ash/wm/window_util.h" | 12 #include "ash/wm/window_util.h" |
14 #include "base/command_line.h" | |
15 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
16 #include "chrome/browser/automation/automation_util.h" | 14 #include "chrome/browser/automation/automation_util.h" |
17 #include "chrome/browser/extensions/extension_apitest.h" | 15 #include "chrome/browser/extensions/extension_apitest.h" |
18 #include "chrome/browser/extensions/extension_browsertest.h" | 16 #include "chrome/browser/extensions/extension_browsertest.h" |
19 #include "chrome/browser/extensions/extension_function_test_utils.h" | 17 #include "chrome/browser/extensions/extension_function_test_utils.h" |
20 #include "chrome/browser/extensions/extension_service.h" | 18 #include "chrome/browser/extensions/extension_service.h" |
21 #include "chrome/browser/extensions/extension_system.h" | 19 #include "chrome/browser/extensions/extension_system.h" |
22 #include "chrome/browser/extensions/extension_test_message_listener.h" | 20 #include "chrome/browser/extensions/extension_test_message_listener.h" |
23 #include "chrome/browser/extensions/platform_app_browsertest_util.h" | 21 #include "chrome/browser/extensions/platform_app_browsertest_util.h" |
24 #include "chrome/browser/extensions/shell_window_registry.h" | 22 #include "chrome/browser/extensions/shell_window_registry.h" |
(...skipping 24 matching lines...) Expand all Loading... |
49 class LauncherPlatformPerAppAppBrowserTest | 47 class LauncherPlatformPerAppAppBrowserTest |
50 : public extensions::PlatformAppBrowserTest { | 48 : public extensions::PlatformAppBrowserTest { |
51 protected: | 49 protected: |
52 LauncherPlatformPerAppAppBrowserTest() | 50 LauncherPlatformPerAppAppBrowserTest() |
53 : launcher_(NULL), | 51 : launcher_(NULL), |
54 controller_(NULL) { | 52 controller_(NULL) { |
55 } | 53 } |
56 | 54 |
57 virtual ~LauncherPlatformPerAppAppBrowserTest() {} | 55 virtual ~LauncherPlatformPerAppAppBrowserTest() {} |
58 | 56 |
59 // TODO(skuhne): Remove when the old launcher gets removed. | |
60 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | |
61 PlatformAppBrowserTest::SetUpCommandLine(command_line); | |
62 command_line->AppendSwitch(ash::switches::kAshEnablePerAppLauncher); | |
63 } | |
64 | |
65 ash::LauncherModel* launcher_model() { | 57 ash::LauncherModel* launcher_model() { |
66 return ash::test::ShellTestApi(ash::Shell::GetInstance()).launcher_model(); | 58 return ash::test::ShellTestApi(ash::Shell::GetInstance()).launcher_model(); |
67 } | 59 } |
68 | 60 |
69 virtual void RunTestOnMainThreadLoop() OVERRIDE { | 61 virtual void RunTestOnMainThreadLoop() OVERRIDE { |
70 launcher_ = ash::Launcher::ForPrimaryDisplay(); | 62 launcher_ = ash::Launcher::ForPrimaryDisplay(); |
71 controller_ = static_cast<ChromeLauncherController*>(launcher_->delegate()); | 63 controller_ = static_cast<ChromeLauncherController*>(launcher_->delegate()); |
72 return extensions::PlatformAppBrowserTest::RunTestOnMainThreadLoop(); | 64 return extensions::PlatformAppBrowserTest::RunTestOnMainThreadLoop(); |
73 } | 65 } |
74 | 66 |
(...skipping 14 matching lines...) Expand all Loading... |
89 // old launcher gets ripped out. | 81 // old launcher gets ripped out. |
90 class LauncherPerAppAppBrowserTest : public ExtensionBrowserTest { | 82 class LauncherPerAppAppBrowserTest : public ExtensionBrowserTest { |
91 protected: | 83 protected: |
92 LauncherPerAppAppBrowserTest() | 84 LauncherPerAppAppBrowserTest() |
93 : launcher_(NULL), | 85 : launcher_(NULL), |
94 model_(NULL) { | 86 model_(NULL) { |
95 } | 87 } |
96 | 88 |
97 virtual ~LauncherPerAppAppBrowserTest() {} | 89 virtual ~LauncherPerAppAppBrowserTest() {} |
98 | 90 |
99 // TODO(skuhne): Remove when the old launcher gets removed. | |
100 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | |
101 ExtensionBrowserTest::SetUpCommandLine(command_line); | |
102 command_line->AppendSwitch(ash::switches::kAshEnablePerAppLauncher); | |
103 } | |
104 | |
105 virtual void RunTestOnMainThreadLoop() OVERRIDE { | 91 virtual void RunTestOnMainThreadLoop() OVERRIDE { |
106 launcher_ = ash::Launcher::ForPrimaryDisplay(); | 92 launcher_ = ash::Launcher::ForPrimaryDisplay(); |
107 model_ = | 93 model_ = |
108 ash::test::ShellTestApi(ash::Shell::GetInstance()).launcher_model(); | 94 ash::test::ShellTestApi(ash::Shell::GetInstance()).launcher_model(); |
109 return ExtensionBrowserTest::RunTestOnMainThreadLoop(); | 95 return ExtensionBrowserTest::RunTestOnMainThreadLoop(); |
110 } | 96 } |
111 | 97 |
112 size_t NumberOfDetectedLauncherBrowsers() { | 98 size_t NumberOfDetectedLauncherBrowsers() { |
113 ChromeLauncherControllerPerApp* controller = | 99 ChromeLauncherControllerPerApp* controller = |
114 static_cast<ChromeLauncherControllerPerApp*>(launcher_->delegate()); | 100 static_cast<ChromeLauncherControllerPerApp*>(launcher_->delegate()); |
(...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
882 EXPECT_EQ(++running_browser, BrowserList::size()); | 868 EXPECT_EQ(++running_browser, BrowserList::size()); |
883 | 869 |
884 LoadAndLaunchExtension("app1", extension_misc::LAUNCH_TAB, NEW_WINDOW); | 870 LoadAndLaunchExtension("app1", extension_misc::LAUNCH_TAB, NEW_WINDOW); |
885 | 871 |
886 // A new browser should get detected and one more should be running. | 872 // A new browser should get detected and one more should be running. |
887 EXPECT_GE(NumberOfDetectedLauncherBrowsers(), 1u); | 873 EXPECT_GE(NumberOfDetectedLauncherBrowsers(), 1u); |
888 EXPECT_EQ(++running_browser, BrowserList::size()); | 874 EXPECT_EQ(++running_browser, BrowserList::size()); |
889 } | 875 } |
890 | 876 |
891 | 877 |
OLD | NEW |