| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "ash/common/system/tray/system_tray_delegate.h" | 5 #include "ash/common/system/tray/system_tray_delegate.h" |
| 6 #include "ash/common/wm_shell.h" |
| 6 #include "ash/shell.h" | 7 #include "ash/shell.h" |
| 7 #include "ash/system/cast/tray_cast.h" | 8 #include "ash/system/cast/tray_cast.h" |
| 8 #include "ash/system/tray/system_tray.h" | 9 #include "ash/system/tray/system_tray.h" |
| 9 #include "ash/system/tray/system_tray_item.h" | 10 #include "ash/system/tray/system_tray_item.h" |
| 10 #include "ash/test/tray_cast_test_api.h" | 11 #include "ash/test/tray_cast_test_api.h" |
| 11 #include "base/macros.h" | 12 #include "base/macros.h" |
| 12 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
| 13 #include "chrome/browser/extensions/extension_browsertest.h" | 14 #include "chrome/browser/extensions/extension_browsertest.h" |
| 14 #include "chrome/browser/profiles/profile_manager.h" | 15 #include "chrome/browser/profiles/profile_manager.h" |
| 15 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 16 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 }; | 152 }; |
| 152 | 153 |
| 153 } // namespace | 154 } // namespace |
| 154 | 155 |
| 155 namespace chromeos { | 156 namespace chromeos { |
| 156 | 157 |
| 157 // A simple sanity check to make sure that the cast config delegate actually | 158 // A simple sanity check to make sure that the cast config delegate actually |
| 158 // recognizes the cast extension. | 159 // recognizes the cast extension. |
| 159 IN_PROC_BROWSER_TEST_F(SystemTrayTrayCastChromeOSTest, | 160 IN_PROC_BROWSER_TEST_F(SystemTrayTrayCastChromeOSTest, |
| 160 CastTraySanityCheckTestExtensionGetsRecognized) { | 161 CastTraySanityCheckTestExtensionGetsRecognized) { |
| 161 ash::CastConfigDelegate* cast_config_delegate = ash::Shell::GetInstance() | 162 ash::CastConfigDelegate* cast_config_delegate = |
| 162 ->system_tray_delegate() | 163 ash::WmShell::Get()->system_tray_delegate()->GetCastConfigDelegate(); |
| 163 ->GetCastConfigDelegate(); | |
| 164 | 164 |
| 165 EXPECT_FALSE(cast_config_delegate->HasCastExtension()); | 165 EXPECT_FALSE(cast_config_delegate->HasCastExtension()); |
| 166 const extensions::Extension* extension = LoadCastTestExtension(); | 166 const extensions::Extension* extension = LoadCastTestExtension(); |
| 167 EXPECT_TRUE(cast_config_delegate->HasCastExtension()); | 167 EXPECT_TRUE(cast_config_delegate->HasCastExtension()); |
| 168 UninstallExtension(extension->id()); | 168 UninstallExtension(extension->id()); |
| 169 } | 169 } |
| 170 | 170 |
| 171 // Verifies that the cast tray is hidden when there is no extension installed. | 171 // Verifies that the cast tray is hidden when there is no extension installed. |
| 172 IN_PROC_BROWSER_TEST_F(SystemTrayTrayCastChromeOSTest, | 172 IN_PROC_BROWSER_TEST_F(SystemTrayTrayCastChromeOSTest, |
| 173 CastTrayIsHiddenWhenThereIsNoExtension) { | 173 CastTrayIsHiddenWhenThereIsNoExtension) { |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 ExecuteJavaScript(extension, "addReceiver('test_id', 'name')"); | 276 ExecuteJavaScript(extension, "addReceiver('test_id', 'name')"); |
| 277 ash::TrayCast* tray = GetTrayCast(extension); | 277 ash::TrayCast* tray = GetTrayCast(extension); |
| 278 EXPECT_TRUE(StartCastWithVerification(extension, tray, "test_id")); | 278 EXPECT_TRUE(StartCastWithVerification(extension, tray, "test_id")); |
| 279 UninstallExtension(extension->id()); | 279 UninstallExtension(extension->id()); |
| 280 } | 280 } |
| 281 | 281 |
| 282 // Verifies that the CastConfigDelegate opens up a tab called "options.html". | 282 // Verifies that the CastConfigDelegate opens up a tab called "options.html". |
| 283 IN_PROC_BROWSER_TEST_F(SystemTrayTrayCastChromeOSTest, CastTrayOpenOptions) { | 283 IN_PROC_BROWSER_TEST_F(SystemTrayTrayCastChromeOSTest, CastTrayOpenOptions) { |
| 284 const extensions::Extension* extension = LoadCastTestExtension(); | 284 const extensions::Extension* extension = LoadCastTestExtension(); |
| 285 | 285 |
| 286 ash::CastConfigDelegate* cast_config_delegate = ash::Shell::GetInstance() | 286 ash::CastConfigDelegate* cast_config_delegate = |
| 287 ->system_tray_delegate() | 287 ash::WmShell::Get()->system_tray_delegate()->GetCastConfigDelegate(); |
| 288 ->GetCastConfigDelegate(); | |
| 289 cast_config_delegate->LaunchCastOptions(); | 288 cast_config_delegate->LaunchCastOptions(); |
| 290 | 289 |
| 291 const GURL url = | 290 const GURL url = |
| 292 browser()->tab_strip_model()->GetActiveWebContents()->GetURL(); | 291 browser()->tab_strip_model()->GetActiveWebContents()->GetURL(); |
| 293 EXPECT_TRUE(base::StringPiece(url.GetContent()).ends_with("options.html")); | 292 EXPECT_TRUE(base::StringPiece(url.GetContent()).ends_with("options.html")); |
| 294 | 293 |
| 295 UninstallExtension(extension->id()); | 294 UninstallExtension(extension->id()); |
| 296 } | 295 } |
| 297 | 296 |
| 298 } // namespace chromeos | 297 } // namespace chromeos |
| OLD | NEW |