Chromium Code Reviews| 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 DCHECK(!screen_availability_ && !presentation_clients_.might_have_observers()) | |
|
Peter Beverloo
2015/02/12 17:39:20
Was this DCHECK hitting because of screen_availabi
whywhat
2015/02/12 18:40:13
Having clients. Some added logging showed that at
| |
| 17 << "Reset() is not called before destroying the mock service."; | |
| 18 } | |
| 19 | |
| 20 void MockPresentationService::SetScreenAvailability(bool available) { | |
| 21 if (screen_availability_ == available) | |
| 22 return; | |
| 23 screen_availability_ = available; | |
| 24 | |
| 25 FOR_EACH_OBSERVER( | |
| 26 MockPresentationClient, | |
| 27 presentation_clients_, | |
| 28 SetScreenAvailability(available)); | |
| 29 } | |
| 30 | |
| 31 void MockPresentationService::Reset() { | |
| 32 FOR_EACH_OBSERVER(MockPresentationClient, presentation_clients_, Reset()); | |
| 33 presentation_clients_.Clear(); | |
| 34 screen_availability_ = false; | |
| 35 } | |
| 36 | |
| 37 void MockPresentationService::RegisterPresentationClientMock( | |
| 38 MockPresentationClient* client) { | |
| 39 DCHECK(client); | |
| 40 presentation_clients_.AddObserver(client); | |
| 41 } | |
| 42 | |
| 43 void MockPresentationService::UnregisterPresentationClientMock( | |
| 44 MockPresentationClient* client) { | |
| 45 DCHECK(client); | |
| 46 presentation_clients_.RemoveObserver(client); | |
| 47 } | |
| 48 | |
| 49 } // namespace content | |
| OLD | NEW |