Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(236)

Side by Side Diff: chrome_frame/test/chrome_frame_activex_unittest.cc

Issue 6386025: Disabling building of CEEE; we will be moving the code to a separate (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge to head Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome_frame/chrome_frame_activex_base.h ('k') | chrome_frame/test/chrome_frame_test_utils.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 //
5 // Unit tests for ChromeFrameActivex.
6
7 #include "chrome_frame/chrome_frame_activex.h"
8
9 #include "ceee/common/initializing_coclass.h"
10 #include "ceee/testing/utils/test_utils.h"
11 #include "ceee/testing/utils/mock_com.h"
12 #include "chrome_frame/test/chrome_tab_mocks.h"
13 #include "gtest/gtest.h"
14 #include "gmock/gmock.h"
15
16 namespace {
17
18 using testing::_;
19 using testing::AddRef;
20 using testing::DoAll;
21 using testing::IOleClientSiteMockImpl;
22 using testing::IServiceProviderMockImpl;
23 using testing::MockIChromeFramePrivileged;
24 using testing::Return;
25 using testing::SetArgumentPointee;
26 using testing::StrictMock;
27
28 // Just to unhide the static function.
29 class TestingChromeFrameActivex : public ChromeFrameActivex {
30 public:
31 static HRESULT TestingShouldShowVersionMismatchDialog(
32 bool is_privileged, IOleClientSite* client_site) {
33 return ShouldShowVersionMismatchDialog(is_privileged, client_site);
34 }
35 };
36
37 class MockChromeFrameClientSite
38 : public CComObjectRootEx<CComSingleThreadModel>,
39 public StrictMock<IOleClientSiteMockImpl>,
40 public StrictMock<IServiceProviderMockImpl> {
41 public:
42 DECLARE_NOT_AGGREGATABLE(MockChromeFrameClientSite)
43 BEGIN_COM_MAP(MockChromeFrameClientSite)
44 COM_INTERFACE_ENTRY(IOleClientSite)
45 COM_INTERFACE_ENTRY(IServiceProvider)
46 END_COM_MAP()
47 DECLARE_PROTECT_FINAL_CONSTRUCT()
48
49 HRESULT Initialize(MockChromeFrameClientSite** client_site) {
50 *client_site = this;
51 return S_OK;
52 }
53 };
54
55 TEST(ChromeFrameActivex, ShouldShowVersionMismatchDialog) {
56 // If not privileged, we always show the dialog.
57 ASSERT_TRUE(
58 TestingChromeFrameActivex::TestingShouldShowVersionMismatchDialog(
59 false, NULL));
60
61 MockChromeFrameClientSite* cs_keeper;
62 ScopedComPtr<IOleClientSite> cs;
63 ASSERT_HRESULT_SUCCEEDED(
64 InitializingCoClass<MockChromeFrameClientSite>::CreateInitialized(
65 &cs_keeper, cs.Receive()));
66
67 MockIChromeFramePrivileged* cfp_keeper;
68 ScopedComPtr<IChromeFramePrivileged> cfp;
69 ASSERT_HRESULT_SUCCEEDED(
70 InitializingCoClass<MockIChromeFramePrivileged>::CreateInitialized(
71 &cfp_keeper, cfp.Receive()));
72
73 EXPECT_CALL(*cs_keeper, QueryService(SID_ChromeFramePrivileged,
74 IID_IChromeFramePrivileged, _))
75 .WillRepeatedly(DoAll(AddRef(cfp.get()),
76 SetArgumentPointee<2>(static_cast<void*>(cfp)),
77 Return(S_OK)));
78
79 EXPECT_CALL(*cfp_keeper, ShouldShowVersionMismatchDialog())
80 .WillOnce(Return(S_OK));
81 ASSERT_TRUE(
82 TestingChromeFrameActivex::TestingShouldShowVersionMismatchDialog(
83 true, cs_keeper));
84
85 EXPECT_CALL(*cfp_keeper, ShouldShowVersionMismatchDialog())
86 .WillOnce(Return(S_FALSE));
87 ASSERT_FALSE(
88 TestingChromeFrameActivex::TestingShouldShowVersionMismatchDialog(
89 true, cs_keeper));
90
91 // Also test that we fail safe, showing the dialog unless we got
92 // an affirmative do-not-show.
93 EXPECT_CALL(*cfp_keeper, ShouldShowVersionMismatchDialog())
94 .WillOnce(Return(E_UNEXPECTED));
95 ASSERT_TRUE(
96 TestingChromeFrameActivex::TestingShouldShowVersionMismatchDialog(
97 true, cs_keeper));
98 }
99
100 } // namespace
OLDNEW
« no previous file with comments | « chrome_frame/chrome_frame_activex_base.h ('k') | chrome_frame/test/chrome_frame_test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698