Commit 31b37bf7 authored by Tom Sepez's avatar Tom Sepez Committed by Commit Bot

Prevent BrokerProcess.StatFile failing on android.

Might fail if run as root as currently written. Make tighter
test based on expected ids.

Bug: 791696
Change-Id: I55e0febd8de570d4982c369782ce6cf74e2f3f39
Reviewed-on: https://chromium-review.googlesource.com/807248Reviewed-by: default avatarRobert Sesek <rsesek@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Cr-Commit-Position: refs/heads/master@{#521738}
parent 935ce418
......@@ -26,6 +26,7 @@
#include "base/macros.h"
#include "base/posix/eintr_wrapper.h"
#include "base/posix/unix_domain_socket.h"
#include "build/build_config.h"
#include "sandbox/linux/syscall_broker/broker_client.h"
#include "sandbox/linux/tests/scoped_temporary_file.h"
#include "sandbox/linux/tests/test_utils.h"
......@@ -770,11 +771,13 @@ void TestStatHelper(bool fast_check_in_client) {
EXPECT_NE(0u, static_cast<unsigned int>(sb.st_dev));
EXPECT_NE(0u, static_cast<unsigned int>(sb.st_ino));
EXPECT_NE(0u, static_cast<unsigned int>(sb.st_mode));
EXPECT_NE(0u, static_cast<unsigned int>(sb.st_uid));
EXPECT_NE(0u, static_cast<unsigned int>(sb.st_gid));
EXPECT_NE(0u, static_cast<unsigned int>(sb.st_blksize));
EXPECT_NE(0u, static_cast<unsigned int>(sb.st_blocks));
// We are the ones that made the file.
EXPECT_EQ(geteuid(), sb.st_uid);
EXPECT_EQ(getegid(), sb.st_gid);
// Wrote 12 bytes above which should fit in one block.
EXPECT_EQ(12, sb.st_size);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment