| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/browser/bookmarks/bookmark_model.h" | 8 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 9 #include "chrome/browser/bookmarks/bookmark_utils.h" | 9 #include "chrome/browser/bookmarks/bookmark_utils.h" |
| 10 #include "chrome/browser/download/download_shelf.h" | 10 #include "chrome/browser/download/download_shelf.h" |
| 11 #include "chrome/browser/prefs/pref_service.h" | 11 #include "chrome/browser/prefs/pref_service.h" |
| 12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 13 #include "chrome/browser/sidebar/sidebar_manager.h" | |
| 14 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
| 15 #include "chrome/browser/ui/browser_window.h" | 14 #include "chrome/browser/ui/browser_window.h" |
| 16 #include "chrome/browser/ui/cocoa/view_id_util.h" | 15 #include "chrome/browser/ui/cocoa/view_id_util.h" |
| 17 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 16 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 18 #include "chrome/common/chrome_switches.h" | 17 #include "chrome/common/chrome_switches.h" |
| 19 #include "chrome/common/pref_names.h" | 18 #include "chrome/common/pref_names.h" |
| 20 #include "chrome/common/url_constants.h" | 19 #include "chrome/common/url_constants.h" |
| 21 #include "chrome/test/base/in_process_browser_test.h" | 20 #include "chrome/test/base/in_process_browser_test.h" |
| 22 #include "chrome/test/base/ui_test_utils.h" | 21 #include "chrome/test/base/ui_test_utils.h" |
| 23 #include "content/browser/tab_contents/tab_contents.h" | 22 #include "content/browser/tab_contents/tab_contents.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 40 ASSERT_TRUE(root_window_); | 39 ASSERT_TRUE(root_window_); |
| 41 NSView* view = view_id_util::GetView(root_window_, view_id); | 40 NSView* view = view_id_util::GetView(root_window_, view_id); |
| 42 EXPECT_EQ(should_have, !!view) << " Failed id=" << view_id; | 41 EXPECT_EQ(should_have, !!view) << " Failed id=" << view_id; |
| 43 } | 42 } |
| 44 | 43 |
| 45 void DoTest() { | 44 void DoTest() { |
| 46 // Make sure FindBar is created to test | 45 // Make sure FindBar is created to test |
| 47 // VIEW_ID_FIND_IN_PAGE_TEXT_FIELD and VIEW_ID_FIND_IN_PAGE. | 46 // VIEW_ID_FIND_IN_PAGE_TEXT_FIELD and VIEW_ID_FIND_IN_PAGE. |
| 48 browser()->ShowFindBar(); | 47 browser()->ShowFindBar(); |
| 49 | 48 |
| 50 // Make sure sidebar is created to test VIEW_ID_SIDE_BAR_CONTAINER. | |
| 51 const char sidebar_content_id[] = "test_content_id"; | |
| 52 SidebarManager::GetInstance()->ShowSidebar( | |
| 53 static_cast<TabContents*>( | |
| 54 browser()->GetSelectedTabContentsWrapper()->web_contents()), | |
| 55 sidebar_content_id); | |
| 56 SidebarManager::GetInstance()->ExpandSidebar( | |
| 57 static_cast<TabContents*>( | |
| 58 browser()->GetSelectedTabContentsWrapper()->web_contents()), | |
| 59 sidebar_content_id); | |
| 60 | |
| 61 // Make sure docked devtools is created to test VIEW_ID_DEV_TOOLS_DOCKED | 49 // Make sure docked devtools is created to test VIEW_ID_DEV_TOOLS_DOCKED |
| 62 browser()->profile()->GetPrefs()->SetBoolean(prefs::kDevToolsOpenDocked, | 50 browser()->profile()->GetPrefs()->SetBoolean(prefs::kDevToolsOpenDocked, |
| 63 true); | 51 true); |
| 64 browser()->ToggleDevToolsWindow(DEVTOOLS_TOGGLE_ACTION_INSPECT); | 52 browser()->ToggleDevToolsWindow(DEVTOOLS_TOGGLE_ACTION_INSPECT); |
| 65 | 53 |
| 66 // Make sure download shelf is created to test VIEW_ID_DOWNLOAD_SHELF | 54 // Make sure download shelf is created to test VIEW_ID_DOWNLOAD_SHELF |
| 67 browser()->window()->GetDownloadShelf()->Show(); | 55 browser()->window()->GetDownloadShelf()->Show(); |
| 68 | 56 |
| 69 // Create a bookmark to test VIEW_ID_BOOKMARK_BAR_ELEMENT | 57 // Create a bookmark to test VIEW_ID_BOOKMARK_BAR_ELEMENT |
| 70 BookmarkModel* bookmark_model = browser()->profile()->GetBookmarkModel(); | 58 BookmarkModel* bookmark_model = browser()->profile()->GetBookmarkModel(); |
| 71 if (bookmark_model) { | 59 if (bookmark_model) { |
| 72 if (!bookmark_model->IsLoaded()) | 60 if (!bookmark_model->IsLoaded()) |
| 73 ui_test_utils::WaitForBookmarkModelToLoad(bookmark_model); | 61 ui_test_utils::WaitForBookmarkModelToLoad(bookmark_model); |
| 74 | 62 |
| 75 bookmark_utils::AddIfNotBookmarked( | 63 bookmark_utils::AddIfNotBookmarked( |
| 76 bookmark_model, GURL(chrome::kAboutBlankURL), ASCIIToUTF16("about")); | 64 bookmark_model, GURL(chrome::kAboutBlankURL), ASCIIToUTF16("about")); |
| 77 } | 65 } |
| 78 | 66 |
| 79 for (int i = VIEW_ID_TOOLBAR; i < VIEW_ID_PREDEFINED_COUNT; ++i) { | 67 for (int i = VIEW_ID_TOOLBAR; i < VIEW_ID_PREDEFINED_COUNT; ++i) { |
| 80 // Mac implementation does not support following ids yet. | 68 // Mac implementation does not support following ids yet. |
| 81 if (i == VIEW_ID_STAR_BUTTON || | 69 if (i == VIEW_ID_STAR_BUTTON || |
| 82 i == VIEW_ID_AUTOCOMPLETE || | 70 i == VIEW_ID_AUTOCOMPLETE || |
| 83 i == VIEW_ID_CONTENTS_SPLIT || | 71 i == VIEW_ID_CONTENTS_SPLIT || |
| 84 i == VIEW_ID_SIDE_BAR_SPLIT || | |
| 85 i == VIEW_ID_FEEDBACK_BUTTON || | 72 i == VIEW_ID_FEEDBACK_BUTTON || |
| 86 i == VIEW_ID_OMNIBOX) { | 73 i == VIEW_ID_OMNIBOX) { |
| 87 continue; | 74 continue; |
| 88 } | 75 } |
| 89 | 76 |
| 90 CheckViewID(static_cast<ViewID>(i), true); | 77 CheckViewID(static_cast<ViewID>(i), true); |
| 91 } | 78 } |
| 92 | 79 |
| 93 CheckViewID(VIEW_ID_TAB, true); | 80 CheckViewID(VIEW_ID_TAB, true); |
| 94 CheckViewID(VIEW_ID_TAB_STRIP, true); | 81 CheckViewID(VIEW_ID_TAB_STRIP, true); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 124 // VIEW_ID_TAB_LAST should always be available. | 111 // VIEW_ID_TAB_LAST should always be available. |
| 125 CheckViewID(VIEW_ID_TAB_LAST, true); | 112 CheckViewID(VIEW_ID_TAB_LAST, true); |
| 126 } | 113 } |
| 127 | 114 |
| 128 // Open the 11th tab. | 115 // Open the 11th tab. |
| 129 browser()->OpenURL(OpenURLParams( | 116 browser()->OpenURL(OpenURLParams( |
| 130 GURL(chrome::kAboutBlankURL), Referrer(), NEW_BACKGROUND_TAB, | 117 GURL(chrome::kAboutBlankURL), Referrer(), NEW_BACKGROUND_TAB, |
| 131 content::PAGE_TRANSITION_TYPED, false)); | 118 content::PAGE_TRANSITION_TYPED, false)); |
| 132 CheckViewID(VIEW_ID_TAB_LAST, true); | 119 CheckViewID(VIEW_ID_TAB_LAST, true); |
| 133 } | 120 } |
| OLD | NEW |