| 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/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/file_path.h" | 6 #include "base/file_path.h" |
| 7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "chrome/browser/extensions/extension_browsertest.h" | 9 #include "chrome/browser/extensions/extension_browsertest.h" |
| 10 #include "chrome/browser/sidebar/sidebar_manager.h" | 10 #include "chrome/browser/sidebar/sidebar_manager.h" |
| 11 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser.h" |
| 12 #include "chrome/browser/ui/browser_window.h" | 12 #include "chrome/browser/ui/browser_window.h" |
| 13 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 13 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 14 #include "chrome/browser/ui/views/frame/browser_view.h" | 14 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 15 #include "chrome/common/chrome_paths.h" | 15 #include "chrome/common/chrome_paths.h" |
| 16 #include "chrome/common/chrome_switches.h" | 16 #include "chrome/common/chrome_switches.h" |
| 17 #include "chrome/common/extensions/extension.h" | 17 #include "chrome/common/extensions/extension.h" |
| 18 #include "chrome/test/base/in_process_browser_test.h" | 18 #include "chrome/test/base/in_process_browser_test.h" |
| 19 #include "chrome/test/base/ui_test_utils.h" | 19 #include "chrome/test/base/ui_test_utils.h" |
| 20 #include "content/browser/tab_contents/tab_contents.h" | 20 #include "content/browser/tab_contents/tab_contents.h" |
| 21 #include "net/test/test_server.h" | 21 #include "net/test/test_server.h" |
| 22 | 22 |
| 23 #include "chrome/browser/extensions/extension_service.h" | 23 #include "chrome/browser/extensions/extension_service.h" |
| 24 #include "chrome/browser/profiles/profile.h" | 24 #include "chrome/browser/profiles/profile.h" |
| 25 | 25 |
| 26 using content::NavigationController; |
| 27 |
| 26 namespace { | 28 namespace { |
| 27 | 29 |
| 28 const char kSimplePage[] = "files/sidebar/simple_page.html"; | 30 const char kSimplePage[] = "files/sidebar/simple_page.html"; |
| 29 | 31 |
| 30 class SidebarTest : public ExtensionBrowserTest { | 32 class SidebarTest : public ExtensionBrowserTest { |
| 31 public: | 33 public: |
| 32 SidebarTest() { | 34 SidebarTest() { |
| 33 CommandLine::ForCurrentProcess()->AppendSwitch( | 35 CommandLine::ForCurrentProcess()->AppendSwitch( |
| 34 switches::kEnableExperimentalExtensionApis); | 36 switches::kEnableExperimentalExtensionApis); |
| 35 } | 37 } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 TabContents* tab = | 74 TabContents* tab = |
| 73 browser()->GetSelectedTabContentsWrapper()->tab_contents(); | 75 browser()->GetSelectedTabContentsWrapper()->tab_contents(); |
| 74 | 76 |
| 75 SidebarManager* sidebar_manager = SidebarManager::GetInstance(); | 77 SidebarManager* sidebar_manager = SidebarManager::GetInstance(); |
| 76 SidebarContainer* sidebar_container = | 78 SidebarContainer* sidebar_container = |
| 77 sidebar_manager->GetSidebarContainerFor(tab, content_id_); | 79 sidebar_manager->GetSidebarContainerFor(tab, content_id_); |
| 78 TabContents* client_contents = sidebar_container->sidebar_contents(); | 80 TabContents* client_contents = sidebar_container->sidebar_contents(); |
| 79 | 81 |
| 80 ui_test_utils::WindowedNotificationObserver observer( | 82 ui_test_utils::WindowedNotificationObserver observer( |
| 81 content::NOTIFICATION_LOAD_STOP, | 83 content::NOTIFICATION_LOAD_STOP, |
| 82 content::Source<content::NavigationController>( | 84 content::Source<NavigationController>( |
| 83 &client_contents->GetController())); | 85 &client_contents->GetController())); |
| 84 sidebar_manager->NavigateSidebar(tab, content_id_, url); | 86 sidebar_manager->NavigateSidebar(tab, content_id_, url); |
| 85 observer.Wait(); | 87 observer.Wait(); |
| 86 } | 88 } |
| 87 | 89 |
| 88 void ShowSidebar(TabContents* tab) { | 90 void ShowSidebar(TabContents* tab) { |
| 89 SidebarManager* sidebar_manager = SidebarManager::GetInstance(); | 91 SidebarManager* sidebar_manager = SidebarManager::GetInstance(); |
| 90 sidebar_manager->ShowSidebar(tab, content_id_); | 92 sidebar_manager->ShowSidebar(tab, content_id_); |
| 91 } | 93 } |
| 92 | 94 |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 ASSERT_TRUE(test_server()->Start()); | 198 ASSERT_TRUE(test_server()->Start()); |
| 197 | 199 |
| 198 ShowSidebarForCurrentTab(); | 200 ShowSidebarForCurrentTab(); |
| 199 | 201 |
| 200 NavigateSidebarForCurrentTabTo(kSimplePage); | 202 NavigateSidebarForCurrentTabTo(kSimplePage); |
| 201 | 203 |
| 202 HideSidebarForCurrentTab(); | 204 HideSidebarForCurrentTab(); |
| 203 } | 205 } |
| 204 | 206 |
| 205 } // namespace | 207 } // namespace |
| OLD | NEW |