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/base_panel_browser_test.h" | 5 #include "chrome/browser/ui/panels/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/panels/native_panel.h" | 18 #include "chrome/browser/ui/panels/native_panel.h" |
19 #include "chrome/browser/ui/panels/panel_manager.h" | 19 #include "chrome/browser/ui/panels/panel_manager.h" |
20 #include "chrome/browser/ui/panels/panel_mouse_watcher.h" | 20 #include "chrome/browser/ui/panels/panel_mouse_watcher.h" |
21 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 21 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
22 #include "chrome/common/chrome_notification_types.h" | 22 #include "chrome/common/chrome_notification_types.h" |
23 #include "chrome/common/chrome_paths.h" | 23 #include "chrome/common/chrome_paths.h" |
24 #include "chrome/common/chrome_switches.h" | 24 #include "chrome/common/chrome_switches.h" |
25 #include "chrome/common/string_ordinal.h" | 25 #include "chrome/common/string_ordinal.h" |
26 #include "chrome/test/base/ui_test_utils.h" | 26 #include "chrome/test/base/ui_test_utils.h" |
27 #include "content/browser/tab_contents/test_tab_contents.h" | 27 #include "content/test/web_contents_tester.h" |
28 #include "content/public/browser/notification_service.h" | 28 #include "content/public/browser/notification_service.h" |
29 #include "content/public/common/url_constants.h" | 29 #include "content/public/common/url_constants.h" |
30 | 30 |
| 31 #if defined(OS_LINUX) |
| 32 #include "ui/base/x/x11_util.h" |
| 33 #endif |
| 34 |
31 #if defined(OS_MACOSX) | 35 #if defined(OS_MACOSX) |
32 #include "base/mac/scoped_nsautorelease_pool.h" | 36 #include "base/mac/scoped_nsautorelease_pool.h" |
33 #include "chrome/browser/ui/cocoa/find_bar/find_bar_bridge.h" | 37 #include "chrome/browser/ui/cocoa/find_bar/find_bar_bridge.h" |
34 #endif | 38 #endif |
35 | 39 |
| 40 using content::WebContentsTester; |
| 41 |
36 namespace { | 42 namespace { |
37 | 43 |
38 const int kTestingWorkAreaWidth = 800; | 44 const int kTestingWorkAreaWidth = 800; |
39 const int kTestingWorkAreaHeight = 600; | 45 const int kTestingWorkAreaHeight = 600; |
40 | 46 |
41 struct MockDesktopBar { | 47 struct MockDesktopBar { |
42 bool auto_hiding_enabled; | 48 bool auto_hiding_enabled; |
43 DisplaySettingsProvider::DesktopBarVisibility visibility; | 49 DisplaySettingsProvider::DesktopBarVisibility visibility; |
44 int thickness; | 50 int thickness; |
45 }; | 51 }; |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 // SHOW_AS_ACTIVE. | 430 // SHOW_AS_ACTIVE. |
425 CreatePanelParams params(name, bounds, SHOW_AS_ACTIVE); | 431 CreatePanelParams params(name, bounds, SHOW_AS_ACTIVE); |
426 params.expected_active_state = SHOW_AS_INACTIVE; | 432 params.expected_active_state = SHOW_AS_INACTIVE; |
427 Panel* panel = CreatePanelWithParams(params); | 433 Panel* panel = CreatePanelWithParams(params); |
428 WaitForLayoutModeChanged(panel, PanelStrip::IN_OVERFLOW); | 434 WaitForLayoutModeChanged(panel, PanelStrip::IN_OVERFLOW); |
429 return panel; | 435 return panel; |
430 } | 436 } |
431 | 437 |
432 void BasePanelBrowserTest::CreateTestTabContents(Browser* browser) { | 438 void BasePanelBrowserTest::CreateTestTabContents(Browser* browser) { |
433 TabContentsWrapper* tab_contents = | 439 TabContentsWrapper* tab_contents = |
434 new TabContentsWrapper(new TestTabContents(browser->profile(), NULL)); | 440 new TabContentsWrapper( |
| 441 WebContentsTester::CreateTestWebContents(browser->profile(), NULL)); |
435 browser->AddTab(tab_contents, content::PAGE_TRANSITION_LINK); | 442 browser->AddTab(tab_contents, content::PAGE_TRANSITION_LINK); |
436 } | 443 } |
437 | 444 |
438 scoped_refptr<Extension> BasePanelBrowserTest::CreateExtension( | 445 scoped_refptr<Extension> BasePanelBrowserTest::CreateExtension( |
439 const FilePath::StringType& path, | 446 const FilePath::StringType& path, |
440 Extension::Location location, | 447 Extension::Location location, |
441 const DictionaryValue& extra_value) { | 448 const DictionaryValue& extra_value) { |
442 #if defined(OS_WIN) | 449 #if defined(OS_WIN) |
443 FilePath full_path(FILE_PATH_LITERAL("c:\\")); | 450 FilePath full_path(FILE_PATH_LITERAL("c:\\")); |
444 #else | 451 #else |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 } | 491 } |
485 | 492 |
486 void BasePanelBrowserTest::MoveMouse(const gfx::Point& position) { | 493 void BasePanelBrowserTest::MoveMouse(const gfx::Point& position) { |
487 PanelManager::GetInstance()->mouse_watcher()->NotifyMouseMovement(position); | 494 PanelManager::GetInstance()->mouse_watcher()->NotifyMouseMovement(position); |
488 } | 495 } |
489 | 496 |
490 std::string BasePanelBrowserTest::MakePanelName(int index) { | 497 std::string BasePanelBrowserTest::MakePanelName(int index) { |
491 std::string panel_name("Panel"); | 498 std::string panel_name("Panel"); |
492 return panel_name + base::IntToString(index); | 499 return panel_name + base::IntToString(index); |
493 } | 500 } |
OLD | NEW |