Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(863)

Side by Side Diff: content/shell/renderer/test_runner/mock_presentation_service.h

Issue 907893002: Retry to add MockPresentationClient to use in layout tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698