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

Side by Side Diff: remoting/host/win/message_window_unittest.cc

Issue 13142002: Moved code implementing message-only windows to a dedicated class (Windows only). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 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 "remoting/host/win/message_window.h"
6 #include "testing/gmock/include/gmock/gmock.h"
7 #include "testing/gtest/include/gtest/gtest.h"
8
9 namespace remoting {
10
11 namespace {
12
13 class MessageWindowDelegate : public win::MessageWindow::Delegate {
14 public:
15 MessageWindowDelegate();
16 virtual ~MessageWindowDelegate();
17
18 // MessageWindow::Delegate interface.
19 virtual bool HandleMessage(UINT message, WPARAM wparam, LPARAM lparam,
20 LRESULT* result) OVERRIDE;
21 };
22
23 MessageWindowDelegate::MessageWindowDelegate() {
24 }
25
26 MessageWindowDelegate::~MessageWindowDelegate() {
27 }
28
29 bool MessageWindowDelegate::HandleMessage(
30 UINT message, WPARAM wparam, LPARAM lparam, LRESULT* result) {
31 // Return |wparam| as the result of WM_USER message.
32 if (message == WM_USER) {
33 *result = wparam;
34 return true;
35 }
36
37 return false;
38 }
39
40 } // namespace
41
42 // Checks that a window can be created.
43 TEST(MessageWindowTest, Create) {
44 MessageWindowDelegate delegate;
45 win::MessageWindow window;
46 EXPECT_TRUE(window.Create(&delegate));
47 }
48
49 // Verifies that the created window can receive messages.
50 TEST(MessageWindowTest, SendMessage) {
51 MessageWindowDelegate delegate;
52 win::MessageWindow window;
53 EXPECT_TRUE(window.Create(&delegate));
54
55 EXPECT_EQ(SendMessage(window.hwnd(), WM_USER, 100, 0), 100);
56 }
57
58 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698