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

Side by Side Diff: chrome/browser/ui/toolbar/back_forward_menu_model_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/toolbar/back_forward_menu_model.h" 5 #include "chrome/browser/ui/toolbar/back_forward_menu_model.h"
6 6
7 #include "base/strings/string16.h" 7 #include "base/strings/string16.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
11 #include "chrome/browser/favicon/favicon_service_factory.h" 11 #include "chrome/browser/favicon/favicon_service_factory.h"
12 #include "chrome/browser/history/history_service.h" 12 #include "chrome/browser/history/history_service.h"
13 #include "chrome/browser/history/history_service_factory.h" 13 #include "chrome/browser/history/history_service_factory.h"
14 #include "chrome/browser/prefs/incognito_mode_prefs.h"
14 #include "chrome/browser/profiles/profile_manager.h" 15 #include "chrome/browser/profiles/profile_manager.h"
15 #include "chrome/browser/ui/browser.h" 16 #include "chrome/browser/ui/browser.h"
16 #include "chrome/browser/ui/browser_tabstrip.h" 17 #include "chrome/browser/ui/browser_tabstrip.h"
17 #include "chrome/browser/ui/tabs/tab_strip_model.h" 18 #include "chrome/browser/ui/tabs/tab_strip_model.h"
18 #include "chrome/common/url_constants.h" 19 #include "chrome/common/url_constants.h"
19 #include "chrome/test/base/chrome_render_view_host_test_harness.h" 20 #include "chrome/test/base/chrome_render_view_host_test_harness.h"
20 #include "chrome/test/base/test_browser_window.h" 21 #include "chrome/test/base/test_browser_window.h"
21 #include "chrome/test/base/testing_profile.h" 22 #include "chrome/test/base/testing_profile.h"
22 #include "content/public/browser/navigation_controller.h" 23 #include "content/public/browser/navigation_controller.h"
23 #include "content/public/browser/navigation_entry.h" 24 #include "content/public/browser/navigation_entry.h"
(...skipping 30 matching lines...) Expand all
54 private: 55 private:
55 bool was_called_; 56 bool was_called_;
56 57
57 DISALLOW_COPY_AND_ASSIGN(FaviconDelegate); 58 DISALLOW_COPY_AND_ASSIGN(FaviconDelegate);
58 }; 59 };
59 60
60 } // namespace 61 } // namespace
61 62
62 class BackFwdMenuModelTest : public ChromeRenderViewHostTestHarness { 63 class BackFwdMenuModelTest : public ChromeRenderViewHostTestHarness {
63 public: 64 public:
65 static void SetUpTestCase() {
66 // Creating a browser requires platform parental controls initialization.
67 IncognitoModePrefs::InitializePlatformParentalControls();
68 }
69
70 static void TearDownTestCase() {
71 IncognitoModePrefs::UninitializePlatformParentalControls();
72 }
73
64 void ValidateModel(BackForwardMenuModel* model, int history_items, 74 void ValidateModel(BackForwardMenuModel* model, int history_items,
65 int chapter_stops) { 75 int chapter_stops) {
66 int h = std::min(BackForwardMenuModel::kMaxHistoryItems, history_items); 76 int h = std::min(BackForwardMenuModel::kMaxHistoryItems, history_items);
67 int c = std::min(BackForwardMenuModel::kMaxChapterStops, chapter_stops); 77 int c = std::min(BackForwardMenuModel::kMaxChapterStops, chapter_stops);
68 EXPECT_EQ(h, model->GetHistoryItemCount()); 78 EXPECT_EQ(h, model->GetHistoryItemCount());
69 EXPECT_EQ(c, model->GetChapterStopCount(h)); 79 EXPECT_EQ(c, model->GetChapterStopCount(h));
70 if (h > 0) 80 if (h > 0)
71 h += 2; // Separator and View History link. 81 h += 2; // Separator and View History link.
72 if (c > 0) 82 if (c > 0)
73 ++c; 83 ++c;
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 // Verify we did get the expected favicon. 567 // Verify we did get the expected favicon.
558 EXPECT_EQ(0, memcmp(new_icon_bitmap.getPixels(), 568 EXPECT_EQ(0, memcmp(new_icon_bitmap.getPixels(),
559 valid_icon_bitmap.getPixels(), 569 valid_icon_bitmap.getPixels(),
560 new_icon_bitmap.getSize())); 570 new_icon_bitmap.getSize()));
561 571
562 // Make sure the browser deconstructor doesn't have problems. 572 // Make sure the browser deconstructor doesn't have problems.
563 browser->tab_strip_model()->CloseAllTabs(); 573 browser->tab_strip_model()->CloseAllTabs();
564 // This is required to prevent the message loop from hanging. 574 // This is required to prevent the message loop from hanging.
565 profile()->DestroyHistoryService(); 575 profile()->DestroyHistoryService();
566 } 576 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698