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 "chrome/browser/ui/panels/old_base_panel_browser_test.h" | 5 #include "chrome/browser/ui/panels/old_base_panel_browser_test.h" |
6 | 6 |
7 #include "chrome/browser/ui/browser_list.h" | 7 #include "chrome/browser/ui/browser_list.h" |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
13 #include "base/path_service.h" | 13 #include "base/path_service.h" |
14 #include "base/string_number_conversions.h" | 14 #include "base/string_number_conversions.h" |
15 #include "chrome/browser/extensions/extension_service.h" | 15 #include "chrome/browser/extensions/extension_service.h" |
16 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
17 #include "chrome/browser/ui/browser.h" | 17 #include "chrome/browser/ui/browser.h" |
| 18 #include "chrome/browser/ui/browser_tabstrip.h" |
18 #include "chrome/browser/ui/panels/native_panel.h" | 19 #include "chrome/browser/ui/panels/native_panel.h" |
19 #include "chrome/browser/ui/panels/panel_browser_window.h" | 20 #include "chrome/browser/ui/panels/panel_browser_window.h" |
20 #include "chrome/browser/ui/panels/panel_manager.h" | 21 #include "chrome/browser/ui/panels/panel_manager.h" |
21 #include "chrome/browser/ui/panels/panel_mouse_watcher.h" | 22 #include "chrome/browser/ui/panels/panel_mouse_watcher.h" |
22 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 23 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
23 #include "chrome/common/chrome_notification_types.h" | 24 #include "chrome/common/chrome_notification_types.h" |
24 #include "chrome/common/chrome_paths.h" | 25 #include "chrome/common/chrome_paths.h" |
25 #include "chrome/common/chrome_switches.h" | 26 #include "chrome/common/chrome_switches.h" |
26 #include "chrome/common/extensions/extension_manifest_constants.h" | 27 #include "chrome/common/extensions/extension_manifest_constants.h" |
27 #include "chrome/common/string_ordinal.h" | 28 #include "chrome/common/string_ordinal.h" |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 Browser* panel_browser = Browser::CreateWithParams( | 308 Browser* panel_browser = Browser::CreateWithParams( |
308 Browser::CreateParams::CreateForApp( | 309 Browser::CreateParams::CreateForApp( |
309 Browser::TYPE_PANEL, params.name, params.bounds, | 310 Browser::TYPE_PANEL, params.name, params.bounds, |
310 browser()->profile())); | 311 browser()->profile())); |
311 EXPECT_TRUE(panel_browser->is_type_panel()); | 312 EXPECT_TRUE(panel_browser->is_type_panel()); |
312 | 313 |
313 if (!params.url.is_empty()) { | 314 if (!params.url.is_empty()) { |
314 ui_test_utils::WindowedNotificationObserver observer( | 315 ui_test_utils::WindowedNotificationObserver observer( |
315 content::NOTIFICATION_LOAD_STOP, | 316 content::NOTIFICATION_LOAD_STOP, |
316 content::NotificationService::AllSources()); | 317 content::NotificationService::AllSources()); |
317 panel_browser->AddSelectedTabWithURL(params.url, | 318 chrome::AddSelectedTabWithURL(panel_browser, params.url, |
318 content::PAGE_TRANSITION_START_PAGE); | 319 content::PAGE_TRANSITION_START_PAGE); |
319 observer.Wait(); | 320 observer.Wait(); |
320 } | 321 } |
321 | 322 |
322 PanelBrowserWindow* panel_browser_window = | 323 PanelBrowserWindow* panel_browser_window = |
323 static_cast<PanelBrowserWindow*>(panel_browser->window()); | 324 static_cast<PanelBrowserWindow*>(panel_browser->window()); |
324 Panel* panel = panel_browser_window->panel(); | 325 Panel* panel = panel_browser_window->panel(); |
325 | 326 |
326 if (!PanelManager::GetInstance()->auto_sizing_enabled() || | 327 if (!PanelManager::GetInstance()->auto_sizing_enabled() || |
327 params.bounds.width() || params.bounds.height()) { | 328 params.bounds.width() || params.bounds.height()) { |
328 EXPECT_FALSE(panel->auto_resizable()); | 329 EXPECT_FALSE(panel->auto_resizable()); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 | 400 |
400 // static | 401 // static |
401 NativePanelTesting* OldBasePanelBrowserTest::CreateNativePanelTesting( | 402 NativePanelTesting* OldBasePanelBrowserTest::CreateNativePanelTesting( |
402 Panel* panel) { | 403 Panel* panel) { |
403 return panel->native_panel()->CreateNativePanelTesting(); | 404 return panel->native_panel()->CreateNativePanelTesting(); |
404 } | 405 } |
405 | 406 |
406 void OldBasePanelBrowserTest::CreateTestTabContents(Browser* browser) { | 407 void OldBasePanelBrowserTest::CreateTestTabContents(Browser* browser) { |
407 TabContents* tab_contents = new TabContents( | 408 TabContents* tab_contents = new TabContents( |
408 WebContentsTester::CreateTestWebContents(browser->profile(), NULL)); | 409 WebContentsTester::CreateTestWebContents(browser->profile(), NULL)); |
409 browser->AddTab(tab_contents, content::PAGE_TRANSITION_LINK); | 410 chrome::AddTab(browser, tab_contents, content::PAGE_TRANSITION_LINK); |
410 } | 411 } |
411 | 412 |
412 scoped_refptr<Extension> OldBasePanelBrowserTest::CreateExtension( | 413 scoped_refptr<Extension> OldBasePanelBrowserTest::CreateExtension( |
413 const FilePath::StringType& path, | 414 const FilePath::StringType& path, |
414 Extension::Location location, | 415 Extension::Location location, |
415 const DictionaryValue& extra_value) { | 416 const DictionaryValue& extra_value) { |
416 #if defined(OS_WIN) | 417 #if defined(OS_WIN) |
417 FilePath full_path(FILE_PATH_LITERAL("c:\\")); | 418 FilePath full_path(FILE_PATH_LITERAL("c:\\")); |
418 #else | 419 #else |
419 FilePath full_path(FILE_PATH_LITERAL("/")); | 420 FilePath full_path(FILE_PATH_LITERAL("/")); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
479 } | 480 } |
480 | 481 |
481 void OldBasePanelBrowserTest::MoveMouse(const gfx::Point& position) { | 482 void OldBasePanelBrowserTest::MoveMouse(const gfx::Point& position) { |
482 PanelManager::GetInstance()->mouse_watcher()->NotifyMouseMovement(position); | 483 PanelManager::GetInstance()->mouse_watcher()->NotifyMouseMovement(position); |
483 } | 484 } |
484 | 485 |
485 std::string OldBasePanelBrowserTest::MakePanelName(int index) { | 486 std::string OldBasePanelBrowserTest::MakePanelName(int index) { |
486 std::string panel_name("Panel"); | 487 std::string panel_name("Panel"); |
487 return panel_name + base::IntToString(index); | 488 return panel_name + base::IntToString(index); |
488 } | 489 } |
OLD | NEW |