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

Side by Side Diff: remoting/host/mock_callback_unittest.cc

Issue 719983002: Reporting of policy errors via host-offline-reason: part 3 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@hor-nohoststatussender
Patch Set: Rebasing... Created 6 years 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 2014 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/mock_callback.h"
6
7 #include "testing/gmock/include/gmock/gmock.h"
8 #include "testing/gtest/include/gtest/gtest-spi.h"
9 #include "testing/gtest/include/gtest/gtest.h"
10
11 namespace remoting {
12
13 TEST(MockCallbackTest, SimpleExampleFromHeader) {
14 EXPECT_NONFATAL_FAILURE({
15 MockCallback<void(int)> mock_callback;
16 EXPECT_CALL(mock_callback, Run(123)).Times(2);
17 base::Callback<void(int)> callback = mock_callback.GetCallback();
18
19 callback.Run(123);
20 callback.Run(123);
21 callback.Run(123); // Called too many times.
22 },
23 "Mock function called more times than expected");
24 }
25
26 TEST(MockCallbackTest, HasRemainingCallbacks) {
27 MockCallback<int()> mock_callback;
28 EXPECT_CALL(mock_callback, Run()).WillOnce(testing::Return(123));
29
30 {
31 base::Callback<int()> callback = mock_callback.GetCallback();
32 EXPECT_TRUE(mock_callback.HasRemainingCallbacks());
33 EXPECT_EQ(123, callback.Run());
34 }
35
36 EXPECT_FALSE(mock_callback.HasRemainingCallbacks());
37 }
38
39 } // namespace remoting
40
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698