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

Side by Side Diff: chrome_frame/chrome_frame_npapi_unittest.cc

Issue 1205001: Revert 42366 - Allow TabContentsDelegate classes to specify whether InfoBars ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 9 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_npapi.cc ('k') | chrome_frame/chrome_frame_plugin.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "gtest/gtest.h" 5 #include "gtest/gtest.h"
6 #include "gmock/gmock.h" 6 #include "gmock/gmock.h"
7 #include "chrome_frame/chrome_frame_automation.h" 7 #include "chrome_frame/chrome_frame_automation.h"
8 #include "chrome_frame/chrome_frame_npapi.h" 8 #include "chrome_frame/chrome_frame_npapi.h"
9 #include "chrome_frame/ff_privilege_check.h" 9 #include "chrome_frame/ff_privilege_check.h"
10 10
11 11
12 TEST(ChromeFrameNPAPI, DoesNotCrashOnConstruction) { 12 TEST(ChromeFrameNPAPI, DoesNotCrashOnConstruction) {
13 ChromeFrameNPAPI* api = new ChromeFrameNPAPI(); 13 ChromeFrameNPAPI* api = new ChromeFrameNPAPI();
14 delete api; 14 delete api;
15 } 15 }
16 16
17 17
18 // All mocks in the anonymous namespace. 18 // All mocks in the anonymous namespace.
19 namespace { 19 namespace {
20 20
21 using ::testing::_; 21 using ::testing::_;
22 using ::testing::Eq; 22 using ::testing::Eq;
23 using ::testing::Field;
24 using ::testing::Invoke; 23 using ::testing::Invoke;
25 using ::testing::Return; 24 using ::testing::Return;
26 using ::testing::StrEq; 25 using ::testing::StrEq;
27 26
28 // Make mocking privilege test easy. 27 // Make mocking privilege test easy.
29 class MockPrivilegeTest { 28 class MockPrivilegeTest {
30 public: 29 public:
31 MockPrivilegeTest() { 30 MockPrivilegeTest() {
32 CHECK(current_ == NULL); 31 CHECK(current_ == NULL);
33 current_ = this; 32 current_ = this;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 73
75 ChromeFrameAutomationClient* CreateAutomationClient() { 74 ChromeFrameAutomationClient* CreateAutomationClient() {
76 return mock_automation_client_; 75 return mock_automation_client_;
77 } 76 }
78 77
79 ChromeFrameAutomationClient* mock_automation_client_; 78 ChromeFrameAutomationClient* mock_automation_client_;
80 }; 79 };
81 80
82 class MockAutomationClient: public ChromeFrameAutomationClient { 81 class MockAutomationClient: public ChromeFrameAutomationClient {
83 public: 82 public:
84 MOCK_METHOD2(Initialize, bool(ChromeFrameDelegate*, ChromeFrameLaunchParams)); 83 MOCK_METHOD6(Initialize, bool(ChromeFrameDelegate*, int, bool,
84 const std::wstring&, const std::wstring&,
85 bool));
85 MOCK_METHOD1(SetEnableExtensionAutomation, 86 MOCK_METHOD1(SetEnableExtensionAutomation,
86 void(const std::vector<std::string>&)); // NOLINT 87 void(const std::vector<std::string>&)); // NOLINT
87 }; 88 };
88 89
89 class MockProxyService: public NpProxyService { 90 class MockProxyService: public NpProxyService {
90 public: 91 public:
91 MOCK_METHOD2(Initialize, bool(NPP instance, ChromeFrameAutomationClient*)); 92 MOCK_METHOD2(Initialize, bool(NPP instance, ChromeFrameAutomationClient*));
92 }; 93 };
93 94
94 95
(...skipping 24 matching lines...) Expand all
119 EXPECT_CALL(mock_api, GetLocation()) 120 EXPECT_CALL(mock_api, GetLocation())
120 .WillOnce(Return(std::string("http://www.google.com"))); 121 .WillOnce(Return(std::string("http://www.google.com")));
121 EXPECT_CALL(mock_api, CreatePrefService()) 122 EXPECT_CALL(mock_api, CreatePrefService())
122 .WillOnce(Return(mock_proxy)); 123 .WillOnce(Return(mock_proxy));
123 EXPECT_CALL(mock_api, GetBrowserIncognitoMode()) 124 EXPECT_CALL(mock_api, GetBrowserIncognitoMode())
124 .WillOnce(Return(is_incognito)); 125 .WillOnce(Return(is_incognito));
125 126
126 EXPECT_CALL(*mock_proxy, Initialize(_, _)).WillRepeatedly(Return(false)); 127 EXPECT_CALL(*mock_proxy, Initialize(_, _)).WillRepeatedly(Return(false));
127 128
128 EXPECT_CALL(*mock_automation, 129 EXPECT_CALL(*mock_automation,
129 Initialize(_, AllOf( 130 Initialize(_, _, true, StrEq(profile_name), StrEq(extra_args), false))
130 Field(&ChromeFrameLaunchParams::perform_version_check, true),
131 Field(&ChromeFrameLaunchParams::profile_name,
132 StrEq(profile_name)),
133 Field(&ChromeFrameLaunchParams::extra_chrome_arguments,
134 StrEq(extra_args)),
135 Field(&ChromeFrameLaunchParams::incognito_mode, is_incognito),
136 Field(&ChromeFrameLaunchParams::is_widget_mode, true))))
137 .WillOnce(Return(true)); 131 .WillOnce(Return(true));
138 132
139 if (expect_privilege_check) { 133 if (expect_privilege_check) {
140 EXPECT_CALL(mock_priv, IsFireFoxPrivilegedInvocation(_)) 134 EXPECT_CALL(mock_priv, IsFireFoxPrivilegedInvocation(_))
141 .WillOnce(Return(is_privileged)); 135 .WillOnce(Return(is_privileged));
142 } else { 136 } else {
143 EXPECT_CALL(mock_priv, IsFireFoxPrivilegedInvocation(_)) 137 EXPECT_CALL(mock_priv, IsFireFoxPrivilegedInvocation(_))
144 .Times(0); // Fail if privilege check invoked. 138 .Times(0); // Fail if privilege check invoked.
145 } 139 }
146 } 140 }
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 // And fething it should return the value we just set. 543 // And fething it should return the value we just set.
550 VOID_TO_NPVARIANT(var); 544 VOID_TO_NPVARIANT(var);
551 EXPECT_TRUE(mock_api.GetProperty(kOnPrivateMessageId, &var)); 545 EXPECT_TRUE(mock_api.GetProperty(kOnPrivateMessageId, &var));
552 EXPECT_TRUE(NPVARIANT_IS_OBJECT(var)); 546 EXPECT_TRUE(NPVARIANT_IS_OBJECT(var));
553 EXPECT_EQ(kMockNPObject, NPVARIANT_TO_OBJECT(var)); 547 EXPECT_EQ(kMockNPObject, NPVARIANT_TO_OBJECT(var));
554 548
555 mock_api.Uninitialize(); 549 mock_api.Uninitialize();
556 } 550 }
557 551
558 // TODO(siggi): test invoking postPrivateMessage. 552 // TODO(siggi): test invoking postPrivateMessage.
OLDNEW
« no previous file with comments | « chrome_frame/chrome_frame_npapi.cc ('k') | chrome_frame/chrome_frame_plugin.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698