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

Side by Side Diff: sandbox/win/src/handle_inheritance_test.cc

Issue 19579005: Move ReadFileToString to the base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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 <stdio.h> 5 #include <stdio.h>
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/win/windows_version.h" 8 #include "base/win/windows_version.h"
9 #include "sandbox/win/tests/common/controller.h" 9 #include "sandbox/win/tests/common/controller.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 22 matching lines...) Expand all
33 &attrs, OPEN_EXISTING, 0, NULL); 33 &attrs, OPEN_EXISTING, 0, NULL);
34 EXPECT_NE(file_handle, INVALID_HANDLE_VALUE); 34 EXPECT_NE(file_handle, INVALID_HANDLE_VALUE);
35 35
36 TestRunner runner; 36 TestRunner runner;
37 EXPECT_EQ(SBOX_ALL_OK, runner.GetPolicy()->SetStdoutHandle(file_handle)); 37 EXPECT_EQ(SBOX_ALL_OK, runner.GetPolicy()->SetStdoutHandle(file_handle));
38 int result = runner.RunTest(L"HandleInheritanceTests_PrintToStdout"); 38 int result = runner.RunTest(L"HandleInheritanceTests_PrintToStdout");
39 EXPECT_EQ(SBOX_TEST_SUCCEEDED, result); 39 EXPECT_EQ(SBOX_TEST_SUCCEEDED, result);
40 EXPECT_TRUE(::CloseHandle(file_handle)); 40 EXPECT_TRUE(::CloseHandle(file_handle));
41 41
42 std::string data; 42 std::string data;
43 EXPECT_TRUE(file_util::ReadFileToString(base::FilePath(temp_file_name), 43 EXPECT_TRUE(base::ReadFileToString(base::FilePath(temp_file_name), &data));
44 &data));
45 // Redirection uses a feature that was added in Windows Vista. 44 // Redirection uses a feature that was added in Windows Vista.
46 if (base::win::GetVersion() >= base::win::VERSION_VISTA) { 45 if (base::win::GetVersion() >= base::win::VERSION_VISTA) {
47 EXPECT_EQ("Example output to stdout\r\n", data); 46 EXPECT_EQ("Example output to stdout\r\n", data);
48 } else { 47 } else {
49 EXPECT_EQ("", data); 48 EXPECT_EQ("", data);
50 } 49 }
51 50
52 EXPECT_TRUE(::DeleteFile(temp_file_name)); 51 EXPECT_TRUE(::DeleteFile(temp_file_name));
53 } 52 }
54 53
55 } 54 }
OLDNEW
« no previous file with comments | « remoting/protocol/ssl_hmac_channel_authenticator_unittest.cc ('k') | skia/ext/vector_canvas_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698