diff options
-rw-r--r-- | chrome_frame/test/util_unittests.cc | 13 | ||||
-rw-r--r-- | chrome_frame/utils.cc | 6 | ||||
-rw-r--r-- | chrome_frame/utils.h | 2 |
3 files changed, 21 insertions, 0 deletions
diff --git a/chrome_frame/test/util_unittests.cc b/chrome_frame/test/util_unittests.cc index 9c0be26..6e066a1 100644 --- a/chrome_frame/test/util_unittests.cc +++ b/chrome_frame/test/util_unittests.cc @@ -91,3 +91,16 @@ TEST(UtilTests, IsValidUrlScheme) { EXPECT_EQ(test.expected, IsValidUrlScheme(test.url, test.is_privileged)); } } + +TEST(UtilTests, GuidToString) { + // {3C5E2125-35BA-48df-A841-5F669B9D69FC} + const GUID test_guid = { 0x3c5e2125, 0x35ba, 0x48df, + { 0xa8, 0x41, 0x5f, 0x66, 0x9b, 0x9d, 0x69, 0xfc } }; + + wchar_t compare[64] = {0}; + ::StringFromGUID2(test_guid, compare, arraysize(compare)); + + std::wstring str_guid(GuidToString(test_guid)); + EXPECT_EQ(0, str_guid.compare(compare)); + EXPECT_EQ(static_cast<size_t>(lstrlenW(compare)), str_guid.length()); +} diff --git a/chrome_frame/utils.cc b/chrome_frame/utils.cc index bd803bf..04bac77 100644 --- a/chrome_frame/utils.cc +++ b/chrome_frame/utils.cc @@ -828,6 +828,7 @@ bool IsSubFrameRequest(IUnknown* service_provider) { } } } else { + DLOG(INFO) << "IsSubFrameRequest - no IWebBrowser2"; is_sub_frame_request = true; } @@ -866,3 +867,8 @@ bool IsTopLevelWindow(HWND window) { return !parent || (parent == GetDesktopWindow()); } +std::wstring GuidToString(const GUID& guid) { + std::wstring ret; + ::StringFromGUID2(guid, WriteInto(&ret, 39), 39); + return ret; +} diff --git a/chrome_frame/utils.h b/chrome_frame/utils.h index 440c1b0..16fa836 100644 --- a/chrome_frame/utils.h +++ b/chrome_frame/utils.h @@ -335,6 +335,8 @@ class STAThread : public base::Thread { } }; +std::wstring GuidToString(const GUID& guid); + // The urls retrieved from the IMoniker interface don't contain the anchor // portion of the actual url navigated to. This function checks whether the // url passed in the bho_url parameter contains an anchor and if yes checks |