| OLD | NEW |
| 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 "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/message_loop.h" | 6 #include "base/message_loop.h" |
| 7 #include "base/string16.h" | 7 #include "base/string16.h" |
| 8 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/app/chrome_command_ids.h" | 9 #include "chrome/app/chrome_command_ids.h" |
| 9 #include "chrome/browser/bookmarks/bookmark_model.h" | 10 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 10 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 11 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| 11 #include "chrome/browser/bookmarks/bookmark_utils.h" | 12 #include "chrome/browser/bookmarks/bookmark_utils.h" |
| 12 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
| 13 #include "chrome/browser/ui/browser_commands.h" | 14 #include "chrome/browser/ui/browser_commands.h" |
| 14 #include "chrome/browser/ui/browser_tabstrip.h" | 15 #include "chrome/browser/ui/browser_tabstrip.h" |
| 15 #include "chrome/browser/ui/browser_window.h" | 16 #include "chrome/browser/ui/browser_window.h" |
| 16 #include "chrome/browser/ui/omnibox/location_bar.h" | 17 #include "chrome/browser/ui/omnibox/location_bar.h" |
| 17 #include "chrome/browser/ui/toolbar/action_box_menu_model.h" | 18 #include "chrome/browser/ui/toolbar/action_box_menu_model.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 LocationBarTesting* loc_bar = | 78 LocationBarTesting* loc_bar = |
| 78 browser()->window()->GetLocationBar()->GetLocationBarForTesting(); | 79 browser()->window()->GetLocationBar()->GetLocationBarForTesting(); |
| 79 | 80 |
| 80 // Navigate somewhere we can bookmark. | 81 // Navigate somewhere we can bookmark. |
| 81 ui_test_utils::NavigateToURL(browser(), GURL("http://www.google.com")); | 82 ui_test_utils::NavigateToURL(browser(), GURL("http://www.google.com")); |
| 82 | 83 |
| 83 // Page is not bookmarked yet. | 84 // Page is not bookmarked yet. |
| 84 ASSERT_FALSE(loc_bar->GetBookmarkStarVisibility()); | 85 ASSERT_FALSE(loc_bar->GetBookmarkStarVisibility()); |
| 85 | 86 |
| 86 // Simulate an action box click and menu item selection. | 87 // Simulate an action box click and menu item selection. |
| 87 loc_bar->TestActionBoxMenuItemSelected(IDC_BOOKMARK_PAGE); | 88 chrome::ExecuteCommand(browser(), IDC_BOOKMARK_PAGE); |
| 88 | 89 |
| 89 // Page is now bookmarked. | 90 // Page is now bookmarked. |
| 90 ASSERT_TRUE(loc_bar->GetBookmarkStarVisibility()); | 91 ASSERT_TRUE(loc_bar->GetBookmarkStarVisibility()); |
| 91 | 92 |
| 92 // Get the BookmarkModel to unbookmark the bookmark. | 93 // Get the BookmarkModel to unbookmark the bookmark. |
| 93 BookmarkModel* model = | 94 BookmarkModel* model = |
| 94 BookmarkModelFactory::GetForProfile(browser()->profile()); | 95 BookmarkModelFactory::GetForProfile(browser()->profile()); |
| 96 ui_test_utils::WaitForBookmarkModelToLoad(model); |
| 95 bookmark_utils::RemoveAllBookmarks(model, GURL("http://www.google.com")); | 97 bookmark_utils::RemoveAllBookmarks(model, GURL("http://www.google.com")); |
| 96 | 98 |
| 97 // Page is now unbookmarked. | 99 // Page is now unbookmarked. |
| 98 ASSERT_FALSE(loc_bar->GetBookmarkStarVisibility()); | 100 ASSERT_FALSE(loc_bar->GetBookmarkStarVisibility()); |
| 99 | 101 |
| 100 } | 102 } |
| OLD | NEW |