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

Side by Side Diff: session_manager_unittest.cc

Issue 661224: Stop infinite restarting (Closed)
Patch Set: Created 10 years, 10 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
« child_job.cc ('K') | « session_manager_setup.sh ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009-2010 The Chromium OS Authors. All rights reserved. 1 // Copyright (c) 2009-2010 The Chromium OS 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 "login_manager/session_manager_service.h" 5 #include "login_manager/session_manager_service.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <gtest/gtest.h> 8 #include <gtest/gtest.h>
9 #include <signal.h> 9 #include <signal.h>
10 #include <unistd.h> 10 #include <unistd.h>
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 EXPECT_CALL(*job, ShouldRun()) 70 EXPECT_CALL(*job, ShouldRun())
71 .Times(2) 71 .Times(2)
72 .WillOnce(Return(true)) 72 .WillOnce(Return(true))
73 .WillRepeatedly(Return(false)); 73 .WillRepeatedly(Return(false));
74 ON_CALL(*job, Run()) 74 ON_CALL(*job, Run())
75 .WillByDefault(Invoke(CleanExit)); 75 .WillByDefault(Invoke(CleanExit));
76 76
77 manager.Run(); 77 manager.Run();
78 } 78 }
79 79
80 TEST(SessionManagerTest, MustStopChild) {
81 MockChildJob *job = new MockChildJob;
82 login_manager::SessionManagerService manager(job); // manager takes ownership
83
84 EXPECT_CALL(*job, ShouldRun())
85 .WillOnce(Return(true));
86 EXPECT_CALL(*job, ShouldStop())
87 .Times(1)
88 .WillOnce(Return(true));
89 ON_CALL(*job, Run())
90 .WillByDefault(Invoke(BadExit));
91
92 manager.Run();
93 }
94
80 TEST(SessionManagerTest, MultiRunTest) { 95 TEST(SessionManagerTest, MultiRunTest) {
81 MockChildJob* job = new MockChildJob; 96 MockChildJob* job = new MockChildJob;
82 login_manager::SessionManagerService manager(job); // manager takes ownership 97 login_manager::SessionManagerService manager(job); // manager takes ownership
83 manager.set_exit_on_child_done(true); 98 manager.set_exit_on_child_done(true);
84 99
85 EXPECT_CALL(*job, ShouldRun()) 100 EXPECT_CALL(*job, ShouldRun())
86 .Times(3) 101 .Times(3)
87 .WillOnce(Return(true)) 102 .WillOnce(Return(true))
88 .WillOnce(Return(true)) 103 .WillOnce(Return(true))
89 .WillRepeatedly(Return(false)); 104 .WillRepeatedly(Return(false));
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 EXPECT_FALSE(login_manager::SessionManagerService::ValidateEmail(no_at)); 291 EXPECT_FALSE(login_manager::SessionManagerService::ValidateEmail(no_at));
277 } 292 }
278 293
279 TEST(SessionManagerTest, EmailAddressTooMuchAtTest) { 294 TEST(SessionManagerTest, EmailAddressTooMuchAtTest) {
280 const char extra_at[] = "user@what@where"; 295 const char extra_at[] = "user@what@where";
281 EXPECT_FALSE(login_manager::SessionManagerService::ValidateEmail(extra_at)); 296 EXPECT_FALSE(login_manager::SessionManagerService::ValidateEmail(extra_at));
282 } 297 }
283 298
284 299
285 } // namespace login_manager 300 } // namespace login_manager
OLDNEW
« child_job.cc ('K') | « session_manager_setup.sh ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698