OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h" | 5 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 CreateBookmarkModelAndBookmarkBarView(); | 343 CreateBookmarkModelAndBookmarkBarView(); |
344 // By default, the pref is not managed and the apps shortcut is shown. | 344 // By default, the pref is not managed and the apps shortcut is shown. |
345 sync_preferences::TestingPrefServiceSyncable* prefs = | 345 sync_preferences::TestingPrefServiceSyncable* prefs = |
346 profile()->GetTestingPrefService(); | 346 profile()->GetTestingPrefService(); |
347 EXPECT_FALSE(prefs->IsManagedPreference( | 347 EXPECT_FALSE(prefs->IsManagedPreference( |
348 bookmarks::prefs::kShowAppsShortcutInBookmarkBar)); | 348 bookmarks::prefs::kShowAppsShortcutInBookmarkBar)); |
349 EXPECT_TRUE(test_helper_->apps_page_shortcut()->visible()); | 349 EXPECT_TRUE(test_helper_->apps_page_shortcut()->visible()); |
350 | 350 |
351 // Hide the apps shortcut by policy, via the managed pref. | 351 // Hide the apps shortcut by policy, via the managed pref. |
352 prefs->SetManagedPref(bookmarks::prefs::kShowAppsShortcutInBookmarkBar, | 352 prefs->SetManagedPref(bookmarks::prefs::kShowAppsShortcutInBookmarkBar, |
353 new base::Value(false)); | 353 base::MakeUnique<base::Value>(false)); |
354 EXPECT_FALSE(test_helper_->apps_page_shortcut()->visible()); | 354 EXPECT_FALSE(test_helper_->apps_page_shortcut()->visible()); |
355 | 355 |
356 // And try showing it via policy too. | 356 // And try showing it via policy too. |
357 prefs->SetManagedPref(bookmarks::prefs::kShowAppsShortcutInBookmarkBar, | 357 prefs->SetManagedPref(bookmarks::prefs::kShowAppsShortcutInBookmarkBar, |
358 new base::Value(true)); | 358 base::MakeUnique<base::Value>(true)); |
359 EXPECT_TRUE(test_helper_->apps_page_shortcut()->visible()); | 359 EXPECT_TRUE(test_helper_->apps_page_shortcut()->visible()); |
360 } | 360 } |
361 #endif | 361 #endif |
362 | 362 |
363 TEST_F(BookmarkBarViewTest, UpdateTooltipText) { | 363 TEST_F(BookmarkBarViewTest, UpdateTooltipText) { |
364 CreateBookmarkModelAndBookmarkBarView(); | 364 CreateBookmarkModelAndBookmarkBarView(); |
365 // Create a widget who creates and owns a views::ToolipManager. | 365 // Create a widget who creates and owns a views::ToolipManager. |
366 views::Widget widget; | 366 views::Widget widget; |
367 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW); | 367 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW); |
368 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | 368 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
(...skipping 14 matching lines...) Expand all Loading... |
383 gfx::Point p; | 383 gfx::Point p; |
384 base::string16 text; | 384 base::string16 text; |
385 button->GetTooltipText(p, &text); | 385 button->GetTooltipText(p, &text); |
386 EXPECT_EQ(base::ASCIIToUTF16("a\na.com"), text); | 386 EXPECT_EQ(base::ASCIIToUTF16("a\na.com"), text); |
387 button->SetText(base::ASCIIToUTF16("new title")); | 387 button->SetText(base::ASCIIToUTF16("new title")); |
388 button->GetTooltipText(p, &text); | 388 button->GetTooltipText(p, &text); |
389 EXPECT_EQ(base::ASCIIToUTF16("new title\na.com"), text); | 389 EXPECT_EQ(base::ASCIIToUTF16("new title\na.com"), text); |
390 | 390 |
391 widget.CloseNow(); | 391 widget.CloseNow(); |
392 } | 392 } |
OLD | NEW |