| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <stdarg.h> | 5 #include <stdarg.h> |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
| 11 #include "base/time.h" | 11 #include "base/time.h" |
| 12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
| 13 #include "chrome/browser/password_manager/native_backend_gnome_x.h" | 13 #include "chrome/browser/password_manager/native_backend_gnome_x.h" |
| 14 #include "chrome/browser/prefs/pref_service.h" | 14 #include "chrome/browser/prefs/pref_service.h" |
| 15 #include "chrome/common/pref_names.h" | 15 #include "chrome/common/pref_names.h" |
| 16 #include "chrome/test/base/testing_browser_process_test.h" | |
| 17 #include "chrome/test/base/testing_profile.h" | 16 #include "chrome/test/base/testing_profile.h" |
| 18 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
| 19 | 18 |
| 20 using webkit_glue::PasswordForm; | 19 using webkit_glue::PasswordForm; |
| 21 | 20 |
| 22 namespace { | 21 namespace { |
| 23 | 22 |
| 24 // What follows is a very simple implementation of the subset of the GNOME | 23 // What follows is a very simple implementation of the subset of the GNOME |
| 25 // Keyring API that we actually use. It gets substituted for the real one by | 24 // Keyring API that we actually use. It gets substituted for the real one by |
| 26 // MockGnomeKeyringLoader, which hooks into the facility normally used to load | 25 // MockGnomeKeyringLoader, which hooks into the facility normally used to load |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 } // anonymous namespace | 274 } // anonymous namespace |
| 276 | 275 |
| 277 // NativeBackendGnome isn't reference counted, but in these unit tests that | 276 // NativeBackendGnome isn't reference counted, but in these unit tests that |
| 278 // won't be a problem as it always outlives the threads we post tasks to. | 277 // won't be a problem as it always outlives the threads we post tasks to. |
| 279 template<> | 278 template<> |
| 280 struct RunnableMethodTraits<NativeBackendGnome> { | 279 struct RunnableMethodTraits<NativeBackendGnome> { |
| 281 void RetainCallee(NativeBackendGnome*) {} | 280 void RetainCallee(NativeBackendGnome*) {} |
| 282 void ReleaseCallee(NativeBackendGnome*) {} | 281 void ReleaseCallee(NativeBackendGnome*) {} |
| 283 }; | 282 }; |
| 284 | 283 |
| 285 class NativeBackendGnomeTest : public TestingBrowserProcessTest { | 284 class NativeBackendGnomeTest : public testing::Test { |
| 286 protected: | 285 protected: |
| 287 NativeBackendGnomeTest() | 286 NativeBackendGnomeTest() |
| 288 : ui_thread_(BrowserThread::UI, &message_loop_), | 287 : ui_thread_(BrowserThread::UI, &message_loop_), |
| 289 db_thread_(BrowserThread::DB) { | 288 db_thread_(BrowserThread::DB) { |
| 290 } | 289 } |
| 291 | 290 |
| 292 virtual void SetUp() { | 291 virtual void SetUp() { |
| 293 ASSERT_TRUE(db_thread_.Start()); | 292 ASSERT_TRUE(db_thread_.Start()); |
| 294 | 293 |
| 295 MockGnomeKeyringLoader::LoadMockGnomeKeyring(); | 294 MockGnomeKeyringLoader::LoadMockGnomeKeyring(); |
| (...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 894 RunBothThreads(); | 893 RunBothThreads(); |
| 895 | 894 |
| 896 // The other two copies of the password in different profiles should remain. | 895 // The other two copies of the password in different profiles should remain. |
| 897 EXPECT_EQ(2u, mock_keyring_items.size()); | 896 EXPECT_EQ(2u, mock_keyring_items.size()); |
| 898 if (mock_keyring_items.size() > 0) | 897 if (mock_keyring_items.size() > 0) |
| 899 CheckMockKeyringItem(&mock_keyring_items[0], form_google_, "chrome"); | 898 CheckMockKeyringItem(&mock_keyring_items[0], form_google_, "chrome"); |
| 900 if (mock_keyring_items.size() > 1) | 899 if (mock_keyring_items.size() > 1) |
| 901 CheckMockKeyringItem(&mock_keyring_items[1], form_google_, "chrome-42"); | 900 CheckMockKeyringItem(&mock_keyring_items[1], form_google_, "chrome-42"); |
| 902 } | 901 } |
| 903 } | 902 } |
| OLD | NEW |