Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / ui / base / dragdrop / os_exchange_data_win_unittest.cc
index 65066e1..36f235a 100644 (file)
@@ -3,7 +3,6 @@
 // found in the LICENSE file.
 
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_handle.h"
 #include "base/memory/scoped_ptr.h"
 #include "base/strings/utf_string_conversions.h"
 #include "base/win/scoped_hglobal.h"
@@ -30,7 +29,7 @@ TEST(OSExchangeDataWinTest, StringDataAccessViaCOM) {
   STGMEDIUM medium;
   EXPECT_EQ(S_OK, com_data->GetData(&format_etc, &medium));
   std::wstring output =
-      base::win::ScopedHGlobal<wchar_t>(medium.hGlobal).get();
+      base::win::ScopedHGlobal<wchar_t*>(medium.hGlobal).get();
   EXPECT_EQ(input, output);
   ReleaseStgMedium(&medium);
 }
@@ -52,7 +51,7 @@ TEST(OSExchangeDataWinTest, StringDataWritingViaCOM) {
   HGLOBAL glob = GlobalAlloc(GPTR, sizeof(wchar_t) * (input.size() + 1));
   size_t stringsz = input.size();
   SIZE_T sz = GlobalSize(glob);
-  base::win::ScopedHGlobal<wchar_t> global_lock(glob);
+  base::win::ScopedHGlobal<wchar_t*> global_lock(glob);
   wchar_t* buffer_handle = global_lock.get();
   wcscpy_s(buffer_handle, input.size() + 1, input.c_str());
   medium.hGlobal = glob;
@@ -62,12 +61,12 @@ TEST(OSExchangeDataWinTest, StringDataWritingViaCOM) {
   // Construct a new object with the old object so that we can use our access
   // APIs.
   OSExchangeData data2(data.provider().Clone());
-  EXPECT_TRUE(data2.HasURL());
+  EXPECT_TRUE(data2.HasURL(OSExchangeData::CONVERT_FILENAMES));
   GURL url_from_data;
   std::wstring title;
   EXPECT_TRUE(data2.GetURLAndTitle(
       OSExchangeData::CONVERT_FILENAMES, &url_from_data, &title));
-  GURL reference_url(input);
+  GURL reference_url(in put);
   EXPECT_EQ(reference_url.spec(), url_from_data.spec());
 }
 
@@ -90,7 +89,7 @@ TEST(OSExchangeDataWinTest, RemoveData) {
     HGLOBAL glob = GlobalAlloc(GPTR, sizeof(wchar_t) * (input.size() + 1));
     size_t stringsz = input.size();
     SIZE_T sz = GlobalSize(glob);
-    base::win::ScopedHGlobal<wchar_t> global_lock(glob);
+    base::win::ScopedHGlobal<wchar_t*> global_lock(glob);
     wchar_t* buffer_handle = global_lock.get();
     wcscpy_s(buffer_handle, input.size() + 1, input.c_str());
     medium.hGlobal = glob;
@@ -102,7 +101,7 @@ TEST(OSExchangeDataWinTest, RemoveData) {
     HGLOBAL glob = GlobalAlloc(GPTR, sizeof(wchar_t) * (input2.size() + 1));
     size_t stringsz = input2.size();
     SIZE_T sz = GlobalSize(glob);
-    base::win::ScopedHGlobal<wchar_t> global_lock(glob);
+    base::win::ScopedHGlobal<wchar_t*> global_lock(glob);
     wchar_t* buffer_handle = global_lock.get();
     wcscpy_s(buffer_handle, input2.size() + 1, input2.c_str());
     medium.hGlobal = glob;
@@ -114,7 +113,7 @@ TEST(OSExchangeDataWinTest, RemoveData) {
   // Construct a new object with the old object so that we can use our access
   // APIs.
   OSExchangeData data2(data.provider().Clone());
-  EXPECT_TRUE(data2.HasURL());
+  EXPECT_TRUE(data2.HasURL(OSExchangeData::CONVERT_FILENAMES));
   GURL url_from_data;
   std::wstring title;
   EXPECT_TRUE(data2.GetURLAndTitle(
@@ -137,7 +136,7 @@ TEST(OSExchangeDataWinTest, URLDataAccessViaCOM) {
   STGMEDIUM medium;
   EXPECT_EQ(S_OK, com_data->GetData(&format_etc, &medium));
   std::wstring output =
-      base::win::ScopedHGlobal<wchar_t>(medium.hGlobal).get();
+      base::win::ScopedHGlobal<wchar_t*>(medium.hGlobal).get();
   EXPECT_EQ(url.spec(), base::WideToUTF8(output));
   ReleaseStgMedium(&medium);
 }
@@ -164,7 +163,7 @@ TEST(OSExchangeDataWinTest, MultipleFormatsViaCOM) {
   STGMEDIUM medium;
   EXPECT_EQ(S_OK, com_data->GetData(&url_format_etc, &medium));
   std::wstring output_url =
-      base::win::ScopedHGlobal<wchar_t>(medium.hGlobal).get();
+      base::win::ScopedHGlobal<wchar_t*>(medium.hGlobal).get();
   EXPECT_EQ(url.spec(), base::WideToUTF8(output_url));
   ReleaseStgMedium(&medium);
 
@@ -172,7 +171,7 @@ TEST(OSExchangeDataWinTest, MultipleFormatsViaCOM) {
   // |text|! This is because the URL is added first and thus takes precedence!
   EXPECT_EQ(S_OK, com_data->GetData(&text_format_etc, &medium));
   std::wstring output_text =
-      base::win::ScopedHGlobal<wchar_t>(medium.hGlobal).get();
+      base::win::ScopedHGlobal<wchar_t*>(medium.hGlobal).get();
   EXPECT_EQ(url_spec, base::WideToUTF8(output_text));
   ReleaseStgMedium(&medium);
 }
@@ -285,7 +284,7 @@ TEST(OSExchangeDataWinTest, TestURLExchangeFormatsViaCOM) {
 
     STGMEDIUM medium;
     EXPECT_EQ(S_OK, com_data->GetData(&format_etc, &medium));
-    base::win::ScopedHGlobal<char> glob(medium.hGlobal);
+    base::win::ScopedHGlobal<char*> glob(medium.hGlobal);
     std::string output(glob.get(), glob.Size());
     std::string file_contents = "[InternetShortcut]\r\nURL=";
     file_contents += url_spec;
@@ -330,7 +329,7 @@ TEST(OSExchangeDataWinTest, CFHtml) {
   STGMEDIUM medium;
   IDataObject* data_object = OSExchangeDataProviderWin::GetIDataObject(data);
   EXPECT_EQ(S_OK, data_object->GetData(&format, &medium));
-  base::win::ScopedHGlobal<char> glob(medium.hGlobal);
+  base::win::ScopedHGlobal<char*> glob(medium.hGlobal);
   std::string output(glob.get(), glob.Size());
   EXPECT_EQ(expected_cf_html, output);
   ReleaseStgMedium(&medium);
@@ -347,7 +346,7 @@ TEST(OSExchangeDataWinTest, ProvideURLForPlainTextURL) {
   data.SetString(L"http://google.com");
 
   OSExchangeData data2(data.provider().Clone());
-  ASSERT_TRUE(data2.HasURL());
+  ASSERT_TRUE(data2.HasURL(OSExchangeData::CONVERT_FILENAMES));
   GURL read_url;
   std::wstring title;
   EXPECT_TRUE(data2.GetURLAndTitle(