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

Side by Side Diff: third_party/WebKit/Source/web/tests/ScreenWakeLockTest.cpp

Issue 2651583007: Plumbing blink::Interface{Provider|Registry} through WebLocalFrame's constructor. (Closed)
Patch Set: ScreenWakeLockTest Created 3 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
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "modules/wake_lock/ScreenWakeLock.h" 5 #include "modules/wake_lock/ScreenWakeLock.h"
6 6
7 #include "core/dom/DOMImplementation.h" 7 #include "core/dom/DOMImplementation.h"
8 #include "core/dom/Document.h" 8 #include "core/dom/Document.h"
9 #include "core/dom/DocumentInit.h" 9 #include "core/dom/DocumentInit.h"
10 #include "mojo/public/cpp/bindings/interface_request.h" 10 #include "mojo/public/cpp/bindings/interface_request.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 60
61 bool m_wakeLockStatus; 61 bool m_wakeLockStatus;
62 }; 62 };
63 63
64 void MockInterfaceProvider::getInterface(const char* name, 64 void MockInterfaceProvider::getInterface(const char* name,
65 mojo::ScopedMessagePipeHandle handle) { 65 mojo::ScopedMessagePipeHandle handle) {
66 m_mockWakeLockService.reset(new MockWakeLockService( 66 m_mockWakeLockService.reset(new MockWakeLockService(
67 this, mojo::MakeRequest<WakeLockService>(std::move(handle)))); 67 this, mojo::MakeRequest<WakeLockService>(std::move(handle))));
68 } 68 }
69 69
70 // A TestWebFrameClient to allow overriding the interfaceProvider() with a mock. 70 // A TestWebFrameClient that overrides the blink::InterfaceProvider with a mock.
71 class TestWebFrameClient : public blink::FrameTestHelpers::TestWebFrameClient { 71 class TestWebFrameClient : public blink::FrameTestHelpers::TestWebFrameClient {
72 public: 72 public:
73 ~TestWebFrameClient() override = default; 73 ~TestWebFrameClient() override = default;
74
74 blink::InterfaceProvider* interfaceProvider() override { 75 blink::InterfaceProvider* interfaceProvider() override {
75 return &m_interfaceProvider; 76 return &m_interfaceProvider;
76 } 77 }
77 78
78 private: 79 private:
79 MockInterfaceProvider m_interfaceProvider; 80 MockInterfaceProvider m_interfaceProvider;
80 }; 81 };
81 82
82 class ScreenWakeLockTest : public testing::Test { 83 class ScreenWakeLockTest : public testing::Test {
83 protected: 84 protected:
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 ASSERT_FALSE(clientKeepScreenAwake()); 206 ASSERT_FALSE(clientKeepScreenAwake());
206 207
207 setKeepAwake(true); 208 setKeepAwake(true);
208 loadFrame(); 209 loadFrame();
209 210
210 EXPECT_FALSE(screenKeepAwake()); 211 EXPECT_FALSE(screenKeepAwake());
211 EXPECT_FALSE(clientKeepScreenAwake()); 212 EXPECT_FALSE(clientKeepScreenAwake());
212 } 213 }
213 214
214 } // namespace 215 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698