OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "ash/test/tray_cast_test_api.h" |
| 6 |
| 7 #include "ash/system/tray/system_tray.h" |
| 8 #include "ui/views/view.h" |
| 9 |
| 10 namespace ash { |
| 11 |
| 12 TrayCastTestAPI::TrayCastTestAPI(TrayCast* tray_cast) : tray_cast_(tray_cast) {} |
| 13 |
| 14 TrayCastTestAPI::~TrayCastTestAPI() {} |
| 15 |
| 16 bool TrayCastTestAPI::IsTrayInitialized() const { |
| 17 return tray_cast_->default_ != nullptr; |
| 18 } |
| 19 |
| 20 bool TrayCastTestAPI::IsTrayVisible() const { |
| 21 return IsViewDrawn(TrayCast::TRAY_VIEW); |
| 22 } |
| 23 |
| 24 bool TrayCastTestAPI::IsTrayCastViewVisible() const { |
| 25 return IsViewDrawn(TrayCast::CAST_VIEW); |
| 26 } |
| 27 |
| 28 bool TrayCastTestAPI::IsTraySelectViewVisible() const { |
| 29 return IsViewDrawn(TrayCast::SELECT_VIEW); |
| 30 } |
| 31 |
| 32 void TrayCastTestAPI::StartCast(const std::string& receiver_id) { |
| 33 return tray_cast_->StartCastForTest(receiver_id); |
| 34 } |
| 35 |
| 36 void TrayCastTestAPI::StopCast() { |
| 37 return tray_cast_->StopCastForTest(); |
| 38 } |
| 39 |
| 40 void TrayCastTestAPI::OnCastingSessionStartedOrStopped(bool is_casting) { |
| 41 tray_cast_->OnCastingSessionStartedOrStopped(is_casting); |
| 42 } |
| 43 |
| 44 bool TrayCastTestAPI::IsViewDrawn(TrayCast::ChildViewId id) const { |
| 45 const views::View* view = tray_cast_->GetDefaultView()->GetViewByID(id); |
| 46 return view != nullptr && view->IsDrawn(); |
| 47 } |
| 48 |
| 49 } // namespace ash |
OLD | NEW |