Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(425)

Side by Side Diff: chrome/browser/ui/panels/panel_browser_window_cocoa_unittest.mm

Issue 10411036: Separate BrowserWindow from Panel class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix mac unit_tests compile Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #import "chrome/browser/ui/panels/panel_browser_window_cocoa.h" 5 #import "chrome/browser/ui/panels/panel_browser_window_cocoa.h"
6 6
7 #include <Carbon/Carbon.h> 7 #include <Carbon/Carbon.h>
8 #import <Cocoa/Cocoa.h> 8 #import <Cocoa/Cocoa.h>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/debug/debugger.h" 11 #include "base/debug/debugger.h"
12 #include "base/mac/scoped_nsautorelease_pool.h" 12 #include "base/mac/scoped_nsautorelease_pool.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "chrome/app/chrome_command_ids.h" // IDC_* 14 #include "chrome/app/chrome_command_ids.h" // IDC_*
15 #include "chrome/browser/ui/browser.h" 15 #include "chrome/browser/ui/browser.h"
16 #include "chrome/browser/ui/browser_list.h" 16 #include "chrome/browser/ui/browser_list.h"
17 #import "chrome/browser/ui/cocoa/browser_window_utils.h" 17 #import "chrome/browser/ui/cocoa/browser_window_utils.h"
18 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" 18 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h"
19 #import "chrome/browser/ui/cocoa/run_loop_testing.h" 19 #import "chrome/browser/ui/cocoa/run_loop_testing.h"
20 #include "chrome/browser/ui/panels/panel.h" 20 #include "chrome/browser/ui/panels/panel.h"
21 #include "chrome/browser/ui/panels/panel_browser_window.h"
21 #include "chrome/browser/ui/panels/panel_manager.h" 22 #include "chrome/browser/ui/panels/panel_manager.h"
22 #import "chrome/browser/ui/panels/panel_titlebar_view_cocoa.h" 23 #import "chrome/browser/ui/panels/panel_titlebar_view_cocoa.h"
23 #import "chrome/browser/ui/panels/panel_window_controller_cocoa.h" 24 #import "chrome/browser/ui/panels/panel_window_controller_cocoa.h"
24 #include "chrome/common/chrome_notification_types.h" 25 #include "chrome/common/chrome_notification_types.h"
25 #include "chrome/common/chrome_switches.h" 26 #include "chrome/common/chrome_switches.h"
26 #include "chrome/test/base/ui_test_utils.h" 27 #include "chrome/test/base/ui_test_utils.h"
27 #include "testing/gtest/include/gtest/gtest.h" 28 #include "testing/gtest/include/gtest/gtest.h"
28 #include "testing/gtest_mac.h" 29 #include "testing/gtest_mac.h"
29 30
30 class PanelAnimatedBoundsObserver : 31 class PanelAnimatedBoundsObserver :
(...skipping 21 matching lines...) Expand all
52 base::mac::ScopedNSAutoreleasePool autorelease_pool; 53 base::mac::ScopedNSAutoreleasePool autorelease_pool;
53 54
54 PanelManager* manager = PanelManager::GetInstance(); 55 PanelManager* manager = PanelManager::GetInstance();
55 int panels_count = manager->num_panels(); 56 int panels_count = manager->num_panels();
56 57
57 Browser* panel_browser = Browser::CreateWithParams( 58 Browser* panel_browser = Browser::CreateWithParams(
58 Browser::CreateParams::CreateForApp( 59 Browser::CreateParams::CreateForApp(
59 Browser::TYPE_PANEL, panel_name, gfx::Rect(), profile())); 60 Browser::TYPE_PANEL, panel_name, gfx::Rect(), profile()));
60 EXPECT_EQ(panels_count + 1, manager->num_panels()); 61 EXPECT_EQ(panels_count + 1, manager->num_panels());
61 62
62 Panel* panel = static_cast<Panel*>(panel_browser->window()); 63 PanelBrowserWindow* panel_browser_window =
64 static_cast<PanelBrowserWindow*>(panel_browser->window());
65 Panel* panel = panel_browser_window->panel();
63 EXPECT_TRUE(panel); 66 EXPECT_TRUE(panel);
64 EXPECT_TRUE(panel->native_panel()); // Native panel is created right away. 67 EXPECT_TRUE(panel->native_panel()); // Native panel is created right away.
65 PanelBrowserWindowCocoa* native_window = 68 PanelBrowserWindowCocoa* native_window =
66 static_cast<PanelBrowserWindowCocoa*>(panel->native_panel()); 69 static_cast<PanelBrowserWindowCocoa*>(panel->native_panel());
67 EXPECT_EQ(panel, native_window->panel_); // Back pointer initialized. 70 EXPECT_EQ(panel, native_window->panel_); // Back pointer initialized.
68 71
69 PanelAnimatedBoundsObserver bounds_observer(panel); 72 PanelAnimatedBoundsObserver bounds_observer(panel);
70 73
71 // Window should not load before Show(). 74 // Window should not load before Show().
72 // Note: Loading the wnidow causes Cocoa to autorelease a few objects. 75 // Note: Loading the wnidow causes Cocoa to autorelease a few objects.
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 NSWindow* frontmostWindow = [[NSApp orderedWindows] objectAtIndex:0]; 407 NSWindow* frontmostWindow = [[NSApp orderedWindows] objectAtIndex:0];
405 EXPECT_NSEQ(frontmostWindow, [native_window->controller_ window]); 408 EXPECT_NSEQ(frontmostWindow, [native_window->controller_ window]);
406 409
407 native_window2->ActivatePanel(); 410 native_window2->ActivatePanel();
408 frontmostWindow = [[NSApp orderedWindows] objectAtIndex:0]; 411 frontmostWindow = [[NSApp orderedWindows] objectAtIndex:0];
409 EXPECT_NSEQ(frontmostWindow, [native_window2->controller_ window]); 412 EXPECT_NSEQ(frontmostWindow, [native_window2->controller_ window]);
410 413
411 ClosePanelAndWait(panel->browser()); 414 ClosePanelAndWait(panel->browser());
412 ClosePanelAndWait(panel2->browser()); 415 ClosePanelAndWait(panel2->browser());
413 } 416 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698