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 #ifndef CONTENT_SHELL_RENDERER_TEST_RUNNER_MOCK_PRESENTATION_SERVICE_H_ |
| 6 #define CONTENT_SHELL_RENDERER_TEST_RUNNER_MOCK_PRESENTATION_SERVICE_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "base/observer_list.h" |
| 10 #include "content/shell/renderer/test_runner/mock_presentation_client.h" |
| 11 |
| 12 namespace content { |
| 13 |
| 14 // A mock implementation of the Mojo PresentationService to be used in tests |
| 15 // with content shell. Keeps track of all MockPresentationClient instances and |
| 16 // updates each instance with the new state if needed. The service is owned by |
| 17 // the WebTextProxy instance (so only one exists per RenderView). |
| 18 class MockPresentationService { |
| 19 public: |
| 20 MockPresentationService(); |
| 21 ~MockPresentationService(); |
| 22 |
| 23 // Imitates getting the actual screen availability for the platform. |
| 24 // If the state changed from the last call, notifies the registered clients. |
| 25 void SetScreenAvailability(bool available); |
| 26 |
| 27 // Resets the service state to the defaults for the next test. |
| 28 void Reset(); |
| 29 |
| 30 // ObserverList implementation. |
| 31 void RegisterPresentationClientMock(MockPresentationClient* client); |
| 32 void UnregisterPresentationClientMock(MockPresentationClient* client); |
| 33 |
| 34 private: |
| 35 // The last known state of the screen availability, defaults to false. |
| 36 bool screen_availability_; |
| 37 // The registered presentation client mocks. |
| 38 ObserverList<MockPresentationClient> presentation_clients_; |
| 39 |
| 40 DISALLOW_COPY_AND_ASSIGN(MockPresentationService); |
| 41 }; |
| 42 |
| 43 } // namespace content |
| 44 |
| 45 #endif // CONTENT_SHELL_RENDERER_TEST_RUNNER_MOCK_PRESENTATION_SERVICE_H_ |
OLD | NEW |