| 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 <Carbon/Carbon.h> | 5 #include <Carbon/Carbon.h> |
| 6 #import <Cocoa/Cocoa.h> | 6 #import <Cocoa/Cocoa.h> |
| 7 | 7 |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/debug/debugger.h" | 9 #include "base/debug/debugger.h" |
| 10 #include "base/mac/scoped_nsautorelease_pool.h" | 10 #include "base/mac/scoped_nsautorelease_pool.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 Panel* CreateTestPanel(const std::string& panel_name) { | 45 Panel* CreateTestPanel(const std::string& panel_name) { |
| 46 // Opening panels on a Mac causes NSWindowController of the Panel window | 46 // Opening panels on a Mac causes NSWindowController of the Panel window |
| 47 // to be autoreleased. We need a pool drained after it's done so the test | 47 // to be autoreleased. We need a pool drained after it's done so the test |
| 48 // can close correctly. | 48 // can close correctly. |
| 49 base::mac::ScopedNSAutoreleasePool autorelease_pool; | 49 base::mac::ScopedNSAutoreleasePool autorelease_pool; |
| 50 | 50 |
| 51 PanelManager* manager = PanelManager::GetInstance(); | 51 PanelManager* manager = PanelManager::GetInstance(); |
| 52 int panels_count = manager->num_panels(); | 52 int panels_count = manager->num_panels(); |
| 53 | 53 |
| 54 Panel* panel = manager->CreatePanel(panel_name, profile(), | 54 Panel* panel = manager->CreatePanel(panel_name, profile(), |
| 55 GURL(), gfx::Size()); | 55 GURL(), gfx::Rect(), |
| 56 PanelManager::CREATE_AS_DOCKED); |
| 56 EXPECT_EQ(panels_count + 1, manager->num_panels()); | 57 EXPECT_EQ(panels_count + 1, manager->num_panels()); |
| 57 | 58 |
| 58 EXPECT_TRUE(panel); | 59 EXPECT_TRUE(panel); |
| 59 EXPECT_TRUE(panel->native_panel()); // Native panel is created right away. | 60 EXPECT_TRUE(panel->native_panel()); // Native panel is created right away. |
| 60 PanelCocoa* native_window = | 61 PanelCocoa* native_window = |
| 61 static_cast<PanelCocoa*>(panel->native_panel()); | 62 static_cast<PanelCocoa*>(panel->native_panel()); |
| 62 EXPECT_EQ(panel, native_window->panel_); // Back pointer initialized. | 63 EXPECT_EQ(panel, native_window->panel_); // Back pointer initialized. |
| 63 | 64 |
| 64 PanelAnimatedBoundsObserver bounds_observer(panel); | 65 PanelAnimatedBoundsObserver bounds_observer(panel); |
| 65 | 66 |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 NSWindow* frontmostWindow = [[NSApp orderedWindows] objectAtIndex:0]; | 390 NSWindow* frontmostWindow = [[NSApp orderedWindows] objectAtIndex:0]; |
| 390 EXPECT_NSEQ(frontmostWindow, [native_window->controller_ window]); | 391 EXPECT_NSEQ(frontmostWindow, [native_window->controller_ window]); |
| 391 | 392 |
| 392 native_window2->ActivatePanel(); | 393 native_window2->ActivatePanel(); |
| 393 frontmostWindow = [[NSApp orderedWindows] objectAtIndex:0]; | 394 frontmostWindow = [[NSApp orderedWindows] objectAtIndex:0]; |
| 394 EXPECT_NSEQ(frontmostWindow, [native_window2->controller_ window]); | 395 EXPECT_NSEQ(frontmostWindow, [native_window2->controller_ window]); |
| 395 | 396 |
| 396 ClosePanelAndWait(panel); | 397 ClosePanelAndWait(panel); |
| 397 ClosePanelAndWait(panel2); | 398 ClosePanelAndWait(panel2); |
| 398 } | 399 } |
| OLD | NEW |