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

Side by Side Diff: remoting/client/client_status_logger_unittest.cc

Issue 2082363002: Remove calls to deprecated MessageLoop methods in remoting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add missing include Created 4 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
« no previous file with comments | « remoting/base/auto_thread_unittest.cc ('k') | remoting/host/daemon_process_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 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 "remoting/client/client_status_logger.h" 5 #include "remoting/client/client_status_logger.h"
6 6
7 #include "base/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "base/run_loop.h"
8 #include "remoting/protocol/performance_tracker.h" 9 #include "remoting/protocol/performance_tracker.h"
9 #include "remoting/signaling/mock_signal_strategy.h" 10 #include "remoting/signaling/mock_signal_strategy.h"
10 #include "remoting/signaling/server_log_entry_unittest.h" 11 #include "remoting/signaling/server_log_entry_unittest.h"
11 #include "testing/gmock/include/gmock/gmock.h" 12 #include "testing/gmock/include/gmock/gmock.h"
12 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
13 #include "third_party/webrtc/libjingle/xmllite/xmlelement.h" 14 #include "third_party/webrtc/libjingle/xmllite/xmlelement.h"
14 15
15 using buzz::XmlElement; 16 using buzz::XmlElement;
16 using buzz::QName; 17 using buzz::QName;
17 using remoting::protocol::ConnectionToHost; 18 using remoting::protocol::ConnectionToHost;
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 .RetiresOnSaturation(); 95 .RetiresOnSaturation();
95 } 96 }
96 client_status_logger_->LogSessionStateChange(ConnectionToHost::CONNECTED, 97 client_status_logger_->LogSessionStateChange(ConnectionToHost::CONNECTED,
97 protocol::OK); 98 protocol::OK);
98 99
99 // Setting the state to CONNECTED causes the log to be sent. Setting the 100 // Setting the state to CONNECTED causes the log to be sent. Setting the
100 // state to DISCONNECTED causes |signal_strategy_| to be cleaned up, 101 // state to DISCONNECTED causes |signal_strategy_| to be cleaned up,
101 // which removes the listener and terminates the test. 102 // which removes the listener and terminates the test.
102 client_status_logger_->SetSignalingStateForTest(SignalStrategy::CONNECTED); 103 client_status_logger_->SetSignalingStateForTest(SignalStrategy::CONNECTED);
103 client_status_logger_->SetSignalingStateForTest(SignalStrategy::DISCONNECTED); 104 client_status_logger_->SetSignalingStateForTest(SignalStrategy::DISCONNECTED);
104 message_loop_.Run(); 105 base::RunLoop().Run();
105 } 106 }
106 107
107 TEST_F(ClientStatusLoggerTest, LogStateChangeError) { 108 TEST_F(ClientStatusLoggerTest, LogStateChangeError) {
108 { 109 {
109 InSequence s; 110 InSequence s;
110 EXPECT_CALL(signal_strategy_, GetLocalJid()) 111 EXPECT_CALL(signal_strategy_, GetLocalJid())
111 .WillRepeatedly(Return(kClientJid)); 112 .WillRepeatedly(Return(kClientJid));
112 EXPECT_CALL(signal_strategy_, AddListener(_)); 113 EXPECT_CALL(signal_strategy_, AddListener(_));
113 EXPECT_CALL(signal_strategy_, GetNextId()); 114 EXPECT_CALL(signal_strategy_, GetNextId());
114 EXPECT_CALL(signal_strategy_, SendStanzaPtr( 115 EXPECT_CALL(signal_strategy_, SendStanzaPtr(
115 IsStateChange("connection-failed", "host-is-offline"))) 116 IsStateChange("connection-failed", "host-is-offline")))
116 .WillOnce(DoAll(DeleteArg<0>(), Return(true))); 117 .WillOnce(DoAll(DeleteArg<0>(), Return(true)));
117 EXPECT_CALL(signal_strategy_, RemoveListener(_)) 118 EXPECT_CALL(signal_strategy_, RemoveListener(_))
118 .WillOnce(QuitMainMessageLoop(&message_loop_)) 119 .WillOnce(QuitMainMessageLoop(&message_loop_))
119 .RetiresOnSaturation(); 120 .RetiresOnSaturation();
120 } 121 }
121 client_status_logger_->LogSessionStateChange(ConnectionToHost::FAILED, 122 client_status_logger_->LogSessionStateChange(ConnectionToHost::FAILED,
122 protocol::PEER_IS_OFFLINE); 123 protocol::PEER_IS_OFFLINE);
123 124
124 client_status_logger_->SetSignalingStateForTest(SignalStrategy::CONNECTED); 125 client_status_logger_->SetSignalingStateForTest(SignalStrategy::CONNECTED);
125 client_status_logger_->SetSignalingStateForTest(SignalStrategy::DISCONNECTED); 126 client_status_logger_->SetSignalingStateForTest(SignalStrategy::DISCONNECTED);
126 message_loop_.Run(); 127 base::RunLoop().Run();
127 } 128 }
128 129
129 TEST_F(ClientStatusLoggerTest, LogStatistics) { 130 TEST_F(ClientStatusLoggerTest, LogStatistics) {
130 { 131 {
131 InSequence s; 132 InSequence s;
132 EXPECT_CALL(signal_strategy_, GetLocalJid()) 133 EXPECT_CALL(signal_strategy_, GetLocalJid())
133 .WillRepeatedly(Return(kClientJid)); 134 .WillRepeatedly(Return(kClientJid));
134 EXPECT_CALL(signal_strategy_, AddListener(_)); 135 EXPECT_CALL(signal_strategy_, AddListener(_));
135 EXPECT_CALL(signal_strategy_, GetNextId()); 136 EXPECT_CALL(signal_strategy_, GetNextId());
136 EXPECT_CALL(signal_strategy_, SendStanzaPtr( 137 EXPECT_CALL(signal_strategy_, SendStanzaPtr(
137 IsStatisticsLog())) 138 IsStatisticsLog()))
138 .WillOnce(DoAll(DeleteArg<0>(), Return(true))); 139 .WillOnce(DoAll(DeleteArg<0>(), Return(true)));
139 EXPECT_CALL(signal_strategy_, RemoveListener(_)) 140 EXPECT_CALL(signal_strategy_, RemoveListener(_))
140 .WillOnce(QuitMainMessageLoop(&message_loop_)) 141 .WillOnce(QuitMainMessageLoop(&message_loop_))
141 .RetiresOnSaturation(); 142 .RetiresOnSaturation();
142 } 143 }
143 144
144 protocol::PerformanceTracker perf_tracker; 145 protocol::PerformanceTracker perf_tracker;
145 client_status_logger_->LogStatistics(&perf_tracker); 146 client_status_logger_->LogStatistics(&perf_tracker);
146 147
147 client_status_logger_->SetSignalingStateForTest(SignalStrategy::CONNECTED); 148 client_status_logger_->SetSignalingStateForTest(SignalStrategy::CONNECTED);
148 client_status_logger_->SetSignalingStateForTest(SignalStrategy::DISCONNECTED); 149 client_status_logger_->SetSignalingStateForTest(SignalStrategy::DISCONNECTED);
149 message_loop_.Run(); 150 base::RunLoop().Run();
150 } 151 }
151 152
152 } // namespace remoting 153 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/base/auto_thread_unittest.cc ('k') | remoting/host/daemon_process_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698