diff options
author | maruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-13 17:52:48 +0000 |
---|---|---|
committer | maruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-13 17:52:48 +0000 |
commit | 00ffe5dd99527a0cb1035af6749417f5fb1c134e (patch) | |
tree | 4354d5b35be202204d9392417862b423ba374ce0 /app | |
parent | 65f73a3a996bdbaa167e38704df092aa39b53d3a (diff) | |
download | chromium_src-00ffe5dd99527a0cb1035af6749417f5fb1c134e.zip chromium_src-00ffe5dd99527a0cb1035af6749417f5fb1c134e.tar.gz chromium_src-00ffe5dd99527a0cb1035af6749417f5fb1c134e.tar.bz2 |
Revert 15965. I wasn't supposed to check that in since it still doesn't compile on linux and mac!
TBR=sky
Review URL: http://codereview.chromium.org/113351
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15967 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'app')
-rw-r--r-- | app/os_exchange_data.cc | 2 | ||||
-rw-r--r-- | app/os_exchange_data.h | 5 | ||||
-rw-r--r-- | app/os_exchange_data_unittest.cc | 28 |
3 files changed, 21 insertions, 14 deletions
diff --git a/app/os_exchange_data.cc b/app/os_exchange_data.cc index e27c6fd..c9e2311 100644 --- a/app/os_exchange_data.cc +++ b/app/os_exchange_data.cc @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <shlobj.h> + #include "app/os_exchange_data.h" #include "app/l10n_util.h" diff --git a/app/os_exchange_data.h b/app/os_exchange_data.h index 4a8fbc4..5668008 100644 --- a/app/os_exchange_data.h +++ b/app/os_exchange_data.h @@ -5,10 +5,11 @@ #ifndef APP_OS_EXCHANGE_DATA_H_ #define APP_OS_EXCHANGE_DATA_H_ +#include <atlbase.h> #include <objidl.h> #include <vector> -#include "base/scoped_comptr_win.h" +#include "base/basictypes.h" class GURL; class Pickle; @@ -133,7 +134,7 @@ class OSExchangeData : public IDataObject { typedef std::vector<StoredDataInfo*> StoredData; StoredData contents_; - ScopedComPtr<IDataObject> source_object_; + CComPtr<IDataObject> source_object_; LONG ref_count_; diff --git a/app/os_exchange_data_unittest.cc b/app/os_exchange_data_unittest.cc index 981a8d1..13a28a9 100644 --- a/app/os_exchange_data_unittest.cc +++ b/app/os_exchange_data_unittest.cc @@ -2,6 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <atlbase.h> +#include <shlobj.h> + #include "app/os_exchange_data.h" #include "base/clipboard_util.h" #include "base/pickle.h" @@ -39,7 +42,7 @@ TEST(OSExchangeDataTest, StringDataAccessViaCOM) { OSExchangeData* data = new OSExchangeData; std::wstring input = L"O hai googlz."; data->SetString(input); - ScopedComPtr<IDataObject> com_data(data); + CComPtr<IDataObject> com_data(data); FORMATETC format_etc = { CF_UNICODETEXT, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL }; @@ -51,6 +54,8 @@ TEST(OSExchangeDataTest, StringDataAccessViaCOM) { ScopedHGlobal<wchar_t>(medium.hGlobal).get(); EXPECT_EQ(input, output); ReleaseStgMedium(&medium); + + // data is freed automatically by CComPtr. } // Test setting using the IDataObject COM API @@ -58,7 +63,7 @@ TEST(OSExchangeDataTest, StringDataWritingViaCOM) { OSExchangeData* data = new OSExchangeData; std::wstring input = L"http://www.google.com/"; - ScopedComPtr<IDataObject> com_data(data); + CComPtr<IDataObject> com_data(data); // Store data in the object using the COM SetData API. CLIPFORMAT cfstr_ineturl = RegisterClipboardFormat(CFSTR_INETURL); @@ -93,7 +98,7 @@ TEST(OSExchangeDataTest, URLDataAccessViaCOM) { OSExchangeData* data = new OSExchangeData; GURL url("http://www.google.com/"); data->SetURL(url, L""); - ScopedComPtr<IDataObject> com_data(data); + CComPtr<IDataObject> com_data(data); CLIPFORMAT cfstr_ineturl = RegisterClipboardFormat(CFSTR_INETURL); FORMATETC format_etc = @@ -116,7 +121,7 @@ TEST(OSExchangeDataTest, MultipleFormatsViaCOM) { data->SetURL(url, L"Google"); data->SetString(text); - ScopedComPtr<IDataObject> com_data(data); + CComPtr<IDataObject> com_data(data); CLIPFORMAT cfstr_ineturl = RegisterClipboardFormat(CFSTR_INETURL); FORMATETC url_format_etc = @@ -151,10 +156,9 @@ TEST(OSExchangeDataTest, EnumerationViaCOM) { RegisterClipboardFormat(CFSTR_FILEDESCRIPTOR); CLIPFORMAT text_x_moz_url = RegisterClipboardFormat(L"text/x-moz-url"); - ScopedComPtr<IDataObject> com_data(data); - ScopedComPtr<IEnumFORMATETC> enumerator; - EXPECT_EQ(S_OK, com_data.get()->EnumFormatEtc(DATADIR_GET, - enumerator.Receive())); + CComPtr<IDataObject> com_data(data); + CComPtr<IEnumFORMATETC> enumerator; + EXPECT_EQ(S_OK, com_data->EnumFormatEtc(DATADIR_GET, &enumerator)); // Test that we can get one item. { @@ -206,9 +210,9 @@ TEST(OSExchangeDataTest, EnumerationViaCOM) { { EXPECT_EQ(S_OK, enumerator->Reset()); EXPECT_EQ(S_OK, enumerator->Skip(1)); - ScopedComPtr<IEnumFORMATETC> cloned_enumerator; - EXPECT_EQ(S_OK, enumerator.get()->Clone(cloned_enumerator.Receive())); - EXPECT_EQ(S_OK, enumerator.get()->Reset()); + CComPtr<IEnumFORMATETC> cloned_enumerator; + EXPECT_EQ(S_OK, enumerator->Clone(&cloned_enumerator)); + EXPECT_EQ(S_OK, enumerator->Reset()); { ULONG retrieved = 0; @@ -253,7 +257,7 @@ TEST(OSExchangeDataTest, TestURLExchangeFormats) { EXPECT_EQ(url_spec, WideToUTF8(output_string)); // File contents access via COM - ScopedComPtr<IDataObject> com_data(data); + CComPtr<IDataObject> com_data(data); { CLIPFORMAT cfstr_file_contents = RegisterClipboardFormat(CFSTR_FILECONTENTS); |