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

Side by Side Diff: child_job_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
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/child_job.h" 5 #include "login_manager/child_job.h"
6 6
7 #include <gtest/gtest.h> 7 #include <gtest/gtest.h>
8 #include <unistd.h> 8 #include <unistd.h>
9 9
10 #include <base/command_line.h> 10 #include <base/command_line.h>
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 67
68 std::vector<std::string> data = job.ExtractArgvForTest(); 68 std::vector<std::string> data = job.ExtractArgvForTest();
69 std::vector<std::string>::const_iterator it = data.begin(); 69 std::vector<std::string>::const_iterator it = data.begin();
70 for (int i = 1; i < my_argc; ++i) { 70 for (int i = 1; i < my_argc; ++i) {
71 EXPECT_EQ(my_argv[i], *it); 71 EXPECT_EQ(my_argv[i], *it);
72 ++it; 72 ++it;
73 } 73 }
74 EXPECT_TRUE(data.end() == it) << *it; 74 EXPECT_TRUE(data.end() == it) << *it;
75 } 75 }
76 76
77 TEST(SetUidExecJobTest, ShouldStopTest) {
78 const char *my_argv[] = { "zero",
79 "one",
80 "two" };
81 const int my_argc = 3;
82 CommandLine cl(my_argc, my_argv);
83
84 SetUidExecJob job(&cl, NULL, false);
85 job.RecordTime();
86 EXPECT_TRUE(job.ShouldStop());
87 }
88
89 TEST(SetUidExecJobTest, ShouldNotStopTest) {
90 const char *my_argv[] = { "zero",
91 "one",
92 "two" };
93 const int my_argc = 3;
94 CommandLine cl(my_argc, my_argv);
95
96 SetUidExecJob job(&cl, NULL, false);
97 job.RecordTime();
98 sleep(1);
99 EXPECT_FALSE(job.ShouldStop());
100 }
101
77 } // namespace login_manager 102 } // namespace login_manager
OLDNEW
« child_job.cc ('K') | « child_job.cc ('k') | mock_child_job.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698