summaryrefslogtreecommitdiffstats
path: root/base/scoped_native_library_unittest.cc
diff options
context:
space:
mode:
authorhbono@chromium.org <hbono@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-10 06:23:35 +0000
committerhbono@chromium.org <hbono@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-10 06:23:35 +0000
commitda2566e16fff66dd911994e17d649e478a7beea1 (patch)
treedcc1cc71232331e2d8c4dbe2173da7bc9119a496 /base/scoped_native_library_unittest.cc
parentf988638e6ea5a3f16e289be9ac7ffd853f7a13e4 (diff)
downloadchromium_src-da2566e16fff66dd911994e17d649e478a7beea1.zip
chromium_src-da2566e16fff66dd911994e17d649e478a7beea1.tar.gz
chromium_src-da2566e16fff66dd911994e17d649e478a7beea1.tar.bz2
Implements AeroPeek of Windows 7.
This change integrates the custom AeroPeek implementation into Chromium, which shows the thumbnail list of all tabs and the preview image of the tab selected from the thumbnail list. It uses the AeroPeekManager object, which is a proxy between TabStripModel and Windows to translate events from TabStripModel for Windows, and vice versa. To listen events from TabStripModel without changing the existing part of Chromium, this AeroPeekManager class implements the TabStripModelObserver interface. Even though this change doesn't include any automated tests for AeroPeek, I would like to send its automated UI test as a separate change. Nevertheless, it just creates/deletes a tab and see this AeroPeekManager can create its thumbnail window correctly. BUG=6337 TEST=base_unittests.exe --gtest_filter=ScopedNativeLibrary.Basic Review URL: http://codereview.chromium.org/303033 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41133 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/scoped_native_library_unittest.cc')
-rw-r--r--base/scoped_native_library_unittest.cc30
1 files changed, 30 insertions, 0 deletions
diff --git a/base/scoped_native_library_unittest.cc b/base/scoped_native_library_unittest.cc
new file mode 100644
index 0000000..178e20d
--- /dev/null
+++ b/base/scoped_native_library_unittest.cc
@@ -0,0 +1,30 @@
+// Copyright (c) 2010 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 "base/scoped_native_library.h"
+
+#include "testing/gtest/include/gtest/gtest.h"
+
+// Tests whether or not a function pointer retrieved via ScopedNativeLibrary
+// is available only in a scope.
+TEST(ScopedNativeLibrary, Basic) {
+#if defined(OS_WIN)
+ // Get the pointer to DirectDrawCreate() from "ddraw.dll" and verify it
+ // is valid only in this scope.
+ // FreeLibrary() doesn't actually unload a DLL until its reference count
+ // becomes zero, i.e. this function pointer is still valid if the DLL used
+ // in this test is also used by another part of this executable.
+ // So, this test uses "ddraw.dll", which is not used by Chrome at all but
+ // installed on all versions of Windows.
+ FARPROC test_function;
+ {
+ FilePath path(base::GetNativeLibraryName(L"ddraw"));
+ base::ScopedNativeLibrary library(path);
+ test_function = reinterpret_cast<FARPROC>(
+ library.GetFunctionPointer("DirectDrawCreate"));
+ EXPECT_EQ(0, IsBadCodePtr(test_function));
+ }
+ EXPECT_NE(0, IsBadCodePtr(test_function));
+#endif
+}