| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/ui/toolbar/toolbar_actions_bar_unittest.h" | 5 #include "chrome/browser/ui/toolbar/toolbar_actions_bar_unittest.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 CreateAndAddExtension("extension", | 417 CreateAndAddExtension("extension", |
| 418 extensions::extension_action_test_util::NO_ACTION); | 418 extensions::extension_action_test_util::NO_ACTION); |
| 419 EXPECT_TRUE(ExtensionToolbarIconSurfacingBubbleDelegate::ShouldShowForProfile( | 419 EXPECT_TRUE(ExtensionToolbarIconSurfacingBubbleDelegate::ShouldShowForProfile( |
| 420 profile())); | 420 profile())); |
| 421 | 421 |
| 422 // If the bubble was recently shown, we shouldn't show it again... | 422 // If the bubble was recently shown, we shouldn't show it again... |
| 423 scoped_ptr<ToolbarActionsBarBubbleDelegate> bubble_delegate( | 423 scoped_ptr<ToolbarActionsBarBubbleDelegate> bubble_delegate( |
| 424 new ExtensionToolbarIconSurfacingBubbleDelegate(profile())); | 424 new ExtensionToolbarIconSurfacingBubbleDelegate(profile())); |
| 425 bubble_delegate->OnBubbleShown(); | 425 bubble_delegate->OnBubbleShown(); |
| 426 bubble_delegate->OnBubbleClosed( | 426 bubble_delegate->OnBubbleClosed( |
| 427 ToolbarActionsBarBubbleDelegate::CLOSE_DISMISS); | 427 ToolbarActionsBarBubbleDelegate::CLOSE_DISMISS_USER_ACTION); |
| 428 EXPECT_FALSE( | 428 EXPECT_FALSE( |
| 429 ExtensionToolbarIconSurfacingBubbleDelegate::ShouldShowForProfile( | 429 ExtensionToolbarIconSurfacingBubbleDelegate::ShouldShowForProfile( |
| 430 profile())); | 430 profile())); |
| 431 | 431 |
| 432 // ...But if it was only dismissed, we should show it before too long. | 432 // ...But if it was only dismissed, we should show it before too long. |
| 433 base::Time two_days_ago = base::Time::Now() - base::TimeDelta::FromDays(2); | 433 base::Time two_days_ago = base::Time::Now() - base::TimeDelta::FromDays(2); |
| 434 prefs->SetInt64(prefs::kToolbarIconSurfacingBubbleLastShowTime, | 434 prefs->SetInt64(prefs::kToolbarIconSurfacingBubbleLastShowTime, |
| 435 two_days_ago.ToInternalValue()); | 435 two_days_ago.ToInternalValue()); |
| 436 EXPECT_TRUE(ExtensionToolbarIconSurfacingBubbleDelegate::ShouldShowForProfile( | 436 EXPECT_TRUE(ExtensionToolbarIconSurfacingBubbleDelegate::ShouldShowForProfile( |
| 437 profile())); | 437 profile())); |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 // Set the width back to the preferred width. All should be back to normal. | 558 // Set the width back to the preferred width. All should be back to normal. |
| 559 browser_action_test_util()->SetWidth( | 559 browser_action_test_util()->SetWidth( |
| 560 toolbar_actions_bar()->GetPreferredSize().width()); | 560 toolbar_actions_bar()->GetPreferredSize().width()); |
| 561 EXPECT_EQ(3u, toolbar_actions_bar()->GetIconCount()); | 561 EXPECT_EQ(3u, toolbar_actions_bar()->GetIconCount()); |
| 562 EXPECT_EQ(0u, toolbar_actions_bar()->GetStartIndexInBounds()); | 562 EXPECT_EQ(0u, toolbar_actions_bar()->GetStartIndexInBounds()); |
| 563 EXPECT_EQ(3u, toolbar_actions_bar()->GetEndIndexInBounds()); | 563 EXPECT_EQ(3u, toolbar_actions_bar()->GetEndIndexInBounds()); |
| 564 EXPECT_EQ(3u, overflow_bar()->GetStartIndexInBounds()); | 564 EXPECT_EQ(3u, overflow_bar()->GetStartIndexInBounds()); |
| 565 EXPECT_EQ(3u, overflow_bar()->GetEndIndexInBounds()); | 565 EXPECT_EQ(3u, overflow_bar()->GetEndIndexInBounds()); |
| 566 EXPECT_FALSE(toolbar_actions_bar()->NeedsOverflow()); | 566 EXPECT_FALSE(toolbar_actions_bar()->NeedsOverflow()); |
| 567 } | 567 } |
| OLD | NEW |