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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/system/tray/system_tray.h" | 8 #include "ash/system/tray/system_tray.h" |
9 #include "ash/system/tray/system_tray_delegate.h" | 9 #include "ash/system/tray/system_tray_delegate.h" |
| 10 #include "ash/system/tray/system_tray_test_api.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 "chrome/browser/media/router/media_routes_observer.h" | 13 #include "chrome/browser/media/router/media_routes_observer.h" |
13 #include "chrome/browser/media/router/media_sinks_observer.h" | 14 #include "chrome/browser/media/router/media_sinks_observer.h" |
14 #include "chrome/browser/media/router/mock_media_router.h" | 15 #include "chrome/browser/media/router/mock_media_router.h" |
15 #include "chrome/browser/ui/ash/cast_config_client_media_router.h" | 16 #include "chrome/browser/ui/ash/cast_config_client_media_router.h" |
16 #include "chrome/common/media_router/media_source_helper.h" | 17 #include "chrome/common/media_router/media_source_helper.h" |
17 #include "chrome/test/base/in_process_browser_test.h" | 18 #include "chrome/test/base/in_process_browser_test.h" |
18 #include "content/public/test/test_utils.h" | 19 #include "content/public/test/test_utils.h" |
19 #include "url/gurl.h" | 20 #include "url/gurl.h" |
(...skipping 19 matching lines...) Expand all Loading... |
39 } | 40 } |
40 | 41 |
41 // Returns the cast tray instance. | 42 // Returns the cast tray instance. |
42 ash::TrayCast* GetTrayCast() { | 43 ash::TrayCast* GetTrayCast() { |
43 ash::SystemTray* tray = ash::Shell::Get()->GetPrimarySystemTray(); | 44 ash::SystemTray* tray = ash::Shell::Get()->GetPrimarySystemTray(); |
44 | 45 |
45 // Make sure we actually popup the tray, otherwise the TrayCast instance will | 46 // Make sure we actually popup the tray, otherwise the TrayCast instance will |
46 // not be created. | 47 // not be created. |
47 tray->ShowDefaultView(ash::BubbleCreationType::BUBBLE_CREATE_NEW); | 48 tray->ShowDefaultView(ash::BubbleCreationType::BUBBLE_CREATE_NEW); |
48 | 49 |
49 return tray->GetTrayCastForTesting(); | 50 return ash::SystemTrayTestApi(tray).tray_cast(); |
50 } | 51 } |
51 | 52 |
52 class SystemTrayTrayCastMediaRouterChromeOSTest : public InProcessBrowserTest { | 53 class SystemTrayTrayCastMediaRouterChromeOSTest : public InProcessBrowserTest { |
53 protected: | 54 protected: |
54 SystemTrayTrayCastMediaRouterChromeOSTest() : InProcessBrowserTest() {} | 55 SystemTrayTrayCastMediaRouterChromeOSTest() : InProcessBrowserTest() {} |
55 ~SystemTrayTrayCastMediaRouterChromeOSTest() override {} | 56 ~SystemTrayTrayCastMediaRouterChromeOSTest() override {} |
56 | 57 |
57 media_router::MediaSinksObserver* media_sinks_observer() const { | 58 media_router::MediaSinksObserver* media_sinks_observer() const { |
58 DCHECK(media_sinks_observer_); | 59 DCHECK(media_sinks_observer_); |
59 return media_sinks_observer_; | 60 return media_sinks_observer_; |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 EXPECT_TRUE(test_api.IsTrayCastViewVisible()); | 185 EXPECT_TRUE(test_api.IsTrayCastViewVisible()); |
185 EXPECT_EQ("local_route", test_api.GetDisplayedCastId()); | 186 EXPECT_EQ("local_route", test_api.GetDisplayedCastId()); |
186 | 187 |
187 // When a casting session stops, we shouldn't display the cast view. | 188 // When a casting session stops, we shouldn't display the cast view. |
188 test_api.OnCastingSessionStartedOrStopped(false /*is_casting*/); | 189 test_api.OnCastingSessionStartedOrStopped(false /*is_casting*/); |
189 media_routes_observer()->OnRoutesUpdated( | 190 media_routes_observer()->OnRoutesUpdated( |
190 no_routes, std::vector<media_router::MediaRoute::Id>()); | 191 no_routes, std::vector<media_router::MediaRoute::Id>()); |
191 content::RunAllPendingInMessageLoop(); | 192 content::RunAllPendingInMessageLoop(); |
192 EXPECT_FALSE(test_api.IsTrayCastViewVisible()); | 193 EXPECT_FALSE(test_api.IsTrayCastViewVisible()); |
193 } | 194 } |
OLD | NEW |