| Index: chrome/browser/password_manager/keyring_proxy/gnome_keyring_loader_unittest.cc
|
| ===================================================================
|
| --- chrome/browser/password_manager/keyring_proxy/gnome_keyring_loader_unittest.cc (revision 0)
|
| +++ chrome/browser/password_manager/keyring_proxy/gnome_keyring_loader_unittest.cc (revision 0)
|
| @@ -0,0 +1,37 @@
|
| +// Copyright (c) 2011 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include <string.h>
|
| +
|
| +#include "chrome/browser/password_manager/keyring_proxy/gnome_keyring_loader.h"
|
| +#include "testing/gtest/include/gtest/gtest.h"
|
| +
|
| +namespace keyring_proxy {
|
| +
|
| +class TestKeyringLoader : public GnomeKeyringLoader {
|
| + public:
|
| + // Promote members to be public for testing.
|
| + using GnomeKeyringLoader::LoadGnomeKeyring;
|
| +#define GNOME_KEYRING_USE_KEYRING_METHOD(name) \
|
| + using GnomeKeyringLoader::gnome_keyring_##name;
|
| + GNOME_KEYRING_FOR_EACH_FUNC(GNOME_KEYRING_USE_KEYRING_METHOD)
|
| +#undef GNOME_KEYRING_USE_KEYRING_METHOD
|
| +};
|
| +
|
| +TEST(GnomeKeyringLoaderTest, LoadsGnomeKeyring) {
|
| + TestKeyringLoader loader;
|
| + EXPECT_TRUE(loader.LoadGnomeKeyring());
|
| + // Since the test is linked directly with libgnomekeyring, we can compare the
|
| + // results of dynamically loading it against the directly-linked symbols. But
|
| + // this only works correctly when compiled with -fPIC as otherwise the linked
|
| + // symbols go through local PLT stubs which makes the addresses not match.
|
| +#if defined(__PIC__)
|
| +#define GNOME_KEYRING_TEST_KEYRING_METHOD(name) \
|
| + EXPECT_EQ(&::gnome_keyring_##name, loader.gnome_keyring_##name);
|
| + GNOME_KEYRING_FOR_EACH_FUNC(GNOME_KEYRING_TEST_KEYRING_METHOD)
|
| +#undef GNOME_KEYRING_TEST_KEYRING_METHOD
|
| +#endif
|
| +}
|
| +
|
| +} // namespace keyring_proxy
|
|
|
| Property changes on: chrome/browser/password_manager/keyring_proxy/gnome_keyring_loader_unittest.cc
|
| ___________________________________________________________________
|
| Added: svn:eol-style
|
| + LF
|
|
|
|
|