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

Side by Side Diff: base/os_compat_android_unittest.cc

Issue 10696114: Upstreaming diffs in os_compat_android.cc (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 5 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 | « base/os_compat_android.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
(Empty)
1 // Copyright (c) 2012 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 "base/os_compat_android.h"
6
7 #include "base/file_util.h"
8 #include "testing/gtest/include/gtest/gtest.h"
9
10 namespace base {
11
12 typedef testing::Test OsCompatAndroidTest;
13
14 // Keep this Unittest DISABLED_ , because it actually creates a directory in the
15 // device and it may be source of flakyness. For any changes in the mkdtemp
16 // function, you should run this unittest in your local machine to check if it
17 // passes.
18 TEST_F(OsCompatAndroidTest, DISABLED_TestMkdTemp) {
19 // Not six XXXXXX at the suffix of the path.
20 char invalid_path[] = "/tmp/foobarXX";
digit1 2012/07/13 10:34:04 the reason this test doesn't work is because there
21 EXPECT_EQ(NULL, mkdtemp(invalid_path));
22
23 // Directory does not exist
24 char invalid_path2[] = "doesntoexist/foobarXXXXXX";
25 EXPECT_EQ(NULL, mkdtemp(invalid_path2));
26
27 // Successfully create a tmp dir.
28 FilePath tmp_dir;
29 EXPECT_TRUE(file_util::GetTempDir(&tmp_dir));
30
31 FilePath sub_dir = tmp_dir.Append("XXXXXX");
32 std::string sub_dir_string = sub_dir.value();
33
34 // this should be OK since mkdtemp just replaces characters in place
35 char* buffer = const_cast<char*>(sub_dir_string.c_str());
36 EXPECT_TRUE(mkdtemp(buffer) != NULL);
37 }
38
39 } // namespace base
OLDNEW
« no previous file with comments | « base/os_compat_android.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698