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

Unified Diff: chrome/browser/ui/toolbar/toolbar_actions_bar_unittest.cc

Issue 1086973004: [Extensions Mac] Implement developer mode warning on mac (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Avi's Created 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/toolbar/toolbar_actions_bar_unittest.cc
diff --git a/chrome/browser/ui/toolbar/toolbar_actions_bar_unittest.cc b/chrome/browser/ui/toolbar/toolbar_actions_bar_unittest.cc
index 9e74c2f01cea439200d7e8f1c5fabfd3190bc6c0..2d21db0ea5f220cea55c6b5a9320908682f8e1af 100644
--- a/chrome/browser/ui/toolbar/toolbar_actions_bar_unittest.cc
+++ b/chrome/browser/ui/toolbar/toolbar_actions_bar_unittest.cc
@@ -17,6 +17,7 @@
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/test_extension_system.h"
#include "chrome/browser/sessions/session_tab_helper.h"
+#include "chrome/browser/ui/extensions/extension_toolbar_icon_surfacing_bubble_delegate.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/toolbar/test_toolbar_actions_bar_helper.h"
#include "chrome/browser/ui/toolbar/toolbar_action_view_controller.h"
@@ -433,7 +434,9 @@ class ToolbarActionsBarRedesignUnitTest : public ToolbarActionsBarUnitTest {
TEST_F(ToolbarActionsBarRedesignUnitTest, IconSurfacingBubbleAppearance) {
// Without showing anything new, we shouldn't show the bubble, and should
// auto-acknowledge it.
- EXPECT_FALSE(toolbar_actions_bar()->ShouldShowInfoBubble());
+ EXPECT_FALSE(
+ ExtensionToolbarIconSurfacingBubbleDelegate::ShouldShowForProfile(
+ profile()));
PrefService* prefs = profile()->GetPrefs();
EXPECT_TRUE(
prefs->GetBoolean(prefs::kToolbarIconSurfacingBubbleAcknowledged));
@@ -443,28 +446,34 @@ TEST_F(ToolbarActionsBarRedesignUnitTest, IconSurfacingBubbleAppearance) {
prefs->ClearPref(prefs::kToolbarIconSurfacingBubbleAcknowledged);
CreateAndAddExtension("extension",
extensions::extension_action_test_util::NO_ACTION);
- EXPECT_TRUE(toolbar_actions_bar()->ShouldShowInfoBubble());
+ EXPECT_TRUE(ExtensionToolbarIconSurfacingBubbleDelegate::ShouldShowForProfile(
+ profile()));
// If the bubble was recently shown, we shouldn't show it again...
- ToolbarActionsBarBubbleDelegate* bubble_delegate =
- static_cast<ToolbarActionsBarBubbleDelegate*>(toolbar_actions_bar());
- bubble_delegate->OnToolbarActionsBarBubbleShown();
- bubble_delegate->OnToolbarActionsBarBubbleClosed(
- ToolbarActionsBarBubbleDelegate::DISMISSED);
- EXPECT_FALSE(toolbar_actions_bar()->ShouldShowInfoBubble());
+ scoped_ptr<ToolbarActionsBarBubbleDelegate> bubble_delegate(
+ new ExtensionToolbarIconSurfacingBubbleDelegate(profile()));
+ bubble_delegate->OnBubbleShown();
+ bubble_delegate->OnBubbleClosed(
+ ToolbarActionsBarBubbleDelegate::CLOSE_DISMISS);
+ EXPECT_FALSE(
+ ExtensionToolbarIconSurfacingBubbleDelegate::ShouldShowForProfile(
+ profile()));
// ...But if it was only dismissed, we should show it before too long.
base::Time two_days_ago = base::Time::Now() - base::TimeDelta::FromDays(2);
prefs->SetInt64(prefs::kToolbarIconSurfacingBubbleLastShowTime,
two_days_ago.ToInternalValue());
- EXPECT_TRUE(toolbar_actions_bar()->ShouldShowInfoBubble());
+ EXPECT_TRUE(ExtensionToolbarIconSurfacingBubbleDelegate::ShouldShowForProfile(
+ profile()));
// If it's acknowledged, then it should never show again, and should be
// recorded as acknowledged.
- bubble_delegate->OnToolbarActionsBarBubbleShown();
- bubble_delegate->OnToolbarActionsBarBubbleClosed(
- ToolbarActionsBarBubbleDelegate::ACKNOWLEDGED);
- EXPECT_FALSE(toolbar_actions_bar()->ShouldShowInfoBubble());
+ bubble_delegate->OnBubbleShown();
+ bubble_delegate->OnBubbleClosed(
+ ToolbarActionsBarBubbleDelegate::CLOSE_EXECUTE);
+ EXPECT_FALSE(
+ ExtensionToolbarIconSurfacingBubbleDelegate::ShouldShowForProfile(
+ profile()));
base::Time one_week_ago = base::Time::Now() - base::TimeDelta::FromDays(7);
prefs->SetInt64(prefs::kToolbarIconSurfacingBubbleLastShowTime,
one_week_ago.ToInternalValue());

Powered by Google App Engine
This is Rietveld 408576698