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

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

Issue 16780006: Moved remoting::win::MessageWindow to base::win::MessageWindow so that it could be re-used outside … (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 7 years, 6 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
« no previous file with comments | « remoting/host/win/message_window.cc ('k') | remoting/remoting.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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(HWND hwnd,
20 UINT message,
21 WPARAM wparam,
22 LPARAM lparam,
23 LRESULT* result) OVERRIDE;
24 };
25
26 MessageWindowDelegate::MessageWindowDelegate() {
27 }
28
29 MessageWindowDelegate::~MessageWindowDelegate() {
30 }
31
32 bool MessageWindowDelegate::HandleMessage(
33 HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam, LRESULT* result) {
34 // Return |wparam| as the result of WM_USER message.
35 if (message == WM_USER) {
36 *result = wparam;
37 return true;
38 }
39
40 return false;
41 }
42
43 } // namespace
44
45 // Checks that a window can be created.
46 TEST(MessageWindowTest, Create) {
47 MessageWindowDelegate delegate;
48 win::MessageWindow window;
49 EXPECT_TRUE(window.Create(&delegate));
50 }
51
52 // Verifies that the created window can receive messages.
53 TEST(MessageWindowTest, SendMessage) {
54 MessageWindowDelegate delegate;
55 win::MessageWindow window;
56 EXPECT_TRUE(window.Create(&delegate));
57
58 EXPECT_EQ(SendMessage(window.hwnd(), WM_USER, 100, 0), 100);
59 }
60
61 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/win/message_window.cc ('k') | remoting/remoting.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698