OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "apps/test/app_window_waiter.h" |
5 #include "base/command_line.h" | 6 #include "base/command_line.h" |
6 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
7 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
8 #include "base/macros.h" | 9 #include "base/macros.h" |
9 #include "base/path_service.h" | 10 #include "base/path_service.h" |
10 #include "chrome/browser/chrome_notification_types.h" | 11 #include "chrome/browser/chrome_notification_types.h" |
11 #include "chrome/browser/chromeos/login/demo_mode/demo_app_launcher.h" | 12 #include "chrome/browser/chromeos/login/demo_mode/demo_app_launcher.h" |
12 #include "chrome/browser/chromeos/login/test/app_window_waiter.h" | |
13 #include "chrome/browser/extensions/extension_browsertest.h" | 13 #include "chrome/browser/extensions/extension_browsertest.h" |
14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
15 #include "chrome/browser/profiles/profile_manager.h" | 15 #include "chrome/browser/profiles/profile_manager.h" |
16 #include "chrome/common/chrome_paths.h" | 16 #include "chrome/common/chrome_paths.h" |
17 #include "chromeos/chromeos_switches.h" | 17 #include "chromeos/chromeos_switches.h" |
18 #include "chromeos/network/network_state.h" | 18 #include "chromeos/network/network_state.h" |
19 #include "chromeos/network/network_state_handler.h" | 19 #include "chromeos/network/network_state_handler.h" |
20 #include "components/user_manager/user_manager.h" | 20 #include "components/user_manager/user_manager.h" |
21 #include "content/public/browser/notification_service.h" | 21 #include "content/public/browser/notification_service.h" |
22 #include "content/public/browser/notification_source.h" | 22 #include "content/public/browser/notification_source.h" |
(...skipping 17 matching lines...) Expand all Loading... |
40 content::WindowedNotificationObserver( | 40 content::WindowedNotificationObserver( |
41 chrome::NOTIFICATION_SESSION_STARTED, | 41 chrome::NOTIFICATION_SESSION_STARTED, |
42 content::NotificationService::AllSources()).Wait(); | 42 content::NotificationService::AllSources()).Wait(); |
43 } | 43 } |
44 | 44 |
45 return ProfileManager::GetActiveUserProfile(); | 45 return ProfileManager::GetActiveUserProfile(); |
46 } | 46 } |
47 | 47 |
48 bool VerifyDemoAppLaunch() { | 48 bool VerifyDemoAppLaunch() { |
49 Profile* profile = WaitForProfile(); | 49 Profile* profile = WaitForProfile(); |
50 return AppWindowWaiter(extensions::AppWindowRegistry::Get(profile), | 50 return apps::AppWindowWaiter(extensions::AppWindowRegistry::Get(profile), |
51 DemoAppLauncher::kDemoAppId).Wait() != NULL; | 51 DemoAppLauncher::kDemoAppId) |
| 52 .Wait() != NULL; |
52 } | 53 } |
53 | 54 |
54 bool VerifyNetworksDisabled() { | 55 bool VerifyNetworksDisabled() { |
55 NetworkStateHandler* handler = NetworkHandler::Get()->network_state_handler(); | 56 NetworkStateHandler* handler = NetworkHandler::Get()->network_state_handler(); |
56 return !handler->FirstNetworkByType(NetworkTypePattern::NonVirtual()); | 57 return !handler->FirstNetworkByType(NetworkTypePattern::NonVirtual()); |
57 } | 58 } |
58 | 59 |
59 } // namespace | 60 } // namespace |
60 | 61 |
61 class DemoAppLauncherTest : public ExtensionBrowserTest { | 62 class DemoAppLauncherTest : public ExtensionBrowserTest { |
(...skipping 30 matching lines...) Expand all Loading... |
92 // did launch. | 93 // did launch. |
93 EXPECT_TRUE(VerifyDemoAppLaunch()); | 94 EXPECT_TRUE(VerifyDemoAppLaunch()); |
94 } | 95 } |
95 | 96 |
96 IN_PROC_BROWSER_TEST_F(DemoAppLauncherTest, NoNetwork) { | 97 IN_PROC_BROWSER_TEST_F(DemoAppLauncherTest, NoNetwork) { |
97 EXPECT_TRUE(VerifyDemoAppLaunch()); | 98 EXPECT_TRUE(VerifyDemoAppLaunch()); |
98 EXPECT_TRUE(VerifyNetworksDisabled()); | 99 EXPECT_TRUE(VerifyNetworksDisabled()); |
99 } | 100 } |
100 | 101 |
101 } // namespace chromeos | 102 } // namespace chromeos |
OLD | NEW |