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

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

Issue 905823004: Added MockPresentationClient to use in layout tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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_client.h"
6
7 #include "base/logging.h"
8 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio nController.h"
9
10 namespace content {
11
12 MockPresentationClient::MockPresentationClient()
13 : controller_(nullptr),
14 screen_availability_(false) {
15 }
16
17 MockPresentationClient::~MockPresentationClient() {
18 }
19
20 void MockPresentationClient::SetScreenAvailability(bool available) {
21 if (screen_availability_ == available)
22 return;
23 screen_availability_ = available;
24
25 if (!controller_)
26 return;
27 if (!controller_->isAvailableChangeWatched())
28 return;
29 controller_->didChangeAvailability(screen_availability_);
30 }
31
32 void MockPresentationClient::setController(
33 blink::WebPresentationController* controller) {
34 DCHECK(controller_ != controller && (!controller || !controller_));
35 controller_ = controller;
36 if (controller_)
37 updateAvailableChangeWatched(controller_->isAvailableChangeWatched());
38 }
39
40 void MockPresentationClient::updateAvailableChangeWatched(bool watched) {
41 if (!watched)
42 return;
43 DCHECK(controller_);
44 if (screen_availability_)
45 controller_->didChangeAvailability(screen_availability_);
46 }
47
48 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/renderer/test_runner/mock_presentation_client.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