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

Side by Side Diff: components/browser_watcher/endsession_watcher_window_win_unittest.cc

Issue 843113002: EndSessionWatcherWindow implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge ToT. Created 5 years, 11 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 (c) 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 "components/browser_watcher/endsession_watcher_window_win.h"
6
7 #include <windows.h>
8
9 #include "base/bind.h"
10 #include "testing/gtest/include/gtest/gtest.h"
11
12 namespace browser_watcher {
13
14 namespace {
15
16 void OnEndSession(bool* called, LPARAM* out_lparam, LPARAM lparam) {
17 *called = true;
18 *out_lparam = lparam;
19 }
20
21 } // namespace browser_watcher
22
23 TEST(EndSessionWatcherWindowTest, NoCallbackOnDestruction) {
24 LPARAM lparam = 0;
25 bool was_called = false;
26
27 {
28 EndSessionWatcherWindow watcher_window(
29 base::Bind(&OnEndSession, &was_called, &lparam));
30 }
31
32 EXPECT_FALSE(was_called);
33 EXPECT_EQ(lparam, 0);
34 }
35
36 TEST(EndSessionWatcherWindowTest, IssuesCallbackOnMessage) {
37 LPARAM lparam = 0;
38 bool was_called = false;
39
40 EndSessionWatcherWindow watcher_window(
41 base::Bind(&OnEndSession, &was_called, &lparam));
42
43 ::SendMessage(watcher_window.window(), WM_ENDSESSION, TRUE, 0xCAFEBABE);
44
45 EXPECT_TRUE(was_called);
46 EXPECT_EQ(lparam, 0xCAFEBABE);
47 }
48
49 } // namespace browser_watcher
OLDNEW
« no previous file with comments | « components/browser_watcher/endsession_watcher_window_win.cc ('k') | components/components_tests.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698