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

Side by Side Diff: components/password_manager/core/browser/login_database_unittest.cc

Issue 183273003: Fix memory leak in components_unittests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 9 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 | « no previous file | 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/password_manager/core/browser/login_database.h" 5 #include "components/password_manager/core/browser/login_database.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/files/scoped_temp_dir.h" 9 #include "base/files/scoped_temp_dir.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 // Get matches for encountered_form again. 694 // Get matches for encountered_form again.
695 EXPECT_TRUE(db_.GetLogins(encountered_form, &result)); 695 EXPECT_TRUE(db_.GetLogins(encountered_form, &result));
696 ASSERT_EQ(1U, result.size()); 696 ASSERT_EQ(1U, result.size());
697 697
698 // This time we should have all the info available. 698 // This time we should have all the info available.
699 PasswordForm expected_form(completed_form); 699 PasswordForm expected_form(completed_form);
700 #if defined(OS_MACOSX) 700 #if defined(OS_MACOSX)
701 expected_form.password_value.clear(); 701 expected_form.password_value.clear();
702 #endif // OS_MACOSX 702 #endif // OS_MACOSX
703 EXPECT_EQ(expected_form, *result[0]); 703 EXPECT_EQ(expected_form, *result[0]);
704 ClearResults(&result);
704 } 705 }
705 706
706 #if defined(OS_POSIX) 707 #if defined(OS_POSIX)
707 // Only the current user has permission to read the database. 708 // Only the current user has permission to read the database.
708 // 709 //
709 // Only POSIX because GetPosixFilePermissions() only exists on POSIX. 710 // Only POSIX because GetPosixFilePermissions() only exists on POSIX.
710 // This tests that sql::Connection::set_restrict_to_user() was called, 711 // This tests that sql::Connection::set_restrict_to_user() was called,
711 // and that function is a noop on non-POSIX platforms in any case. 712 // and that function is a noop on non-POSIX platforms in any case.
712 TEST_F(LoginDatabaseTest, FilePermissions) { 713 TEST_F(LoginDatabaseTest, FilePermissions) {
713 int mode = base::FILE_PERMISSION_MASK; 714 int mode = base::FILE_PERMISSION_MASK;
714 EXPECT_TRUE(base::GetPosixFilePermissions(file_, &mode)); 715 EXPECT_TRUE(base::GetPosixFilePermissions(file_, &mode));
715 EXPECT_EQ((mode & base::FILE_PERMISSION_USER_MASK), mode); 716 EXPECT_EQ((mode & base::FILE_PERMISSION_USER_MASK), mode);
716 } 717 }
717 #endif // defined(OS_POSIX) 718 #endif // defined(OS_POSIX)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698