| 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 "base/utf_string_conversions.h" |
| 9 #include "chrome/app/chrome_command_ids.h" | 9 #include "chrome/app/chrome_command_ids.h" |
| 10 #include "chrome/browser/bookmarks/bookmark_model.h" | 10 #include "chrome/browser/bookmarks/bookmark_model.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 FAIL() << "Unexpected notification type"; | 68 FAIL() << "Unexpected notification type"; |
| 69 } | 69 } |
| 70 MessageLoop::current()->Quit(); | 70 MessageLoop::current()->Quit(); |
| 71 } | 71 } |
| 72 | 72 |
| 73 DISALLOW_COPY_AND_ASSIGN(ActionBoxTest); | 73 DISALLOW_COPY_AND_ASSIGN(ActionBoxTest); |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 // Test if Bookmark star appears after bookmarking a page in the action box, and | 76 // Test if Bookmark star appears after bookmarking a page in the action box, and |
| 77 // disappears after unbookmarking a page. | 77 // disappears after unbookmarking a page. |
| 78 IN_PROC_BROWSER_TEST_F(ActionBoxTest, BookmarkAPageTest) { | 78 // Flakily fails: http://crbug.com/163733 |
| 79 IN_PROC_BROWSER_TEST_F(ActionBoxTest, DISABLED_BookmarkAPageTest) { |
| 79 LocationBarTesting* loc_bar = | 80 LocationBarTesting* loc_bar = |
| 80 browser()->window()->GetLocationBar()->GetLocationBarForTesting(); | 81 browser()->window()->GetLocationBar()->GetLocationBarForTesting(); |
| 81 | 82 |
| 82 // Navigate somewhere we can bookmark. | 83 // Navigate somewhere we can bookmark. |
| 83 ui_test_utils::NavigateToURL(browser(), GURL("http://www.google.com")); | 84 ui_test_utils::NavigateToURL(browser(), GURL("http://www.google.com")); |
| 84 | 85 |
| 85 // Page is not bookmarked yet. | 86 // Page is not bookmarked yet. |
| 86 ASSERT_FALSE(loc_bar->GetBookmarkStarVisibility()); | 87 ASSERT_FALSE(loc_bar->GetBookmarkStarVisibility()); |
| 87 | 88 |
| 88 // Simulate an action box click and menu item selection. | 89 // Simulate an action box click and menu item selection. |
| 89 chrome::ExecuteCommand(browser(), IDC_BOOKMARK_PAGE); | 90 chrome::ExecuteCommand(browser(), IDC_BOOKMARK_PAGE); |
| 90 | 91 |
| 91 // Page is now bookmarked. | 92 // Page is now bookmarked. |
| 92 ASSERT_TRUE(loc_bar->GetBookmarkStarVisibility()); | 93 ASSERT_TRUE(loc_bar->GetBookmarkStarVisibility()); |
| 93 | 94 |
| 94 // Get the BookmarkModel to unbookmark the bookmark. | 95 // Get the BookmarkModel to unbookmark the bookmark. |
| 95 BookmarkModel* model = | 96 BookmarkModel* model = |
| 96 BookmarkModelFactory::GetForProfile(browser()->profile()); | 97 BookmarkModelFactory::GetForProfile(browser()->profile()); |
| 97 ui_test_utils::WaitForBookmarkModelToLoad(model); | 98 ui_test_utils::WaitForBookmarkModelToLoad(model); |
| 98 bookmark_utils::RemoveAllBookmarks(model, GURL("http://www.google.com")); | 99 bookmark_utils::RemoveAllBookmarks(model, GURL("http://www.google.com")); |
| 99 | 100 |
| 100 // Page is now unbookmarked. | 101 // Page is now unbookmarked. |
| 101 ASSERT_FALSE(loc_bar->GetBookmarkStarVisibility()); | 102 ASSERT_FALSE(loc_bar->GetBookmarkStarVisibility()); |
| 102 | 103 |
| 103 } | 104 } |
| OLD | NEW |