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

Side by Side Diff: chrome/browser/ui/bookmarks/bookmark_context_menu_controller_unittest.cc

Issue 950053002: Cache the Windows Parental Controls Platform Answer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Test Isolation Created 5 years, 9 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/bookmarks/bookmark_context_menu_controller.h" 5 #include "chrome/browser/ui/bookmarks/bookmark_context_menu_controller.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
11 #include "base/strings/utf_string_conversions.h" 11 #include "base/strings/utf_string_conversions.h"
12 #include "base/values.h" 12 #include "base/values.h"
13 #include "chrome/app/chrome_command_ids.h" 13 #include "chrome/app/chrome_command_ids.h"
14 #include "chrome/browser/bookmarks/bookmark_model_factory.h" 14 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
15 #include "chrome/browser/prefs/incognito_mode_prefs.h"
15 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/browser/ui/bookmarks/bookmark_utils.h" 17 #include "chrome/browser/ui/bookmarks/bookmark_utils.h"
17 #include "chrome/common/pref_names.h" 18 #include "chrome/common/pref_names.h"
18 #include "chrome/test/base/testing_pref_service_syncable.h" 19 #include "chrome/test/base/testing_pref_service_syncable.h"
19 #include "chrome/test/base/testing_profile.h" 20 #include "chrome/test/base/testing_profile.h"
20 #include "components/bookmarks/browser/bookmark_model.h" 21 #include "components/bookmarks/browser/bookmark_model.h"
21 #include "components/bookmarks/browser/bookmark_node.h" 22 #include "components/bookmarks/browser/bookmark_node.h"
22 #include "components/bookmarks/test/bookmark_test_helpers.h" 23 #include "components/bookmarks/test/bookmark_test_helpers.h"
23 #include "content/public/browser/page_navigator.h" 24 #include "content/public/browser/page_navigator.h"
24 #include "content/public/test/test_browser_thread.h" 25 #include "content/public/test/test_browser_thread.h"
(...skipping 20 matching lines...) Expand all
45 }; 46 };
46 47
47 class BookmarkContextMenuControllerTest : public testing::Test { 48 class BookmarkContextMenuControllerTest : public testing::Test {
48 public: 49 public:
49 BookmarkContextMenuControllerTest() 50 BookmarkContextMenuControllerTest()
50 : ui_thread_(BrowserThread::UI, &message_loop_), 51 : ui_thread_(BrowserThread::UI, &message_loop_),
51 file_thread_(BrowserThread::FILE, &message_loop_), 52 file_thread_(BrowserThread::FILE, &message_loop_),
52 model_(NULL) { 53 model_(NULL) {
53 } 54 }
54 55
56 static void SetUpTestCase() {
57 // Checking for incognito availability requires platform parental controls
58 // initialization.
59 IncognitoModePrefs::InitializePlatformParentalControls();
60 }
61
62 static void TearDownTestCase() {
63 IncognitoModePrefs::UninitializePlatformParentalControls();
64 }
65
55 void SetUp() override { 66 void SetUp() override {
56 TestingProfile::Builder builder; 67 TestingProfile::Builder builder;
57 profile_ = builder.Build(); 68 profile_ = builder.Build();
58 profile_->CreateBookmarkModel(true); 69 profile_->CreateBookmarkModel(true);
59 model_ = BookmarkModelFactory::GetForProfile(profile_.get()); 70 model_ = BookmarkModelFactory::GetForProfile(profile_.get());
60 bookmarks::test::WaitForBookmarkModelToLoad(model_); 71 bookmarks::test::WaitForBookmarkModelToLoad(model_);
61 AddTestData(model_); 72 AddTestData(model_);
62 } 73 }
63 74
64 void TearDown() override { 75 void TearDown() override {
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 new base::FundamentalValue(false)); 366 new base::FundamentalValue(false));
356 EXPECT_FALSE( 367 EXPECT_FALSE(
357 controller.IsCommandIdEnabled(IDC_BOOKMARK_BAR_SHOW_APPS_SHORTCUT)); 368 controller.IsCommandIdEnabled(IDC_BOOKMARK_BAR_SHOW_APPS_SHORTCUT));
358 369
359 // And enabling the shortcut by policy disables the command too. 370 // And enabling the shortcut by policy disables the command too.
360 prefs->SetManagedPref(bookmarks::prefs::kShowAppsShortcutInBookmarkBar, 371 prefs->SetManagedPref(bookmarks::prefs::kShowAppsShortcutInBookmarkBar,
361 new base::FundamentalValue(true)); 372 new base::FundamentalValue(true));
362 EXPECT_FALSE( 373 EXPECT_FALSE(
363 controller.IsCommandIdEnabled(IDC_BOOKMARK_BAR_SHOW_APPS_SHORTCUT)); 374 controller.IsCommandIdEnabled(IDC_BOOKMARK_BAR_SHOW_APPS_SHORTCUT));
364 } 375 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698