| 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/toolbar/toolbar_view.h" | 5 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/run_loop.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 11 #include "build/build_config.h" | 12 #include "build/build_config.h" |
| 12 #include "chrome/app/chrome_command_ids.h" | 13 #include "chrome/app/chrome_command_ids.h" |
| 13 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 14 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| 14 #include "chrome/browser/ui/browser.h" | 15 #include "chrome/browser/ui/browser.h" |
| 15 #include "chrome/browser/ui/browser_command_controller.h" | 16 #include "chrome/browser/ui/browser_command_controller.h" |
| 17 #include "chrome/browser/ui/browser_list.h" |
| 16 #include "chrome/browser/ui/browser_window.h" | 18 #include "chrome/browser/ui/browser_window.h" |
| 17 #include "chrome/browser/ui/view_ids.h" | 19 #include "chrome/browser/ui/view_ids.h" |
| 18 #include "chrome/browser/ui/views/frame/browser_view.h" | 20 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 19 #include "chrome/test/base/in_process_browser_test.h" | 21 #include "chrome/test/base/in_process_browser_test.h" |
| 20 #include "components/bookmarks/browser/bookmark_model.h" | 22 #include "components/bookmarks/browser/bookmark_model.h" |
| 21 #include "components/bookmarks/browser/bookmark_utils.h" | 23 #include "components/bookmarks/browser/bookmark_utils.h" |
| 22 #include "ui/views/focus/focus_manager.h" | 24 #include "ui/views/focus/focus_manager.h" |
| 23 #include "ui/views/view.h" | 25 #include "ui/views/view.h" |
| 24 #include "ui/views/widget/widget.h" | 26 #include "ui/views/widget/widget.h" |
| 25 | 27 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 for (size_t i = 0; i < count - 1; i++) | 95 for (size_t i = 0; i < count - 1; i++) |
| 94 EXPECT_EQ(ids[i], reverse_ids[count - 2 - i]); | 96 EXPECT_EQ(ids[i], reverse_ids[count - 2 - i]); |
| 95 } | 97 } |
| 96 | 98 |
| 97 // The test is flaky on Win (http://crbug.com/152938) and crashes on CrOS under | 99 // The test is flaky on Win (http://crbug.com/152938) and crashes on CrOS under |
| 98 // AddressSanitizer (http://crbug.com/154657). | 100 // AddressSanitizer (http://crbug.com/154657). |
| 99 IN_PROC_BROWSER_TEST_F(ToolbarViewTest, DISABLED_ToolbarCycleFocus) { | 101 IN_PROC_BROWSER_TEST_F(ToolbarViewTest, DISABLED_ToolbarCycleFocus) { |
| 100 RunToolbarCycleFocusTest(browser()); | 102 RunToolbarCycleFocusTest(browser()); |
| 101 } | 103 } |
| 102 | 104 |
| 103 #if defined(OS_WIN) | |
| 104 // http://crbug.com/152938 Flaky on win. | |
| 105 #define MAYBE_ToolbarCycleFocusWithBookmarkBar \ | |
| 106 DISABLED_ToolbarCycleFocusWithBookmarkBar | |
| 107 #else | |
| 108 #define MAYBE_ToolbarCycleFocusWithBookmarkBar ToolbarCycleFocusWithBookmarkBar | |
| 109 #endif | |
| 110 IN_PROC_BROWSER_TEST_F(ToolbarViewTest, | 105 IN_PROC_BROWSER_TEST_F(ToolbarViewTest, |
| 111 MAYBE_ToolbarCycleFocusWithBookmarkBar) { | 106 ToolbarCycleFocusWithBookmarkBar) { |
| 112 CommandUpdater* updater = browser()->command_controller()->command_updater(); | 107 CommandUpdater* updater = browser()->command_controller()->command_updater(); |
| 113 updater->ExecuteCommand(IDC_SHOW_BOOKMARK_BAR); | 108 updater->ExecuteCommand(IDC_SHOW_BOOKMARK_BAR); |
| 114 | 109 |
| 115 BookmarkModel* model = | 110 BookmarkModel* model = |
| 116 BookmarkModelFactory::GetForBrowserContext(browser()->profile()); | 111 BookmarkModelFactory::GetForBrowserContext(browser()->profile()); |
| 117 bookmarks::AddIfNotBookmarked( | 112 bookmarks::AddIfNotBookmarked( |
| 118 model, GURL("http://foo.com"), base::ASCIIToUTF16("Foo")); | 113 model, GURL("http://foo.com"), base::ASCIIToUTF16("Foo")); |
| 119 | 114 |
| 120 // We want to specifically test the case where the bookmark bar is | 115 // We want to specifically test the case where the bookmark bar is |
| 121 // already showing when a window opens, so create a second browser | 116 // already showing when a window opens, so create a second browser |
| 122 // window with the same profile. | 117 // window with the same profile. |
| 123 Browser* second_browser = CreateBrowser(browser()->profile()); | 118 Browser* second_browser = CreateBrowser(browser()->profile()); |
| 119 BrowserList::SetLastActive(second_browser); |
| 120 base::RunLoop().RunUntilIdle(); |
| 124 RunToolbarCycleFocusTest(second_browser); | 121 RunToolbarCycleFocusTest(second_browser); |
| 125 } | 122 } |
| 126 | 123 |
| 127 } // namespace | 124 } // namespace |
| OLD | NEW |