This source file includes following definitions.
- SetUp
- SerializeVector
- DeserializeVector
- FormsAreEqual
- TEST_F
- TEST_F
- TEST_F
- TEST_F
- GetFormWithNewSignonRealm
- TEST_F
- AddTimestampedLogin
- ClearResults
- TEST_F
- TEST_F
- TEST_F
- TEST_F
- TEST_F
- TEST_F
#include "components/password_manager/core/browser/login_database.h"
#include "base/basictypes.h"
#include "base/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/memory/scoped_vector.h"
#include "base/path_service.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "base/time/time.h"
#include "components/autofill/core/common/password_form.h"
#include "components/password_manager/core/browser/psl_matching_helper.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
using autofill::PasswordForm;
using base::ASCIIToUTF16;
using ::testing::Eq;
class LoginDatabaseTest : public testing::Test {
protected:
virtual void SetUp() {
ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
file_ = temp_dir_.path().AppendASCII("TestMetadataStoreMacDatabase");
ASSERT_TRUE(db_.Init(file_));
}
Pickle SerializeVector(const std::vector<base::string16>& vec) const {
return db_.SerializeVector(vec);
}
std::vector<base::string16> DeserializeVector(const Pickle& pickle) const {
return db_.DeserializeVector(pickle);
}
void FormsAreEqual(const PasswordForm& expected, const PasswordForm& actual) {
PasswordForm expected_copy(expected);
#if defined(OS_MACOSX) && !defined(OS_IOS)
expected_copy.password_value = ASCIIToUTF16("");
#endif
EXPECT_EQ(expected_copy, actual);
}
base::ScopedTempDir temp_dir_;
base::FilePath file_;
LoginDatabase db_;
};
TEST_F(LoginDatabaseTest, Logins) {
std::vector<PasswordForm*> result;
EXPECT_TRUE(db_.GetAutofillableLogins(&result));
EXPECT_EQ(0U, result.size());
PasswordForm form;
form.origin = GURL("http://accounts.google.com/LoginAuth");
form.action = GURL("http://accounts.google.com/Login");
form.username_element = ASCIIToUTF16("Email");
form.username_value = ASCIIToUTF16("test@gmail.com");
form.password_element = ASCIIToUTF16("Passwd");
form.password_value = ASCIIToUTF16("test");
form.submit_element = ASCIIToUTF16("signIn");
form.signon_realm = "http://www.google.com/";
form.ssl_valid = false;
form.preferred = false;
form.scheme = PasswordForm::SCHEME_HTML;
form.times_used = 1;
form.form_data.name = ASCIIToUTF16("form_name");
form.form_data.method = ASCIIToUTF16("POST");
EXPECT_TRUE(db_.AddLogin(form));
EXPECT_TRUE(db_.GetAutofillableLogins(&result));
EXPECT_EQ(1U, result.size());
FormsAreEqual(form, *result[0]);
delete result[0];
result.clear();
EXPECT_TRUE(db_.GetLogins(form, &result));
EXPECT_EQ(1U, result.size());
delete result[0];
result.clear();
PasswordForm form2(form);
form2.origin = GURL("http://www.google.com/new/accounts/LoginAuth");
form2.submit_element = ASCIIToUTF16("reallySignIn");
EXPECT_TRUE(db_.GetLogins(form2, &result));
EXPECT_EQ(1U, result.size());
delete result[0];
result.clear();
PasswordForm form3(form2);
form3.action = GURL("http://www.google.com/new/accounts/Login");
EXPECT_TRUE(db_.GetLogins(form3, &result));
EXPECT_EQ(1U, result.size());
delete result[0];
result.clear();
PasswordForm form4(form3);
form4.signon_realm = "https://www.google.com/";
form4.ssl_valid = true;
EXPECT_TRUE(db_.GetLogins(form4, &result));
EXPECT_EQ(0U, result.size());
EXPECT_TRUE(db_.AddLogin(form4));
EXPECT_TRUE(db_.GetAutofillableLogins(&result));
EXPECT_EQ(2U, result.size());
delete result[0];
delete result[1];
result.clear();
EXPECT_TRUE(db_.GetLogins(form4, &result));
EXPECT_EQ(1U, result.size());
delete result[0];
result.clear();
EXPECT_TRUE(db_.RemoveLogin(form));
EXPECT_TRUE(db_.GetAutofillableLogins(&result));
EXPECT_EQ(1U, result.size());
delete result[0];
result.clear();
EXPECT_TRUE(db_.GetLogins(form, &result));
EXPECT_EQ(0U, result.size());
PasswordForm form5(form4);
form5.ssl_valid = 0;
EXPECT_TRUE(db_.GetLogins(form5, &result));
EXPECT_EQ(1U, result.size());
delete result[0];
result.clear();
PasswordForm form6(form5);
form6.password_value = ASCIIToUTF16("test6");
form6.preferred = true;
int rows_changed = 0;
EXPECT_TRUE(db_.UpdateLogin(form6, &rows_changed));
EXPECT_EQ(1, rows_changed);
EXPECT_TRUE(db_.GetLogins(form5, &result));
EXPECT_EQ(1U, result.size());
delete result[0];
result.clear();
EXPECT_TRUE(db_.GetAutofillableLogins(&result));
EXPECT_EQ(1U, result.size());
#if defined(OS_MACOSX) && !defined(OS_IOS)
EXPECT_EQ(base::string16(), result[0]->password_value);
#else
EXPECT_EQ(form6.password_value, result[0]->password_value);
#endif
EXPECT_TRUE(form6.preferred);
delete result[0];
result.clear();
EXPECT_TRUE(db_.RemoveLogin(form4));
EXPECT_TRUE(db_.GetAutofillableLogins(&result));
EXPECT_EQ(0U, result.size());
}
TEST_F(LoginDatabaseTest, TestPublicSuffixDomainMatching) {
PSLMatchingHelper::EnablePublicSuffixDomainMatchingForTesting();
std::vector<PasswordForm*> result;
EXPECT_TRUE(db_.GetAutofillableLogins(&result));
EXPECT_EQ(0U, result.size());
PasswordForm form;
form.origin = GURL("https://foo.com/");
form.action = GURL("https://foo.com/login");
form.username_element = ASCIIToUTF16("username");
form.username_value = ASCIIToUTF16("test@gmail.com");
form.password_element = ASCIIToUTF16("password");
form.password_value = ASCIIToUTF16("test");
form.submit_element = ASCIIToUTF16("");
form.signon_realm = "https://foo.com/";
form.ssl_valid = true;
form.preferred = false;
form.scheme = PasswordForm::SCHEME_HTML;
EXPECT_TRUE(db_.AddLogin(form));
EXPECT_TRUE(db_.GetAutofillableLogins(&result));
EXPECT_EQ(1U, result.size());
delete result[0];
result.clear();
EXPECT_TRUE(db_.GetLogins(form, &result));
EXPECT_EQ(1U, result.size());
delete result[0];
result.clear();
PasswordForm form2(form);
form2.origin = GURL("https://mobile.foo.com/");
form2.action = GURL("https://mobile.foo.com/login");
form2.signon_realm = "https://mobile.foo.com/";
EXPECT_TRUE(db_.GetLogins(form2, &result));
EXPECT_EQ(1U, result.size());
EXPECT_EQ("https://mobile.foo.com/", result[0]->signon_realm);
EXPECT_EQ("https://foo.com/", result[0]->original_signon_realm);
delete result[0];
result.clear();
}
TEST_F(LoginDatabaseTest, TestPublicSuffixDomainMatchingShouldMatchingApply) {
PSLMatchingHelper::EnablePublicSuffixDomainMatchingForTesting();
std::vector<PasswordForm*> result;
EXPECT_TRUE(db_.GetAutofillableLogins(&result));
EXPECT_EQ(0U, result.size());
PasswordForm form;
form.origin = GURL("https://accounts.google.com/");
form.action = GURL("https://accounts.google.com/login");
form.username_element = ASCIIToUTF16("username");
form.username_value = ASCIIToUTF16("test@gmail.com");
form.password_element = ASCIIToUTF16("password");
form.password_value = ASCIIToUTF16("test");
form.submit_element = ASCIIToUTF16("");
form.signon_realm = "https://accounts.google.com/";
form.ssl_valid = true;
form.preferred = false;
form.scheme = PasswordForm::SCHEME_HTML;
EXPECT_TRUE(db_.AddLogin(form));
EXPECT_TRUE(db_.GetAutofillableLogins(&result));
EXPECT_EQ(1U, result.size());
delete result[0];
result.clear();
EXPECT_TRUE(db_.GetLogins(form, &result));
EXPECT_EQ(1U, result.size());
delete result[0];
result.clear();
PasswordForm form2(form);
form2.origin = GURL("https://some.other.google.com/");
form2.action = GURL("https://some.other.google.com/login");
form2.signon_realm = "https://some.other.google.com/";
EXPECT_TRUE(db_.GetLogins(form2, &result));
EXPECT_EQ(0U, result.size());
}
TEST_F(LoginDatabaseTest, TestPublicSuffixDomainMatchingDifferentSites) {
PSLMatchingHelper::EnablePublicSuffixDomainMatchingForTesting();
std::vector<PasswordForm*> result;
EXPECT_TRUE(db_.GetAutofillableLogins(&result));
EXPECT_EQ(0U, result.size());
PasswordForm form;
form.origin = GURL("https://foo.com/");
form.action = GURL("https://foo.com/login");
form.username_element = ASCIIToUTF16("username");
form.username_value = ASCIIToUTF16("test@gmail.com");
form.password_element = ASCIIToUTF16("password");
form.password_value = ASCIIToUTF16("test");
form.submit_element = ASCIIToUTF16("");
form.signon_realm = "https://foo.com/";
form.ssl_valid = true;
form.preferred = false;
form.scheme = PasswordForm::SCHEME_HTML;
EXPECT_TRUE(db_.AddLogin(form));
EXPECT_TRUE(db_.GetAutofillableLogins(&result));
EXPECT_EQ(1U, result.size());
delete result[0];
result.clear();
EXPECT_TRUE(db_.GetLogins(form, &result));
EXPECT_EQ(1U, result.size());
delete result[0];
result.clear();
PasswordForm form2(form);
form2.origin = GURL("https://mobile.foo.com/");
form2.action = GURL("https://mobile.foo.com/login");
form2.signon_realm = "https://mobile.foo.com/";
EXPECT_TRUE(db_.GetLogins(form2, &result));
EXPECT_EQ(1U, result.size());
EXPECT_EQ("https://mobile.foo.com/", result[0]->signon_realm);
EXPECT_EQ("https://foo.com/", result[0]->original_signon_realm);
delete result[0];
result.clear();
form.origin = GURL("https://baz.com/login/");
form.action = GURL("https://baz.com/login/");
form.username_element = ASCIIToUTF16("email");
form.username_value = ASCIIToUTF16("test@gmail.com");
form.password_element = ASCIIToUTF16("password");
form.password_value = ASCIIToUTF16("test");
form.submit_element = ASCIIToUTF16("");
form.signon_realm = "https://baz.com/";
form.ssl_valid = true;
form.preferred = false;
form.scheme = PasswordForm::SCHEME_HTML;
EXPECT_TRUE(db_.AddLogin(form));
EXPECT_TRUE(db_.GetAutofillableLogins(&result));
EXPECT_EQ(2U, result.size());
delete result[0];
delete result[1];
result.clear();
PasswordForm form3(form);
form3.origin = GURL("https://m.baz.com/login/");
form3.action = GURL("https://m.baz.com/login/");
form3.signon_realm = "https://m.baz.com/";
EXPECT_TRUE(db_.GetLogins(form3, &result));
EXPECT_EQ(1U, result.size());
EXPECT_EQ("https://m.baz.com/", result[0]->signon_realm);
EXPECT_EQ("https://baz.com/", result[0]->original_signon_realm);
delete result[0];
result.clear();
}
PasswordForm GetFormWithNewSignonRealm(PasswordForm form,
std::string signon_realm) {
PasswordForm form2(form);
form2.origin = GURL(signon_realm);
form2.action = GURL(signon_realm);
form2.signon_realm = signon_realm;
return form2;
}
TEST_F(LoginDatabaseTest, TestPublicSuffixDomainMatchingRegexp) {
PSLMatchingHelper::EnablePublicSuffixDomainMatchingForTesting();
std::vector<PasswordForm*> result;
EXPECT_TRUE(db_.GetAutofillableLogins(&result));
EXPECT_EQ(0U, result.size());
PasswordForm form;
form.origin = GURL("http://foo.com/");
form.action = GURL("http://foo.com/login");
form.username_element = ASCIIToUTF16("username");
form.username_value = ASCIIToUTF16("test@gmail.com");
form.password_element = ASCIIToUTF16("password");
form.password_value = ASCIIToUTF16("test");
form.submit_element = ASCIIToUTF16("");
form.signon_realm = "http://foo.com/";
form.ssl_valid = false;
form.preferred = false;
form.scheme = PasswordForm::SCHEME_HTML;
EXPECT_TRUE(db_.AddLogin(form));
EXPECT_TRUE(db_.GetAutofillableLogins(&result));
EXPECT_EQ(1U, result.size());
delete result[0];
result.clear();
PasswordForm form_dash =
GetFormWithNewSignonRealm(form, "http://www.foo-bar.com/");
EXPECT_TRUE(db_.AddLogin(form_dash));
EXPECT_TRUE(db_.GetAutofillableLogins(&result));
EXPECT_EQ(2U, result.size());
delete result[0];
delete result[1];
result.clear();
EXPECT_TRUE(db_.GetLogins(form, &result));
EXPECT_EQ(1U, result.size());
delete result[0];
result.clear();
PasswordForm form2 = GetFormWithNewSignonRealm(form, "http://www.foo.com/");
EXPECT_TRUE(db_.GetLogins(form2, &result));
EXPECT_EQ(1U, result.size());
delete result[0];
result.clear();
form2 = GetFormWithNewSignonRealm(form, "http://a.b.foo.com/");
EXPECT_TRUE(db_.GetLogins(form2, &result));
EXPECT_EQ(1U, result.size());
delete result[0];
result.clear();
form2 = GetFormWithNewSignonRealm(form, "http://a-b.foo.com/");
EXPECT_TRUE(db_.GetLogins(form2, &result));
EXPECT_EQ(1U, result.size());
delete result[0];
result.clear();
form2 = GetFormWithNewSignonRealm(form, "http://foo-bar.com/");
EXPECT_TRUE(db_.GetLogins(form2, &result));
EXPECT_EQ(1U, result.size());
delete result[0];
result.clear();
form2 = GetFormWithNewSignonRealm(form, "http://www.foo-bar.com/");
EXPECT_TRUE(db_.GetLogins(form2, &result));
EXPECT_EQ(1U, result.size());
delete result[0];
result.clear();
form2 = GetFormWithNewSignonRealm(form, "http://a.b.foo-bar.com/");
EXPECT_TRUE(db_.GetLogins(form2, &result));
EXPECT_EQ(1U, result.size());
delete result[0];
result.clear();
form2 = GetFormWithNewSignonRealm(form, "http://a-b.foo-bar.com/");
EXPECT_TRUE(db_.GetLogins(form2, &result));
EXPECT_EQ(1U, result.size());
delete result[0];
result.clear();
form2 = GetFormWithNewSignonRealm(form, "http://foo.com:1337/");
EXPECT_TRUE(db_.GetLogins(form2, &result));
EXPECT_EQ(0U, result.size());
form2 = GetFormWithNewSignonRealm(form, "https://foo.com/");
EXPECT_TRUE(db_.GetLogins(form2, &result));
EXPECT_EQ(0U, result.size());
form2 = GetFormWithNewSignonRealm(form, "http://notfoo.com/");
EXPECT_TRUE(db_.GetLogins(form2, &result));
EXPECT_EQ(0U, result.size());
form2 = GetFormWithNewSignonRealm(form, "http://baz.com/");
EXPECT_TRUE(db_.GetLogins(form2, &result));
EXPECT_EQ(0U, result.size());
form2 = GetFormWithNewSignonRealm(form, "http://foo-baz.com/");
EXPECT_TRUE(db_.GetLogins(form2, &result));
EXPECT_EQ(0U, result.size());
}
static bool AddTimestampedLogin(LoginDatabase* db, std::string url,
const std::string& unique_string,
const base::Time& time) {
PasswordForm form;
form.origin = GURL(url + std::string("/LoginAuth"));
form.username_element = ASCIIToUTF16(unique_string);
form.username_value = ASCIIToUTF16(unique_string);
form.password_element = ASCIIToUTF16(unique_string);
form.submit_element = ASCIIToUTF16("signIn");
form.signon_realm = url;
form.date_created = time;
return db->AddLogin(form);
}
static void ClearResults(std::vector<PasswordForm*>* results) {
for (size_t i = 0; i < results->size(); ++i) {
delete (*results)[i];
}
results->clear();
}
TEST_F(LoginDatabaseTest, ClearPrivateData_SavedPasswords) {
std::vector<PasswordForm*> result;
EXPECT_TRUE(db_.GetAutofillableLogins(&result));
EXPECT_EQ(0U, result.size());
base::Time now = base::Time::Now();
base::TimeDelta one_day = base::TimeDelta::FromDays(1);
EXPECT_TRUE(AddTimestampedLogin(&db_, "1", "foo1", base::Time()));
EXPECT_TRUE(AddTimestampedLogin(&db_, "2", "foo2", now - one_day));
EXPECT_TRUE(AddTimestampedLogin(&db_, "3", "foo3", now));
EXPECT_TRUE(AddTimestampedLogin(&db_, "4", "foo4", now + one_day));
EXPECT_TRUE(db_.GetAutofillableLogins(&result));
EXPECT_EQ(4U, result.size());
ClearResults(&result);
EXPECT_TRUE(db_.GetLoginsCreatedBetween(now, base::Time(), &result));
EXPECT_EQ(2U, result.size());
ClearResults(&result);
db_.RemoveLoginsCreatedBetween(now, base::Time());
EXPECT_TRUE(db_.GetAutofillableLogins(&result));
EXPECT_EQ(2U, result.size());
ClearResults(&result);
db_.RemoveLoginsCreatedBetween(base::Time(), base::Time());
EXPECT_TRUE(db_.GetAutofillableLogins(&result));
EXPECT_EQ(0U, result.size());
}
TEST_F(LoginDatabaseTest, BlacklistedLogins) {
std::vector<PasswordForm*> result;
EXPECT_TRUE(db_.GetBlacklistLogins(&result));
ASSERT_EQ(0U, result.size());
PasswordForm form;
form.origin = GURL("http://accounts.google.com/LoginAuth");
form.action = GURL("http://accounts.google.com/Login");
form.username_element = ASCIIToUTF16("Email");
form.password_element = ASCIIToUTF16("Passwd");
form.submit_element = ASCIIToUTF16("signIn");
form.signon_realm = "http://www.google.com/";
form.ssl_valid = false;
form.preferred = true;
form.blacklisted_by_user = true;
form.scheme = PasswordForm::SCHEME_HTML;
EXPECT_TRUE(db_.AddLogin(form));
EXPECT_TRUE(db_.GetAutofillableLogins(&result));
ASSERT_EQ(0U, result.size());
EXPECT_TRUE(db_.GetLogins(form, &result));
EXPECT_EQ(1U, result.size());
ClearResults(&result);
EXPECT_TRUE(db_.GetBlacklistLogins(&result));
EXPECT_EQ(1U, result.size());
ClearResults(&result);
}
TEST_F(LoginDatabaseTest, VectorSerialization) {
std::vector<base::string16> vec;
Pickle temp = SerializeVector(vec);
std::vector<base::string16> output = DeserializeVector(temp);
EXPECT_THAT(output, Eq(vec));
vec.push_back(ASCIIToUTF16("first"));
vec.push_back(ASCIIToUTF16("second"));
vec.push_back(ASCIIToUTF16("third"));
temp = SerializeVector(vec);
output = DeserializeVector(temp);
EXPECT_THAT(output, Eq(vec));
}
TEST_F(LoginDatabaseTest, UpdateIncompleteCredentials) {
std::vector<autofill::PasswordForm*> result;
EXPECT_TRUE(db_.GetAutofillableLogins(&result));
ASSERT_EQ(0U, result.size());
PasswordForm incomplete_form;
incomplete_form.origin = GURL("http://accounts.google.com/LoginAuth");
incomplete_form.signon_realm = "http://accounts.google.com/";
incomplete_form.username_value = ASCIIToUTF16("my_username");
incomplete_form.password_value = ASCIIToUTF16("my_password");
incomplete_form.ssl_valid = false;
incomplete_form.preferred = true;
incomplete_form.blacklisted_by_user = false;
incomplete_form.scheme = PasswordForm::SCHEME_HTML;
EXPECT_TRUE(db_.AddLogin(incomplete_form));
PasswordForm encountered_form;
encountered_form.origin = GURL("http://accounts.google.com/LoginAuth");
encountered_form.signon_realm = "http://accounts.google.com/";
encountered_form.action = GURL("http://accounts.google.com/Login");
encountered_form.username_element = ASCIIToUTF16("Email");
encountered_form.password_element = ASCIIToUTF16("Passwd");
encountered_form.submit_element = ASCIIToUTF16("signIn");
EXPECT_TRUE(db_.GetLogins(encountered_form, &result));
ASSERT_EQ(1U, result.size());
EXPECT_EQ(incomplete_form.origin, result[0]->origin);
EXPECT_EQ(incomplete_form.signon_realm, result[0]->signon_realm);
EXPECT_EQ(incomplete_form.username_value, result[0]->username_value);
#if defined(OS_MACOSX) && !defined(OS_IOS)
EXPECT_TRUE(result[0]->password_value.empty());
#else
EXPECT_EQ(incomplete_form.password_value, result[0]->password_value);
#endif
EXPECT_TRUE(result[0]->preferred);
EXPECT_FALSE(result[0]->ssl_valid);
EXPECT_EQ(GURL(), result[0]->action);
EXPECT_TRUE(result[0]->username_element.empty());
EXPECT_TRUE(result[0]->password_element.empty());
EXPECT_TRUE(result[0]->submit_element.empty());
ClearResults(&result);
PasswordForm completed_form(incomplete_form);
completed_form.action = encountered_form.action;
completed_form.username_element = encountered_form.username_element;
completed_form.password_element = encountered_form.password_element;
completed_form.submit_element = encountered_form.submit_element;
EXPECT_TRUE(db_.UpdateLogin(completed_form, NULL));
EXPECT_TRUE(db_.GetLogins(encountered_form, &result));
ASSERT_EQ(1U, result.size());
PasswordForm expected_form(completed_form);
#if defined(OS_MACOSX) && !defined(OS_IOS)
expected_form.password_value.clear();
#endif
EXPECT_EQ(expected_form, *result[0]);
ClearResults(&result);
}
TEST_F(LoginDatabaseTest, UpdateOverlappingCredentials) {
PasswordForm incomplete_form;
incomplete_form.origin = GURL("http://accounts.google.com/LoginAuth");
incomplete_form.signon_realm = "http://accounts.google.com/";
incomplete_form.username_value = ASCIIToUTF16("my_username");
incomplete_form.password_value = ASCIIToUTF16("my_password");
incomplete_form.ssl_valid = false;
incomplete_form.preferred = true;
incomplete_form.blacklisted_by_user = false;
incomplete_form.scheme = PasswordForm::SCHEME_HTML;
EXPECT_TRUE(db_.AddLogin(incomplete_form));
PasswordForm complete_form = incomplete_form;
complete_form.action = GURL("http://accounts.google.com/Login");
complete_form.username_element = ASCIIToUTF16("username_element");
complete_form.password_element = ASCIIToUTF16("password_element");
complete_form.submit_element = ASCIIToUTF16("submit");
EXPECT_TRUE(db_.AddLogin(complete_form));
ScopedVector<autofill::PasswordForm> result;
EXPECT_TRUE(db_.GetAutofillableLogins(&result.get()));
ASSERT_EQ(2U, result.size());
result.clear();
complete_form.password_value = ASCIIToUTF16("new_password");
EXPECT_TRUE(db_.UpdateLogin(complete_form, NULL));
EXPECT_TRUE(db_.GetAutofillableLogins(&result.get()));
ASSERT_EQ(1U, result.size());
PasswordForm expected_form(complete_form);
#if defined(OS_MACOSX) && !defined(OS_IOS)
expected_form.password_value.clear();
#endif
EXPECT_EQ(expected_form, *result[0]);
}
#if defined(OS_POSIX)
TEST_F(LoginDatabaseTest, FilePermissions) {
int mode = base::FILE_PERMISSION_MASK;
EXPECT_TRUE(base::GetPosixFilePermissions(file_, &mode));
EXPECT_EQ((mode & base::FILE_PERMISSION_USER_MASK), mode);
}
#endif