OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <atlbase.h> | 5 #include <atlbase.h> |
6 #include <atlwin.h> | 6 #include <atlwin.h> |
7 #include <atlhost.h> | 7 #include <atlhost.h> |
8 | 8 |
| 9 #include "base/test/perf_time_logger.h" |
9 #include "base/win/scoped_comptr.h" | 10 #include "base/win/scoped_comptr.h" |
10 #include "chrome_frame/test/perf/chrome_frame_perftest.h" | 11 #include "chrome_frame/test/perf/chrome_frame_perftest.h" |
11 | 12 |
12 interface IXcpControlDownloadCallback; | 13 interface IXcpControlDownloadCallback; |
13 interface __declspec(uuid("1B36028E-B491-4bb2-8584-8A9E0A677D6E")) | 14 interface __declspec(uuid("1B36028E-B491-4bb2-8584-8A9E0A677D6E")) |
14 IXcpControlHost : public IUnknown { | 15 IXcpControlHost : public IUnknown { |
15 typedef enum { | 16 typedef enum { |
16 XcpHostOption_FreezeOnInitialFrame = 0x001, | 17 XcpHostOption_FreezeOnInitialFrame = 0x001, |
17 XcpHostOption_DisableFullScreen = 0x002, | 18 XcpHostOption_DisableFullScreen = 0x002, |
18 XcpHostOption_DisableManagedExecution = 0x008, | 19 XcpHostOption_DisableManagedExecution = 0x008, |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 } | 67 } |
67 | 68 |
68 STDMETHOD(DownloadUrl)(BSTR bstrUrl, IXcpControlDownloadCallback* pCallback, | 69 STDMETHOD(DownloadUrl)(BSTR bstrUrl, IXcpControlDownloadCallback* pCallback, |
69 IStream** ppStream) { | 70 IStream** ppStream) { |
70 return E_NOTIMPL; | 71 return E_NOTIMPL; |
71 } | 72 } |
72 }; | 73 }; |
73 | 74 |
74 // Silverlight container. Supports do-nothing implementation of IXcpControlHost. | 75 // Silverlight container. Supports do-nothing implementation of IXcpControlHost. |
75 // Should be extended to do some real movie-or-something download. | 76 // Should be extended to do some real movie-or-something download. |
76 class SilverlightContainer : | 77 class SilverlightContainer |
77 public IServiceProviderImpl<SilverlightContainer>, | 78 : public IServiceProviderImpl<SilverlightContainer>, |
78 public IXcpControlHostImpl, | 79 public IXcpControlHostImpl, |
79 public CWindowImpl<SilverlightContainer, CWindow, CWinTraits< | 80 public CWindowImpl< |
80 WS_OVERLAPPEDWINDOW | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, | 81 SilverlightContainer, |
81 WS_EX_APPWINDOW | WS_EX_WINDOWEDGE> >, | 82 CWindow, |
82 public CComObjectRootEx<CComSingleThreadModel> { | 83 CWinTraits<WS_OVERLAPPEDWINDOW | WS_VISIBLE | WS_CLIPCHILDREN | |
| 84 WS_CLIPSIBLINGS, |
| 85 WS_EX_APPWINDOW | WS_EX_WINDOWEDGE> >, |
| 86 public CComObjectRootEx<CComSingleThreadModel> { |
83 public: | 87 public: |
84 DECLARE_WND_CLASS_EX(L"Silverlight_container", 0, 0) | 88 DECLARE_WND_CLASS_EX(L"Silverlight_container", 0, 0) |
85 BEGIN_COM_MAP(SilverlightContainer) | 89 BEGIN_COM_MAP(SilverlightContainer) |
86 COM_INTERFACE_ENTRY(IServiceProvider) | 90 COM_INTERFACE_ENTRY(IServiceProvider) |
87 COM_INTERFACE_ENTRY(IXcpControlHost) | 91 COM_INTERFACE_ENTRY(IXcpControlHost) |
88 END_COM_MAP() | 92 END_COM_MAP() |
89 | 93 |
90 BEGIN_SERVICE_MAP(SilverlightContainer) | 94 BEGIN_SERVICE_MAP(SilverlightContainer) |
91 SERVICE_ENTRY(__uuidof(IXcpControlHost)) | 95 SERVICE_ENTRY(__uuidof(IXcpControlHost)) |
92 END_SERVICE_MAP() | 96 END_SERVICE_MAP() |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 }; | 138 }; |
135 | 139 |
136 // Create and in-place Silverlight control. Should be extended to do something | 140 // Create and in-place Silverlight control. Should be extended to do something |
137 // more meaningful. | 141 // more meaningful. |
138 TEST(ChromeFramePerf, DISABLED_HostSilverlight2) { | 142 TEST(ChromeFramePerf, DISABLED_HostSilverlight2) { |
139 SimpleModule module; | 143 SimpleModule module; |
140 AtlAxWinInit(); | 144 AtlAxWinInit(); |
141 CComObjectStackEx<SilverlightContainer> wnd; | 145 CComObjectStackEx<SilverlightContainer> wnd; |
142 RECT rc = {0, 0, 800, 600}; | 146 RECT rc = {0, 0, 800, 600}; |
143 wnd.CreateWndAndHost(&rc); | 147 wnd.CreateWndAndHost(&rc); |
144 PerfTimeLogger perf_create("Create Silverlight Control2"); | 148 base::PerfTimeLogger perf_create("Create Silverlight Control2"); |
145 wnd.CreateControl(); | 149 wnd.CreateControl(); |
146 perf_create.Done(); | 150 perf_create.Done(); |
147 wnd.DestroyWindow(); | 151 wnd.DestroyWindow(); |
148 } | 152 } |
149 | 153 |
150 // Simplest test - creates in-place Silverlight control. | 154 // Simplest test - creates in-place Silverlight control. |
151 TEST(ChromeFramePerf, DISABLED_HostSilverlight) { | 155 TEST(ChromeFramePerf, DISABLED_HostSilverlight) { |
152 SimpleModule module; | 156 SimpleModule module; |
153 AtlAxWinInit(); | 157 AtlAxWinInit(); |
154 CAxWindow host; | 158 CAxWindow host; |
155 RECT rc = {0, 0, 800, 600}; | 159 RECT rc = {0, 0, 800, 600}; |
156 PerfTimeLogger perf_create("Create Silverlight Control"); | 160 base::PerfTimeLogger perf_create("Create Silverlight Control"); |
157 host.Create(NULL, rc, L"AgControl.AgControl", | 161 host.Create(NULL, rc, L"AgControl.AgControl", |
158 WS_OVERLAPPEDWINDOW | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, | 162 WS_OVERLAPPEDWINDOW | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, |
159 WS_EX_APPWINDOW | WS_EX_WINDOWEDGE); | 163 WS_EX_APPWINDOW | WS_EX_WINDOWEDGE); |
160 EXPECT_TRUE(host.m_hWnd != NULL); | 164 EXPECT_TRUE(host.m_hWnd != NULL); |
161 base::win::ScopedComPtr<IDispatch> disp; | 165 base::win::ScopedComPtr<IDispatch> disp; |
162 HRESULT hr = host.QueryControl(disp.Receive()); | 166 HRESULT hr = host.QueryControl(disp.Receive()); |
163 EXPECT_HRESULT_SUCCEEDED(hr); | 167 EXPECT_HRESULT_SUCCEEDED(hr); |
164 disp.Release(); | 168 disp.Release(); |
165 perf_create.Done(); | 169 perf_create.Done(); |
166 } | 170 } |
167 | 171 |
OLD | NEW |