| 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 "content/shell/renderer/test_runner/mock_presentation_service.h" | |
| 6 | |
| 7 #include "base/logging.h" | |
| 8 | |
| 9 namespace content { | |
| 10 | |
| 11 MockPresentationService::MockPresentationService() | |
| 12 : screen_availability_(false) { | |
| 13 } | |
| 14 | |
| 15 MockPresentationService::~MockPresentationService() { | |
| 16 Reset(); | |
| 17 } | |
| 18 | |
| 19 void MockPresentationService::SetScreenAvailability(bool available) { | |
| 20 if (screen_availability_ == available) | |
| 21 return; | |
| 22 screen_availability_ = available; | |
| 23 | |
| 24 FOR_EACH_OBSERVER( | |
| 25 MockPresentationClient, | |
| 26 presentation_clients_, | |
| 27 SetScreenAvailability(available)); | |
| 28 } | |
| 29 | |
| 30 void MockPresentationService::Reset() { | |
| 31 FOR_EACH_OBSERVER(MockPresentationClient, presentation_clients_, Reset()); | |
| 32 presentation_clients_.Clear(); | |
| 33 screen_availability_ = false; | |
| 34 } | |
| 35 | |
| 36 void MockPresentationService::RegisterPresentationClientMock( | |
| 37 MockPresentationClient* client) { | |
| 38 DCHECK(client); | |
| 39 presentation_clients_.AddObserver(client); | |
| 40 } | |
| 41 | |
| 42 void MockPresentationService::UnregisterPresentationClientMock( | |
| 43 MockPresentationClient* client) { | |
| 44 DCHECK(client); | |
| 45 presentation_clients_.RemoveObserver(client); | |
| 46 } | |
| 47 | |
| 48 } // namespace content | |
| OLD | NEW |