OLD | NEW |
---|---|
1 // Copyright (c) 2009 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 #include <atlbase.h> | 5 #include <atlbase.h> |
5 #include <atlwin.h> | 6 #include <atlwin.h> |
6 #include <atlhost.h> | 7 #include <atlhost.h> |
7 #include "base/scoped_comptr_win.h" | 8 |
9 #include "base/win/scoped_comptr.h" | |
8 #include "chrome_frame/test/perf/chrome_frame_perftest.h" | 10 #include "chrome_frame/test/perf/chrome_frame_perftest.h" |
9 | 11 |
10 interface IXcpControlDownloadCallback; | 12 interface IXcpControlDownloadCallback; |
11 interface __declspec(uuid("1B36028E-B491-4bb2-8584-8A9E0A677D6E")) | 13 interface __declspec(uuid("1B36028E-B491-4bb2-8584-8A9E0A677D6E")) |
12 IXcpControlHost : public IUnknown { | 14 IXcpControlHost : public IUnknown { |
13 typedef enum { | 15 typedef enum { |
14 XcpHostOption_FreezeOnInitialFrame = 0x001, | 16 XcpHostOption_FreezeOnInitialFrame = 0x001, |
15 XcpHostOption_DisableFullScreen = 0x002, | 17 XcpHostOption_DisableFullScreen = 0x002, |
16 XcpHostOption_DisableManagedExecution = 0x008, | 18 XcpHostOption_DisableManagedExecution = 0x008, |
17 XcpHostOption_EnableCrossDomainDownloads = 0x010, | 19 XcpHostOption_EnableCrossDomainDownloads = 0x010, |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
64 } | 66 } |
65 | 67 |
66 STDMETHOD(DownloadUrl)(BSTR bstrUrl, IXcpControlDownloadCallback* pCallback, | 68 STDMETHOD(DownloadUrl)(BSTR bstrUrl, IXcpControlDownloadCallback* pCallback, |
67 IStream** ppStream) { | 69 IStream** ppStream) { |
68 return E_NOTIMPL; | 70 return E_NOTIMPL; |
69 } | 71 } |
70 }; | 72 }; |
71 | 73 |
72 // Silverlight container. Supports do-nothing implementation of IXcpControlHost. | 74 // Silverlight container. Supports do-nothing implementation of IXcpControlHost. |
73 // Should be extended to do some real movie-or-something download. | 75 // Should be extended to do some real movie-or-something download. |
74 class SilverlightContainer : | 76 class SilverlightContainer : public IServiceProviderImpl<SilverlightContainer>, |
brettw
2011/04/12 19:53:49
I think the old indenting was better here.
tfarina
2011/04/12 20:06:51
Reverted this change. Lint just complained, so I t
| |
75 public IServiceProviderImpl<SilverlightContainer>, | 77 public IXcpControlHostImpl, |
76 public IXcpControlHostImpl, | 78 public CWindowImpl< |
77 public CWindowImpl<SilverlightContainer, CWindow, CWinTraits< | 79 SilverlightContainer, CWindow, CWinTraits< |
78 WS_OVERLAPPEDWINDOW | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, | 80 WS_OVERLAPPEDWINDOW | WS_VISIBLE | WS_CLIPCHILDREN | |
79 WS_EX_APPWINDOW | WS_EX_WINDOWEDGE> >, | 81 WS_CLIPSIBLINGS, WS_EX_APPWINDOW | WS_EX_WINDOWEDGE> >, |
80 public CComObjectRootEx<CComSingleThreadModel> { | 82 public CComObjectRootEx<CComSingleThreadModel> { |
81 public: | 83 public: |
82 DECLARE_WND_CLASS_EX(L"Silverlight_container", 0, 0) | 84 DECLARE_WND_CLASS_EX(L"Silverlight_container", 0, 0) |
83 BEGIN_COM_MAP(SilverlightContainer) | 85 BEGIN_COM_MAP(SilverlightContainer) |
84 COM_INTERFACE_ENTRY(IServiceProvider) | 86 COM_INTERFACE_ENTRY(IServiceProvider) |
85 COM_INTERFACE_ENTRY(IXcpControlHost) | 87 COM_INTERFACE_ENTRY(IXcpControlHost) |
86 END_COM_MAP() | 88 END_COM_MAP() |
87 | 89 |
88 BEGIN_SERVICE_MAP(SilverlightContainer) | 90 BEGIN_SERVICE_MAP(SilverlightContainer) |
89 SERVICE_ENTRY(__uuidof(IXcpControlHost)) | 91 SERVICE_ENTRY(__uuidof(IXcpControlHost)) |
90 END_SERVICE_MAP() | 92 END_SERVICE_MAP() |
(...skipping 30 matching lines...) Expand all Loading... | |
121 } | 123 } |
122 return hr; | 124 return hr; |
123 } | 125 } |
124 | 126 |
125 HRESULT CreateControl() { | 127 HRESULT CreateControl() { |
126 HRESULT hr = host_->CreateControl(L"AgControl.AgControl", m_hWnd, NULL); | 128 HRESULT hr = host_->CreateControl(L"AgControl.AgControl", m_hWnd, NULL); |
127 EXPECT_HRESULT_SUCCEEDED(hr); | 129 EXPECT_HRESULT_SUCCEEDED(hr); |
128 return hr; | 130 return hr; |
129 } | 131 } |
130 | 132 |
131 ScopedComPtr<IAxWinHostWindow> host_; | 133 base::win::ScopedComPtr<IAxWinHostWindow> host_; |
132 }; | 134 }; |
133 | 135 |
134 // Create and in-place Silverlight control. Should be extended to do something | 136 // Create and in-place Silverlight control. Should be extended to do something |
135 // more meaningful. | 137 // more meaningful. |
136 TEST(ChromeFramePerf, DISABLED_HostSilverlight2) { | 138 TEST(ChromeFramePerf, DISABLED_HostSilverlight2) { |
137 SimpleModule module; | 139 SimpleModule module; |
138 AtlAxWinInit(); | 140 AtlAxWinInit(); |
139 CComObjectStackEx<SilverlightContainer> wnd; | 141 CComObjectStackEx<SilverlightContainer> wnd; |
140 RECT rc = {0, 0, 800, 600}; | 142 RECT rc = {0, 0, 800, 600}; |
141 wnd.CreateWndAndHost(&rc); | 143 wnd.CreateWndAndHost(&rc); |
142 PerfTimeLogger perf_create("Create Silverlight Control2"); | 144 PerfTimeLogger perf_create("Create Silverlight Control2"); |
143 wnd.CreateControl(); | 145 wnd.CreateControl(); |
144 perf_create.Done(); | 146 perf_create.Done(); |
145 wnd.DestroyWindow(); | 147 wnd.DestroyWindow(); |
146 } | 148 } |
147 | 149 |
148 // Simplest test - creates in-place Silverlight control. | 150 // Simplest test - creates in-place Silverlight control. |
149 TEST(ChromeFramePerf, DISABLED_HostSilverlight) { | 151 TEST(ChromeFramePerf, DISABLED_HostSilverlight) { |
150 SimpleModule module; | 152 SimpleModule module; |
151 AtlAxWinInit(); | 153 AtlAxWinInit(); |
152 CAxWindow host; | 154 CAxWindow host; |
153 RECT rc = {0, 0, 800, 600}; | 155 RECT rc = {0, 0, 800, 600}; |
154 PerfTimeLogger perf_create("Create Silverlight Control"); | 156 PerfTimeLogger perf_create("Create Silverlight Control"); |
155 host.Create(NULL, rc, L"AgControl.AgControl", | 157 host.Create(NULL, rc, L"AgControl.AgControl", |
156 WS_OVERLAPPEDWINDOW | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, | 158 WS_OVERLAPPEDWINDOW | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, |
157 WS_EX_APPWINDOW | WS_EX_WINDOWEDGE); | 159 WS_EX_APPWINDOW | WS_EX_WINDOWEDGE); |
158 EXPECT_TRUE(host.m_hWnd != NULL); | 160 EXPECT_TRUE(host.m_hWnd != NULL); |
159 ScopedComPtr<IDispatch> disp; | 161 base::win::ScopedComPtr<IDispatch> disp; |
160 HRESULT hr = host.QueryControl(disp.Receive()); | 162 HRESULT hr = host.QueryControl(disp.Receive()); |
161 EXPECT_HRESULT_SUCCEEDED(hr); | 163 EXPECT_HRESULT_SUCCEEDED(hr); |
162 disp.Release(); | 164 disp.Release(); |
163 perf_create.Done(); | 165 perf_create.Done(); |
164 } | 166 } |
165 | 167 |
OLD | NEW |