Chromium Code Reviews| Index: content/shell/renderer/test_runner/mock_presentation_client.h |
| diff --git a/content/shell/renderer/test_runner/mock_presentation_client.h b/content/shell/renderer/test_runner/mock_presentation_client.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..a35c98922d7a21ee3db6a0e7a5ddc068b216961a |
| --- /dev/null |
| +++ b/content/shell/renderer/test_runner/mock_presentation_client.h |
| @@ -0,0 +1,51 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CONTENT_SHELL_RENDERER_TEST_RUNNER_MOCK_PRESENTATION_CLIENT_H_ |
| +#define CONTENT_SHELL_RENDERER_TEST_RUNNER_MOCK_PRESENTATION_CLIENT_H_ |
| + |
| +#include "base/macros.h" |
| +#include "third_party/WebKit/public/platform/modules/presentation/WebPresentationClient.h" |
| + |
| +namespace content { |
| + |
| +class MockPresentationService; |
| + |
| +// A mock implementation of WebPresentationClient to be used in tests with |
| +// content shell. One instance exists per frame, owned by the WebFrameTestProxy. |
| +// Must be registered with MockPresentationService to get the mock calls from |
| +// the test page. |
| +class MockPresentationClient : public blink::WebPresentationClient { |
| + public: |
| + explicit MockPresentationClient(MockPresentationService* service); |
| + virtual ~MockPresentationClient(); |
| + |
| + // Used to imitate the screen availability change by the tests. |
| + void SetScreenAvailability(bool available); |
| + |
| + // Resets the client test state to the defaults for the next test. |
| + void Reset(); |
| + |
| + // blink::WebPresentationClient implementation. |
| + virtual void setController(blink::WebPresentationController* controller); |
| + virtual void updateAvailableChangeWatched(bool watched); |
| + |
| + private: |
| + // The actual WebPresentationController implementation that's being tested. |
| + // Lives within the same frame as the presentation client. |
|
Peter Beverloo
2015/02/12 17:39:20
nit: "Associated with the same frame as this clien
whywhat
2015/02/12 18:40:14
Done.
|
| + blink::WebPresentationController* controller_; |
| + |
| + // The last known state of the screen availability. Defaults to false. |
| + bool screen_availability_; |
| + |
| + // The common mock service for all mock clients within the same RenderView. |
| + // Used to register/unregister itself from. |
| + MockPresentationService* service_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(MockPresentationClient); |
| +}; |
| + |
| +} // namespace content |
| + |
| +#endif // CONTENT_SHELL_RENDERER_TEST_RUNNER_MOCK_PRESENTATION_CLIENT_H_ |