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

Side by Side Diff: chrome_frame/chrome_frame_npapi_unittest.cc

Issue 6756044: Remove extension automation support that was used only by CEEE. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to lkgr. Created 9 years, 8 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
OLDNEW
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
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 TEST(ChromeFrameNPAPI, DoesNotCrashOnConstruction) { 11 TEST(ChromeFrameNPAPI, DoesNotCrashOnConstruction) {
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 return mock_automation_client_; 72 return mock_automation_client_;
73 } 73 }
74 74
75 ChromeFrameAutomationClient* mock_automation_client_; 75 ChromeFrameAutomationClient* mock_automation_client_;
76 }; 76 };
77 77
78 class MockAutomationClient: public ChromeFrameAutomationClient { 78 class MockAutomationClient: public ChromeFrameAutomationClient {
79 public: 79 public:
80 MOCK_METHOD2(Initialize, bool(ChromeFrameDelegate*, 80 MOCK_METHOD2(Initialize, bool(ChromeFrameDelegate*,
81 ChromeFrameLaunchParams*)); 81 ChromeFrameLaunchParams*));
82 MOCK_METHOD1(SetEnableExtensionAutomation,
83 void(const std::vector<std::string>&)); // NOLINT
84 }; 82 };
85 83
86 class MockProxyService: public NpProxyService { 84 class MockProxyService: public NpProxyService {
87 public: 85 public:
88 MOCK_METHOD2(Initialize, bool(NPP instance, ChromeFrameAutomationClient*)); 86 MOCK_METHOD2(Initialize, bool(NPP instance, ChromeFrameAutomationClient*));
89 }; 87 };
90 88
91 namespace { 89 namespace {
92 90
93 MATCHER_P4(LaunchParamEq, version_check, extra, incognito, widget, 91 MATCHER_P4(LaunchParamEq, version_check, extra, incognito, widget,
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 } 306 }
309 307
310 TEST_F(TestNPAPIPrivilegedApi, PrivilegedAllowsArgsAndProfile) { 308 TEST_F(TestNPAPIPrivilegedApi, PrivilegedAllowsArgsAndProfile) {
311 SetupPrivilegeTest(false, // Not incognito. 309 SetupPrivilegeTest(false, // Not incognito.
312 true, // Fail unless privilege check is invoked. 310 true, // Fail unless privilege check is invoked.
313 true, // Privileged mode. 311 true, // Privileged mode.
314 L"custom_profile_name", // Custom profile expected. 312 L"custom_profile_name", // Custom profile expected.
315 L"", // No specific language override. 313 L"", // No specific language override.
316 L"-bar=far"); // Extra arguments expected 314 L"-bar=far"); // Extra arguments expected
317 315
318 // With privileged mode we expect automation to be enabled.
319 EXPECT_CALL(*mock_automation, SetEnableExtensionAutomation(_))
320 .Times(1);
321
322 char* argn[] = { 316 char* argn[] = {
323 "privileged_mode", 317 "privileged_mode",
324 "chrome_extra_arguments", 318 "chrome_extra_arguments",
325 "chrome_profile_name", 319 "chrome_profile_name",
326 }; 320 };
327 char *argv[] = { 321 char *argv[] = {
328 "1", 322 "1",
329 "-bar=far", 323 "-bar=far",
330 "custom_profile_name", 324 "custom_profile_name",
331 }; 325 };
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 public: 393 public:
400 virtual void SetUp() { 394 virtual void SetUp() {
401 TestNPAPIPrivilegedApi::SetUp(); 395 TestNPAPIPrivilegedApi::SetUp();
402 396
403 // Expect calls to release and retain objects. 397 // Expect calls to release and retain objects.
404 EXPECT_CALL(mock_funcs, RetainObject(kMockNPObject)) 398 EXPECT_CALL(mock_funcs, RetainObject(kMockNPObject))
405 .WillRepeatedly(Return(kMockNPObject)); 399 .WillRepeatedly(Return(kMockNPObject));
406 EXPECT_CALL(mock_funcs, ReleaseObject(kMockNPObject)) 400 EXPECT_CALL(mock_funcs, ReleaseObject(kMockNPObject))
407 .WillRepeatedly(Return()); 401 .WillRepeatedly(Return());
408 402
409 // And we should expect SetEnableExtensionAutomation to be called
410 // for privileged tests.
411 EXPECT_CALL(*mock_automation, SetEnableExtensionAutomation(_))
412 .WillRepeatedly(Return());
413
414 // Initializes identifiers. 403 // Initializes identifiers.
415 EXPECT_CALL(mock_funcs, GetStringIdentifiers(_, _, _)) 404 EXPECT_CALL(mock_funcs, GetStringIdentifiers(_, _, _))
416 .WillRepeatedly( 405 .WillRepeatedly(
417 Invoke(&mock_funcs, 406 Invoke(&mock_funcs,
418 &MockNetscapeFuncs::GetPrivilegedStringIdentifiers)); 407 &MockNetscapeFuncs::GetPrivilegedStringIdentifiers));
419 MockNPAPI::InitializeIdentifiers(); 408 MockNPAPI::InitializeIdentifiers();
420 } 409 }
421 410
422 virtual void TearDown() { 411 virtual void TearDown() {
423 TestNPAPIPrivilegedApi::TearDown(); 412 TestNPAPIPrivilegedApi::TearDown();
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 // And fething it should return the value we just set. 553 // And fething it should return the value we just set.
565 VOID_TO_NPVARIANT(var); 554 VOID_TO_NPVARIANT(var);
566 EXPECT_TRUE(mock_api.GetProperty(kOnPrivateMessageId, &var)); 555 EXPECT_TRUE(mock_api.GetProperty(kOnPrivateMessageId, &var));
567 EXPECT_TRUE(NPVARIANT_IS_OBJECT(var)); 556 EXPECT_TRUE(NPVARIANT_IS_OBJECT(var));
568 EXPECT_EQ(kMockNPObject, NPVARIANT_TO_OBJECT(var)); 557 EXPECT_EQ(kMockNPObject, NPVARIANT_TO_OBJECT(var));
569 558
570 mock_api.Uninitialize(); 559 mock_api.Uninitialize();
571 } 560 }
572 561
573 // TODO(siggi): test invoking postPrivateMessage. 562 // TODO(siggi): test invoking postPrivateMessage.
574
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698