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). Each | |
18 // MockPresentationClient is owned by WebFrameTextProxy (so one exists per each | |
Peter Beverloo
2015/02/12 17:39:20
You're repeating lifetime constraints of both Mock
whywhat
2015/02/12 18:40:14
Done.
MockPresentationClient doesn't say anything
| |
19 // RenderFrame, same as the real PresentationDispatcher) and is registered with | |
20 // the MockPresentationService by the WebFrameTestProxy upon creation. | |
21 class MockPresentationService { | |
22 public: | |
23 MockPresentationService(); | |
24 virtual ~MockPresentationService(); | |
Peter Beverloo
2015/02/12 17:39:20
I don't think this has to be virtual.
whywhat
2015/02/12 18:40:14
Done.
| |
25 | |
26 // Imitates getting the actual screen availability for the platform. | |
27 // If the state changed from the last call, notifies the registered clients. | |
28 void SetScreenAvailability(bool available); | |
29 | |
30 // Resets the service state to the defaults for the next test. | |
31 void Reset(); | |
32 | |
33 // ObserverList implementation. | |
34 void RegisterPresentationClientMock(MockPresentationClient* client); | |
35 void UnregisterPresentationClientMock(MockPresentationClient* client); | |
36 | |
37 private: | |
38 // The last known state of the screen availability, defaults to false. | |
39 bool screen_availability_; | |
40 // The registered presentation client mocks. | |
41 ObserverList<MockPresentationClient> presentation_clients_; | |
42 | |
43 DISALLOW_COPY_AND_ASSIGN(MockPresentationService); | |
44 }; | |
45 | |
46 } // namespace content | |
47 | |
48 #endif // CONTENT_SHELL_RENDERER_TEST_RUNNER_MOCK_PRESENTATION_SERVICE_H_ | |
OLD | NEW |