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

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

Issue 907893002: Retry to add MockPresentationClient to use in layout tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Split Presentation API mock into per-frame and per-view objects 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 #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
OLDNEW
« no previous file with comments | « content/shell/renderer/test_runner/mock_presentation_service.h ('k') | content/shell/renderer/test_runner/test_runner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698