| 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/app_window_registry.h" | 5 #include "apps/app_window_registry.h" |
| 6 #include "base/basictypes.h" | 6 #include "base/basictypes.h" |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| 11 #include "chrome/browser/chrome_notification_types.h" | 11 #include "chrome/browser/chrome_notification_types.h" |
| 12 #include "chrome/browser/chromeos/login/demo_mode/demo_app_launcher.h" | 12 #include "chrome/browser/chromeos/login/demo_mode/demo_app_launcher.h" |
| 13 #include "chrome/browser/chromeos/login/test/app_window_waiter.h" | 13 #include "chrome/browser/chromeos/login/test/app_window_waiter.h" |
| 14 #include "chrome/browser/chromeos/login/users/user_manager.h" | |
| 15 #include "chrome/browser/extensions/extension_browsertest.h" | 14 #include "chrome/browser/extensions/extension_browsertest.h" |
| 16 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
| 17 #include "chrome/browser/profiles/profile_manager.h" | 16 #include "chrome/browser/profiles/profile_manager.h" |
| 18 #include "chrome/common/chrome_paths.h" | 17 #include "chrome/common/chrome_paths.h" |
| 19 #include "chromeos/chromeos_switches.h" | 18 #include "chromeos/chromeos_switches.h" |
| 20 #include "chromeos/network/network_state.h" | 19 #include "chromeos/network/network_state.h" |
| 21 #include "chromeos/network/network_state_handler.h" | 20 #include "chromeos/network/network_state_handler.h" |
| 21 #include "components/user_manager/user_manager.h" |
| 22 #include "content/public/browser/notification_service.h" | 22 #include "content/public/browser/notification_service.h" |
| 23 #include "content/public/browser/notification_source.h" | 23 #include "content/public/browser/notification_source.h" |
| 24 #include "content/public/test/test_utils.h" | 24 #include "content/public/test/test_utils.h" |
| 25 #include "testing/gtest/include/gtest/gtest.h" | 25 #include "testing/gtest/include/gtest/gtest.h" |
| 26 | 26 |
| 27 namespace chromeos { | 27 namespace chromeos { |
| 28 | 28 |
| 29 namespace { | 29 namespace { |
| 30 | 30 |
| 31 base::FilePath GetTestDemoAppPath() { | 31 base::FilePath GetTestDemoAppPath() { |
| 32 base::FilePath test_data_dir; | 32 base::FilePath test_data_dir; |
| 33 EXPECT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir)); | 33 EXPECT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir)); |
| 34 return test_data_dir.Append(FILE_PATH_LITERAL("chromeos/demo_app")); | 34 return test_data_dir.Append(FILE_PATH_LITERAL("chromeos/demo_app")); |
| 35 } | 35 } |
| 36 | 36 |
| 37 Profile* WaitForProfile() { | 37 Profile* WaitForProfile() { |
| 38 chromeos::UserManager* user_manager = chromeos::UserManager::Get(); | 38 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); |
| 39 if (!user_manager || !user_manager->IsUserLoggedIn()) { | 39 if (!user_manager || !user_manager->IsUserLoggedIn()) { |
| 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() { |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 // did launch. | 92 // did launch. |
| 93 EXPECT_TRUE(VerifyDemoAppLaunch()); | 93 EXPECT_TRUE(VerifyDemoAppLaunch()); |
| 94 } | 94 } |
| 95 | 95 |
| 96 IN_PROC_BROWSER_TEST_F(DemoAppLauncherTest, NoNetwork) { | 96 IN_PROC_BROWSER_TEST_F(DemoAppLauncherTest, NoNetwork) { |
| 97 EXPECT_TRUE(VerifyDemoAppLaunch()); | 97 EXPECT_TRUE(VerifyDemoAppLaunch()); |
| 98 EXPECT_TRUE(VerifyNetworksDisabled()); | 98 EXPECT_TRUE(VerifyNetworksDisabled()); |
| 99 } | 99 } |
| 100 | 100 |
| 101 } // namespace chromeos | 101 } // namespace chromeos |
| OLD | NEW |