OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "base/bind_helpers.h" | |
6 #include "base/command_line.h" | 5 #include "base/command_line.h" |
7 #include "base/strings/string_number_conversions.h" | 6 #include "base/strings/string_number_conversions.h" |
8 #include "base/strings/string_util.h" | 7 #include "base/strings/string_util.h" |
9 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
10 #include "base/values.h" | 9 #include "base/values.h" |
11 #include "chrome/browser/extensions/dev_mode_bubble_delegate.h" | 10 #include "chrome/browser/extensions/dev_mode_bubble_delegate.h" |
12 #include "chrome/browser/extensions/extension_function_test_utils.h" | 11 #include "chrome/browser/extensions/extension_function_test_utils.h" |
13 #include "chrome/browser/extensions/extension_service.h" | 12 #include "chrome/browser/extensions/extension_service.h" |
14 #include "chrome/browser/extensions/ntp_overridden_bubble_delegate.h" | 13 #include "chrome/browser/extensions/ntp_overridden_bubble_delegate.h" |
15 #include "chrome/browser/extensions/proxy_overridden_bubble_delegate.h" | 14 #include "chrome/browser/extensions/proxy_overridden_bubble_delegate.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 action_button_callback_count_(0), | 52 action_button_callback_count_(0), |
54 dismiss_button_callback_count_(0), | 53 dismiss_button_callback_count_(0), |
55 link_click_callback_count_(0) {} | 54 link_click_callback_count_(0) {} |
56 ~TestExtensionMessageBubbleController() override {} | 55 ~TestExtensionMessageBubbleController() override {} |
57 | 56 |
58 // ExtensionMessageBubbleController: | 57 // ExtensionMessageBubbleController: |
59 void OnBubbleAction() override { | 58 void OnBubbleAction() override { |
60 ++action_button_callback_count_; | 59 ++action_button_callback_count_; |
61 ExtensionMessageBubbleController::OnBubbleAction(); | 60 ExtensionMessageBubbleController::OnBubbleAction(); |
62 } | 61 } |
63 void OnBubbleDismiss(bool by_deactivation) override { | 62 void OnBubbleDismiss() override { |
64 ++dismiss_button_callback_count_; | 63 ++dismiss_button_callback_count_; |
65 ExtensionMessageBubbleController::OnBubbleDismiss(by_deactivation); | 64 ExtensionMessageBubbleController::OnBubbleDismiss(); |
66 } | 65 } |
67 void OnLinkClicked() override { | 66 void OnLinkClicked() override { |
68 ++link_click_callback_count_; | 67 ++link_click_callback_count_; |
69 ExtensionMessageBubbleController::OnLinkClicked(); | 68 ExtensionMessageBubbleController::OnLinkClicked(); |
70 } | 69 } |
71 | 70 |
72 size_t action_click_count() { return action_button_callback_count_; } | 71 size_t action_click_count() { return action_button_callback_count_; } |
73 size_t dismiss_click_count() { return dismiss_button_callback_count_; } | 72 size_t dismiss_click_count() { return dismiss_button_callback_count_; } |
74 size_t link_click_count() { return link_click_callback_count_; } | 73 size_t link_click_count() { return link_click_callback_count_; } |
75 | 74 |
76 private: | 75 private: |
77 // How often each button has been called. | 76 // How often each button has been called. |
78 size_t action_button_callback_count_; | 77 size_t action_button_callback_count_; |
79 size_t dismiss_button_callback_count_; | 78 size_t dismiss_button_callback_count_; |
80 size_t link_click_callback_count_; | 79 size_t link_click_callback_count_; |
81 | 80 |
82 DISALLOW_COPY_AND_ASSIGN(TestExtensionMessageBubbleController); | 81 DISALLOW_COPY_AND_ASSIGN(TestExtensionMessageBubbleController); |
83 }; | 82 }; |
84 | 83 |
85 // A fake bubble used for testing the controller. Takes an action that specifies | 84 // A fake bubble used for testing the controller. Takes an action that specifies |
86 // what should happen when the bubble is "shown" (the bubble is actually not | 85 // what should happen when the bubble is "shown" (the bubble is actually not |
87 // shown, the corresponding action is taken immediately). | 86 // shown, the corresponding action is taken immediately). |
88 class FakeExtensionMessageBubble { | 87 class FakeExtensionMessageBubble { |
89 public: | 88 public: |
90 enum ExtensionBubbleAction { | 89 enum ExtensionBubbleAction { |
91 BUBBLE_ACTION_CLICK_ACTION_BUTTON = 0, | 90 BUBBLE_ACTION_CLICK_ACTION_BUTTON = 0, |
92 BUBBLE_ACTION_CLICK_DISMISS_BUTTON, | 91 BUBBLE_ACTION_CLICK_DISMISS_BUTTON, |
93 BUBBLE_ACTION_DISMISS_DEACTIVATION, | |
94 BUBBLE_ACTION_CLICK_LINK, | 92 BUBBLE_ACTION_CLICK_LINK, |
95 }; | 93 }; |
96 | 94 |
97 FakeExtensionMessageBubble() | 95 FakeExtensionMessageBubble() : controller_(nullptr) {} |
98 : action_(BUBBLE_ACTION_CLICK_ACTION_BUTTON), controller_(nullptr) {} | |
99 | 96 |
100 void set_action_on_show(ExtensionBubbleAction action) { | 97 void set_action_on_show(ExtensionBubbleAction action) { |
101 action_ = action; | 98 action_ = action; |
102 } | 99 } |
103 void set_controller(ExtensionMessageBubbleController* controller) { | 100 void set_controller(ExtensionMessageBubbleController* controller) { |
104 controller_ = controller; | 101 controller_ = controller; |
105 } | 102 } |
106 | 103 |
107 void Show() { | 104 void Show() { |
108 controller_->OnShown(); | 105 controller_->OnShown(); |
109 switch (action_) { | 106 if (action_ == BUBBLE_ACTION_CLICK_ACTION_BUTTON) |
110 case BUBBLE_ACTION_CLICK_ACTION_BUTTON: | 107 controller_->OnBubbleAction(); |
111 controller_->OnBubbleAction(); | 108 else if (action_ == BUBBLE_ACTION_CLICK_DISMISS_BUTTON) |
112 break; | 109 controller_->OnBubbleDismiss(); |
113 case BUBBLE_ACTION_CLICK_DISMISS_BUTTON: | 110 else if (action_ == BUBBLE_ACTION_CLICK_LINK) |
114 controller_->OnBubbleDismiss(false); | 111 controller_->OnLinkClicked(); |
115 break; | |
116 case BUBBLE_ACTION_DISMISS_DEACTIVATION: | |
117 controller_->OnBubbleDismiss(true); | |
118 break; | |
119 case BUBBLE_ACTION_CLICK_LINK: | |
120 controller_->OnLinkClicked(); | |
121 break; | |
122 } | |
123 } | 112 } |
124 | 113 |
125 private: | 114 private: |
126 ExtensionBubbleAction action_; | 115 ExtensionBubbleAction action_; |
127 ExtensionMessageBubbleController* controller_; | 116 ExtensionMessageBubbleController* controller_; |
128 | 117 |
129 DISALLOW_COPY_AND_ASSIGN(FakeExtensionMessageBubble); | 118 DISALLOW_COPY_AND_ASSIGN(FakeExtensionMessageBubble); |
130 }; | 119 }; |
131 | 120 |
132 class ExtensionMessageBubbleTest : public BrowserWithTestWindowTest { | 121 class ExtensionMessageBubbleTest : public BrowserWithTestWindowTest { |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 } | 298 } |
310 | 299 |
311 ExtensionService* service_; | 300 ExtensionService* service_; |
312 | 301 |
313 private: | 302 private: |
314 scoped_ptr<base::CommandLine> command_line_; | 303 scoped_ptr<base::CommandLine> command_line_; |
315 | 304 |
316 DISALLOW_COPY_AND_ASSIGN(ExtensionMessageBubbleTest); | 305 DISALLOW_COPY_AND_ASSIGN(ExtensionMessageBubbleTest); |
317 }; | 306 }; |
318 | 307 |
319 TEST_F(ExtensionMessageBubbleTest, BubbleReshowsOnDeactivationDismissal) { | |
320 Init(); | |
321 | |
322 ASSERT_TRUE(LoadExtensionOverridingNtp("1", kId1, Manifest::INTERNAL)); | |
323 ASSERT_TRUE(LoadExtensionOverridingNtp("2", kId2, Manifest::INTERNAL)); | |
324 scoped_ptr<TestExtensionMessageBubbleController> controller( | |
325 new TestExtensionMessageBubbleController( | |
326 new NtpOverriddenBubbleDelegate(browser()->profile()), browser())); | |
327 | |
328 // The list will contain one enabled unpacked extension (ext 2). | |
329 EXPECT_TRUE(controller->ShouldShow()); | |
330 std::vector<base::string16> override_extensions = | |
331 controller->GetExtensionList(); | |
332 ASSERT_EQ(1U, override_extensions.size()); | |
333 EXPECT_EQ(base::ASCIIToUTF16("Extension 2"), override_extensions[0]); | |
334 EXPECT_EQ(0U, controller->link_click_count()); | |
335 EXPECT_EQ(0U, controller->dismiss_click_count()); | |
336 EXPECT_EQ(0U, controller->action_click_count()); | |
337 | |
338 // Simulate showing the bubble and dismissing it due to deactivation. | |
339 FakeExtensionMessageBubble bubble; | |
340 bubble.set_action_on_show( | |
341 FakeExtensionMessageBubble::BUBBLE_ACTION_DISMISS_DEACTIVATION); | |
342 bubble.set_controller(controller.get()); | |
343 bubble.Show(); | |
344 EXPECT_EQ(0U, controller->link_click_count()); | |
345 EXPECT_EQ(0U, controller->action_click_count()); | |
346 EXPECT_EQ(1U, controller->dismiss_click_count()); | |
347 | |
348 // No extension should have become disabled. | |
349 ExtensionRegistry* registry = ExtensionRegistry::Get(profile()); | |
350 EXPECT_TRUE(registry->enabled_extensions().GetByID(kId2)); | |
351 // And since it was dismissed due to deactivation, the extension should not | |
352 // have been acknowledged. | |
353 EXPECT_FALSE(controller->delegate()->HasBubbleInfoBeenAcknowledged(kId2)); | |
354 | |
355 bubble.set_action_on_show( | |
356 FakeExtensionMessageBubble::BUBBLE_ACTION_DISMISS_DEACTIVATION); | |
357 controller.reset(new TestExtensionMessageBubbleController( | |
358 new NtpOverriddenBubbleDelegate(browser()->profile()), browser())); | |
359 // The bubble shouldn't show again for the same profile (we don't want to | |
360 // be annoying). | |
361 EXPECT_FALSE(controller->ShouldShow()); | |
362 controller->ClearProfileListForTesting(); | |
363 EXPECT_TRUE(controller->ShouldShow()); | |
364 // Explicitly click the dismiss button. The extension should be acknowledged. | |
365 bubble.set_controller(controller.get()); | |
366 bubble.set_action_on_show( | |
367 FakeExtensionMessageBubble::BUBBLE_ACTION_CLICK_DISMISS_BUTTON); | |
368 bubble.Show(); | |
369 EXPECT_TRUE(controller->delegate()->HasBubbleInfoBeenAcknowledged(kId2)); | |
370 | |
371 // Uninstall the current ntp-controlling extension, allowing the other to | |
372 // take control. | |
373 service_->UninstallExtension(kId2, UNINSTALL_REASON_FOR_TESTING, | |
374 base::Bind(&base::DoNothing), nullptr); | |
375 | |
376 // Even though we already showed for the given profile, we should show again, | |
377 // because it's a different extension. | |
378 controller.reset(new TestExtensionMessageBubbleController( | |
379 new NtpOverriddenBubbleDelegate(browser()->profile()), browser())); | |
380 EXPECT_TRUE(controller->ShouldShow()); | |
381 } | |
382 | |
383 // The feature this is meant to test is only enacted on Windows, but it should | 308 // The feature this is meant to test is only enacted on Windows, but it should |
384 // pass on all platforms. | 309 // pass on all platforms. |
385 TEST_F(ExtensionMessageBubbleTest, WipeoutControllerTest) { | 310 TEST_F(ExtensionMessageBubbleTest, WipeoutControllerTest) { |
386 Init(); | 311 Init(); |
387 // Add three extensions, and control two of them in this test (extension 1 | 312 // Add three extensions, and control two of them in this test (extension 1 |
388 // and 2). | 313 // and 2). |
389 ASSERT_TRUE(LoadExtensionWithAction("1", kId1, Manifest::COMMAND_LINE)); | 314 ASSERT_TRUE(LoadExtensionWithAction("1", kId1, Manifest::COMMAND_LINE)); |
390 ASSERT_TRUE(LoadGenericExtension("2", kId2, Manifest::UNPACKED)); | 315 ASSERT_TRUE(LoadGenericExtension("2", kId2, Manifest::UNPACKED)); |
391 ASSERT_TRUE(LoadGenericExtension("3", kId3, Manifest::EXTERNAL_POLICY)); | 316 ASSERT_TRUE(LoadGenericExtension("3", kId3, Manifest::EXTERNAL_POLICY)); |
392 | 317 |
(...skipping 18 matching lines...) Expand all Loading... |
411 | 336 |
412 // Now disable an extension, specifying the wipeout flag. | 337 // Now disable an extension, specifying the wipeout flag. |
413 service_->DisableExtension(kId1, Extension::DISABLE_NOT_VERIFIED); | 338 service_->DisableExtension(kId1, Extension::DISABLE_NOT_VERIFIED); |
414 | 339 |
415 EXPECT_FALSE(controller->delegate()->HasBubbleInfoBeenAcknowledged(kId1)); | 340 EXPECT_FALSE(controller->delegate()->HasBubbleInfoBeenAcknowledged(kId1)); |
416 EXPECT_FALSE(controller->delegate()->HasBubbleInfoBeenAcknowledged(kId2)); | 341 EXPECT_FALSE(controller->delegate()->HasBubbleInfoBeenAcknowledged(kId2)); |
417 controller.reset( | 342 controller.reset( |
418 new TestExtensionMessageBubbleController( | 343 new TestExtensionMessageBubbleController( |
419 new SuspiciousExtensionBubbleDelegate(browser()->profile()), | 344 new SuspiciousExtensionBubbleDelegate(browser()->profile()), |
420 browser())); | 345 browser())); |
421 controller->ClearProfileListForTesting(); | 346 SuspiciousExtensionBubbleDelegate::ClearProfileListForTesting(); |
422 EXPECT_TRUE(controller->ShouldShow()); | 347 EXPECT_TRUE(controller->ShouldShow()); |
423 suspicious_extensions = controller->GetExtensionList(); | 348 suspicious_extensions = controller->GetExtensionList(); |
424 ASSERT_EQ(1U, suspicious_extensions.size()); | 349 ASSERT_EQ(1U, suspicious_extensions.size()); |
425 EXPECT_TRUE(base::ASCIIToUTF16("Extension 1") == suspicious_extensions[0]); | 350 EXPECT_TRUE(base::ASCIIToUTF16("Extension 1") == suspicious_extensions[0]); |
426 bubble.set_controller(controller.get()); | 351 bubble.set_controller(controller.get()); |
427 bubble.Show(); // Simulate showing the bubble. | 352 bubble.Show(); // Simulate showing the bubble. |
428 EXPECT_EQ(0U, controller->link_click_count()); | 353 EXPECT_EQ(0U, controller->link_click_count()); |
429 EXPECT_EQ(1U, controller->dismiss_click_count()); | 354 EXPECT_EQ(1U, controller->dismiss_click_count()); |
430 // Now the acknowledge flag should be set only for the first extension. | 355 // Now the acknowledge flag should be set only for the first extension. |
431 EXPECT_TRUE(controller->delegate()->HasBubbleInfoBeenAcknowledged(kId1)); | 356 EXPECT_TRUE(controller->delegate()->HasBubbleInfoBeenAcknowledged(kId1)); |
432 EXPECT_FALSE(controller->delegate()->HasBubbleInfoBeenAcknowledged(kId2)); | 357 EXPECT_FALSE(controller->delegate()->HasBubbleInfoBeenAcknowledged(kId2)); |
433 // Clear the flag. | 358 // Clear the flag. |
434 controller->delegate()->SetBubbleInfoBeenAcknowledged(kId1, false); | 359 controller->delegate()->SetBubbleInfoBeenAcknowledged(kId1, false); |
435 EXPECT_FALSE(controller->delegate()->HasBubbleInfoBeenAcknowledged(kId1)); | 360 EXPECT_FALSE(controller->delegate()->HasBubbleInfoBeenAcknowledged(kId1)); |
436 | 361 |
437 // Now disable the other extension and exercise the link click code path. | 362 // Now disable the other extension and exercise the link click code path. |
438 service_->DisableExtension(kId2, Extension::DISABLE_NOT_VERIFIED); | 363 service_->DisableExtension(kId2, Extension::DISABLE_NOT_VERIFIED); |
439 | 364 |
440 bubble.set_action_on_show( | 365 bubble.set_action_on_show( |
441 FakeExtensionMessageBubble::BUBBLE_ACTION_CLICK_LINK); | 366 FakeExtensionMessageBubble::BUBBLE_ACTION_CLICK_LINK); |
442 controller.reset( | 367 controller.reset( |
443 new TestExtensionMessageBubbleController( | 368 new TestExtensionMessageBubbleController( |
444 new SuspiciousExtensionBubbleDelegate(browser()->profile()), | 369 new SuspiciousExtensionBubbleDelegate(browser()->profile()), |
445 browser())); | 370 browser())); |
446 controller->ClearProfileListForTesting(); | 371 SuspiciousExtensionBubbleDelegate::ClearProfileListForTesting(); |
447 EXPECT_TRUE(controller->ShouldShow()); | 372 EXPECT_TRUE(controller->ShouldShow()); |
448 suspicious_extensions = controller->GetExtensionList(); | 373 suspicious_extensions = controller->GetExtensionList(); |
449 ASSERT_EQ(2U, suspicious_extensions.size()); | 374 ASSERT_EQ(2U, suspicious_extensions.size()); |
450 EXPECT_TRUE(base::ASCIIToUTF16("Extension 1") == suspicious_extensions[1]); | 375 EXPECT_TRUE(base::ASCIIToUTF16("Extension 1") == suspicious_extensions[1]); |
451 EXPECT_TRUE(base::ASCIIToUTF16("Extension 2") == suspicious_extensions[0]); | 376 EXPECT_TRUE(base::ASCIIToUTF16("Extension 2") == suspicious_extensions[0]); |
452 bubble.set_controller(controller.get()); | 377 bubble.set_controller(controller.get()); |
453 bubble.Show(); // Simulate showing the bubble. | 378 bubble.Show(); // Simulate showing the bubble. |
454 EXPECT_EQ(1U, controller->link_click_count()); | 379 EXPECT_EQ(1U, controller->link_click_count()); |
455 EXPECT_EQ(0U, controller->dismiss_click_count()); | 380 EXPECT_EQ(0U, controller->dismiss_click_count()); |
456 EXPECT_TRUE(controller->delegate()->HasBubbleInfoBeenAcknowledged(kId1)); | 381 EXPECT_TRUE(controller->delegate()->HasBubbleInfoBeenAcknowledged(kId1)); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 EXPECT_TRUE(registry->enabled_extensions().GetByID(kId1) != NULL); | 423 EXPECT_TRUE(registry->enabled_extensions().GetByID(kId1) != NULL); |
499 EXPECT_TRUE(registry->enabled_extensions().GetByID(kId2) != NULL); | 424 EXPECT_TRUE(registry->enabled_extensions().GetByID(kId2) != NULL); |
500 | 425 |
501 // Do it again, but now press different button (Disable). | 426 // Do it again, but now press different button (Disable). |
502 bubble.set_action_on_show( | 427 bubble.set_action_on_show( |
503 FakeExtensionMessageBubble::BUBBLE_ACTION_CLICK_ACTION_BUTTON); | 428 FakeExtensionMessageBubble::BUBBLE_ACTION_CLICK_ACTION_BUTTON); |
504 controller.reset( | 429 controller.reset( |
505 new TestExtensionMessageBubbleController( | 430 new TestExtensionMessageBubbleController( |
506 new DevModeBubbleDelegate(browser()->profile()), | 431 new DevModeBubbleDelegate(browser()->profile()), |
507 browser())); | 432 browser())); |
508 // Most bubbles would want to show again as long as the extensions weren't | 433 DevModeBubbleDelegate::ClearProfileListForTesting(); |
509 // acknowledged and the bubble wasn't dismissed due to deactivation. Since dev | |
510 // mode extensions can't be (persistently) acknowledged, this isn't the case | |
511 // for the dev mode bubble, and we should only show once per profile. | |
512 EXPECT_FALSE(controller->ShouldShow()); | |
513 controller->ClearProfileListForTesting(); | |
514 EXPECT_TRUE(controller->ShouldShow()); | 434 EXPECT_TRUE(controller->ShouldShow()); |
515 dev_mode_extensions = controller->GetExtensionList(); | 435 dev_mode_extensions = controller->GetExtensionList(); |
516 EXPECT_EQ(2U, dev_mode_extensions.size()); | 436 EXPECT_EQ(2U, dev_mode_extensions.size()); |
517 bubble.set_controller(controller.get()); | 437 bubble.set_controller(controller.get()); |
518 bubble.Show(); // Simulate showing the bubble. | 438 bubble.Show(); // Simulate showing the bubble. |
519 EXPECT_EQ(0U, controller->link_click_count()); | 439 EXPECT_EQ(0U, controller->link_click_count()); |
520 EXPECT_EQ(1U, controller->action_click_count()); | 440 EXPECT_EQ(1U, controller->action_click_count()); |
521 EXPECT_EQ(0U, controller->dismiss_click_count()); | 441 EXPECT_EQ(0U, controller->dismiss_click_count()); |
522 EXPECT_TRUE(registry->disabled_extensions().GetByID(kId1) != NULL); | 442 EXPECT_TRUE(registry->disabled_extensions().GetByID(kId1) != NULL); |
523 EXPECT_TRUE(registry->disabled_extensions().GetByID(kId2) != NULL); | 443 EXPECT_TRUE(registry->disabled_extensions().GetByID(kId2) != NULL); |
524 | 444 |
525 // Re-enable the extensions (disabled by the action button above). | 445 // Re-enable the extensions (disabled by the action button above). |
526 service_->EnableExtension(kId1); | 446 service_->EnableExtension(kId1); |
527 service_->EnableExtension(kId2); | 447 service_->EnableExtension(kId2); |
528 | 448 |
529 // Show the dialog a third time, but now press the learn more link. | 449 // Show the dialog a third time, but now press the learn more link. |
530 bubble.set_action_on_show( | 450 bubble.set_action_on_show( |
531 FakeExtensionMessageBubble::BUBBLE_ACTION_CLICK_LINK); | 451 FakeExtensionMessageBubble::BUBBLE_ACTION_CLICK_LINK); |
532 controller.reset( | 452 controller.reset( |
533 new TestExtensionMessageBubbleController( | 453 new TestExtensionMessageBubbleController( |
534 new DevModeBubbleDelegate(browser()->profile()), | 454 new DevModeBubbleDelegate(browser()->profile()), |
535 browser())); | 455 browser())); |
536 controller->ClearProfileListForTesting(); | 456 DevModeBubbleDelegate::ClearProfileListForTesting(); |
537 EXPECT_TRUE(controller->ShouldShow()); | 457 EXPECT_TRUE(controller->ShouldShow()); |
538 dev_mode_extensions = controller->GetExtensionList(); | 458 dev_mode_extensions = controller->GetExtensionList(); |
539 EXPECT_EQ(2U, dev_mode_extensions.size()); | 459 EXPECT_EQ(2U, dev_mode_extensions.size()); |
540 bubble.set_controller(controller.get()); | 460 bubble.set_controller(controller.get()); |
541 bubble.Show(); // Simulate showing the bubble. | 461 bubble.Show(); // Simulate showing the bubble. |
542 EXPECT_EQ(1U, controller->link_click_count()); | 462 EXPECT_EQ(1U, controller->link_click_count()); |
543 EXPECT_EQ(0U, controller->action_click_count()); | 463 EXPECT_EQ(0U, controller->action_click_count()); |
544 EXPECT_EQ(0U, controller->dismiss_click_count()); | 464 EXPECT_EQ(0U, controller->dismiss_click_count()); |
545 EXPECT_TRUE(registry->enabled_extensions().GetByID(kId1) != NULL); | 465 EXPECT_TRUE(registry->enabled_extensions().GetByID(kId1) != NULL); |
546 EXPECT_TRUE(registry->enabled_extensions().GetByID(kId2) != NULL); | 466 EXPECT_TRUE(registry->enabled_extensions().GetByID(kId2) != NULL); |
547 | 467 |
548 // Now disable the unpacked extension. | 468 // Now disable the unpacked extension. |
549 service_->DisableExtension(kId1, Extension::DISABLE_USER_ACTION); | 469 service_->DisableExtension(kId1, Extension::DISABLE_USER_ACTION); |
550 service_->DisableExtension(kId2, Extension::DISABLE_USER_ACTION); | 470 service_->DisableExtension(kId2, Extension::DISABLE_USER_ACTION); |
551 | 471 |
552 controller.reset( | 472 controller.reset( |
553 new TestExtensionMessageBubbleController( | 473 new TestExtensionMessageBubbleController( |
554 new DevModeBubbleDelegate(browser()->profile()), | 474 new DevModeBubbleDelegate(browser()->profile()), |
555 browser())); | 475 browser())); |
556 controller->ClearProfileListForTesting(); | 476 DevModeBubbleDelegate::ClearProfileListForTesting(); |
557 EXPECT_FALSE(controller->ShouldShow()); | 477 EXPECT_FALSE(controller->ShouldShow()); |
558 dev_mode_extensions = controller->GetExtensionList(); | 478 dev_mode_extensions = controller->GetExtensionList(); |
559 EXPECT_EQ(0U, dev_mode_extensions.size()); | 479 EXPECT_EQ(0U, dev_mode_extensions.size()); |
560 } | 480 } |
561 | 481 |
562 // The feature this is meant to test is only implemented on Windows. | 482 // The feature this is meant to test is only implemented on Windows. |
563 #if defined(OS_WIN) | 483 #if defined(OS_WIN) |
564 #define MAYBE_SettingsApiControllerTest SettingsApiControllerTest | 484 #define MAYBE_SettingsApiControllerTest SettingsApiControllerTest |
565 #else | 485 #else |
566 #define MAYBE_SettingsApiControllerTest DISABLED_SettingsApiControllerTest | 486 #define MAYBE_SettingsApiControllerTest DISABLED_SettingsApiControllerTest |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
951 extensions::UNINSTALL_REASON_FOR_TESTING, | 871 extensions::UNINSTALL_REASON_FOR_TESTING, |
952 base::Bind(&base::DoNothing), | 872 base::Bind(&base::DoNothing), |
953 NULL); | 873 NULL); |
954 service_->UninstallExtension(kId3, | 874 service_->UninstallExtension(kId3, |
955 extensions::UNINSTALL_REASON_FOR_TESTING, | 875 extensions::UNINSTALL_REASON_FOR_TESTING, |
956 base::Bind(&base::DoNothing), | 876 base::Bind(&base::DoNothing), |
957 NULL); | 877 NULL); |
958 } | 878 } |
959 | 879 |
960 } // namespace extensions | 880 } // namespace extensions |
OLD | NEW |