| 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_menu_delegate.h" | 5 #include "chrome/browser/ui/views/bookmarks/bookmark_menu_delegate.h" |
| 6 | 6 |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 8 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| 9 #include "chrome/browser/bookmarks/bookmark_stats.h" | 9 #include "chrome/browser/bookmarks/bookmark_stats.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| 11 #include "chrome/test/base/browser_with_test_window_test.h" | 11 #include "chrome/test/base/browser_with_test_window_test.h" |
| 12 #include "chrome/test/base/testing_profile.h" | 12 #include "chrome/test/base/testing_profile.h" |
| 13 #include "components/bookmarks/browser/bookmark_model.h" | 13 #include "components/bookmarks/browser/bookmark_model.h" |
| 14 #include "components/bookmarks/test/bookmark_test_helpers.h" | 14 #include "components/bookmarks/test/bookmark_test_helpers.h" |
| 15 #include "ui/views/controls/menu/menu_item_view.h" | 15 #include "ui/views/controls/menu/menu_item_view.h" |
| 16 #include "ui/views/controls/menu/menu_runner.h" | 16 #include "ui/views/controls/menu/menu_runner.h" |
| 17 #include "ui/views/controls/menu/submenu_view.h" | 17 #include "ui/views/controls/menu/submenu_view.h" |
| 18 | 18 |
| 19 using base::ASCIIToUTF16; | 19 using base::ASCIIToUTF16; |
| 20 using bookmarks::BookmarkModel; | 20 using bookmarks::BookmarkModel; |
| 21 using bookmarks::BookmarkNode; |
| 21 | 22 |
| 22 class BookmarkMenuDelegateTest : public BrowserWithTestWindowTest { | 23 class BookmarkMenuDelegateTest : public BrowserWithTestWindowTest { |
| 23 public: | 24 public: |
| 24 BookmarkMenuDelegateTest() : model_(NULL) {} | 25 BookmarkMenuDelegateTest() : model_(NULL) {} |
| 25 | 26 |
| 26 void SetUp() override { | 27 void SetUp() override { |
| 27 BrowserWithTestWindowTest::SetUp(); | 28 BrowserWithTestWindowTest::SetUp(); |
| 28 | 29 |
| 29 profile()->CreateBookmarkModel(true); | 30 profile()->CreateBookmarkModel(true); |
| 30 | 31 |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 EXPECT_EQ(1, root_item->GetSubmenu()->GetMenuItemCount()); | 221 EXPECT_EQ(1, root_item->GetSubmenu()->GetMenuItemCount()); |
| 221 EXPECT_EQ(1, root_item->GetSubmenu()->child_count()); // No separator. | 222 EXPECT_EQ(1, root_item->GetSubmenu()->child_count()); // No separator. |
| 222 | 223 |
| 223 // Verify correct handling of integer overflow with range, set kint32max as | 224 // Verify correct handling of integer overflow with range, set kint32max as |
| 224 // maximum and 1 less as minimum. Only "a" item should be created. | 225 // maximum and 1 less as minimum. Only "a" item should be created. |
| 225 NewAndInitDelegateForPermanent(kint32max - 1, kint32max); | 226 NewAndInitDelegateForPermanent(kint32max - 1, kint32max); |
| 226 root_item = bookmark_menu_delegate_->menu(); | 227 root_item = bookmark_menu_delegate_->menu(); |
| 227 EXPECT_EQ(1, root_item->GetSubmenu()->GetMenuItemCount()); | 228 EXPECT_EQ(1, root_item->GetSubmenu()->GetMenuItemCount()); |
| 228 EXPECT_EQ(1, root_item->GetSubmenu()->child_count()); // No separator. | 229 EXPECT_EQ(1, root_item->GetSubmenu()->child_count()); // No separator. |
| 229 } | 230 } |
| OLD | NEW |