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

Side by Side Diff: utils_unittest.cc

Issue 6114002: AU: Function to trigger crash reporter. (Closed) Base URL: http://git.chromium.org/git/update_engine.git@master
Patch Set: fixes for review Created 9 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 | Annotate | Revision Log
« no previous file with comments | « utils.cc ('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) 2010 The Chromium OS Authors. All rights reserved. 1 // Copyright (c) 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 <sys/stat.h> 5 #include <sys/stat.h>
6 #include <sys/types.h> 6 #include <sys/types.h>
7 #include <errno.h> 7 #include <errno.h>
8 8
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 "dd if=/dev/zero of=%s seek=20971519 bs=1 count=1", 248 "dd if=/dev/zero of=%s seek=20971519 bs=1 count=1",
249 img.c_str()))); 249 img.c_str())));
250 EXPECT_EQ(20 * 1024 * 1024, utils::FileSize(img)); 250 EXPECT_EQ(20 * 1024 * 1024, utils::FileSize(img));
251 int block_count = 0; 251 int block_count = 0;
252 int block_size = 0; 252 int block_size = 0;
253 EXPECT_TRUE(utils::GetFilesystemSize(img, &block_count, &block_size)); 253 EXPECT_TRUE(utils::GetFilesystemSize(img, &block_count, &block_size));
254 EXPECT_EQ(4096, block_size); 254 EXPECT_EQ(4096, block_size);
255 EXPECT_EQ(10 * 1024 * 1024 / 4096, block_count); 255 EXPECT_EQ(10 * 1024 * 1024 / 4096, block_count);
256 } 256 }
257 257
258 namespace {
259 gboolean TerminateScheduleCrashReporterUploadTest(void* arg) {
260 GMainLoop* loop = reinterpret_cast<GMainLoop*>(arg);
261 g_main_loop_quit(loop);
262 return FALSE; // Don't call this callback again
263 }
264 } // namespace {}
265
266 TEST(UtilsTest, ScheduleCrashReporterUploadTest) {
267 // Not much to test. At least this tests for memory leaks, crashes,
268 // log errors.
269 GMainLoop* loop = g_main_loop_new(g_main_context_default(), FALSE);
270 utils::ScheduleCrashReporterUpload();
271 g_timeout_add_seconds(1, &TerminateScheduleCrashReporterUploadTest, loop);
272 g_main_loop_run(loop);
273 g_main_loop_unref(loop);
274 }
275
258 } // namespace chromeos_update_engine 276 } // namespace chromeos_update_engine
OLDNEW
« no previous file with comments | « utils.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698