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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 | 52 |
53 Panel* panel = manager->CreatePanel(panel_name, profile(), | 53 Panel* panel = manager->CreatePanel(panel_name, profile(), |
54 GURL(), gfx::Rect(), | 54 GURL(), gfx::Rect(), |
55 PanelManager::CREATE_AS_DOCKED); | 55 PanelManager::CREATE_AS_DOCKED); |
56 EXPECT_EQ(panels_count + 1, manager->num_panels()); | 56 EXPECT_EQ(panels_count + 1, manager->num_panels()); |
57 | 57 |
58 EXPECT_TRUE(panel); | 58 EXPECT_TRUE(panel); |
59 EXPECT_TRUE(panel->native_panel()); // Native panel is created right away. | 59 EXPECT_TRUE(panel->native_panel()); // Native panel is created right away. |
60 PanelCocoa* native_window = | 60 PanelCocoa* native_window = |
61 static_cast<PanelCocoa*>(panel->native_panel()); | 61 static_cast<PanelCocoa*>(panel->native_panel()); |
62 EXPECT_EQ(panel, native_window->panel_); // Back pointer initialized. | 62 EXPECT_EQ(panel, native_window->panel_.get()); // Back pointer initialized. |
63 | 63 |
64 PanelAnimatedBoundsObserver bounds_observer(panel); | 64 PanelAnimatedBoundsObserver bounds_observer(panel); |
65 | 65 |
66 // Window should not load before Show(). | 66 // Window should not load before Show(). |
67 // Note: Loading the wnidow causes Cocoa to autorelease a few objects. | 67 // Note: Loading the wnidow causes Cocoa to autorelease a few objects. |
68 // This is the reason we do this within the scope of the | 68 // This is the reason we do this within the scope of the |
69 // ScopedNSAutoreleasePool. | 69 // ScopedNSAutoreleasePool. |
70 EXPECT_FALSE([native_window->controller_ isWindowLoaded]); | 70 EXPECT_FALSE([native_window->controller_ isWindowLoaded]); |
71 panel->Show(); | 71 panel->Show(); |
72 EXPECT_TRUE([native_window->controller_ isWindowLoaded]); | 72 EXPECT_TRUE([native_window->controller_ isWindowLoaded]); |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 EXPECT_NSEQ(frontmostWindow, [native_window->controller_ window]); | 401 EXPECT_NSEQ(frontmostWindow, [native_window->controller_ window]); |
402 | 402 |
403 native_window2->ActivatePanel(); | 403 native_window2->ActivatePanel(); |
404 chrome::testing::NSRunLoopRunAllPending(); | 404 chrome::testing::NSRunLoopRunAllPending(); |
405 frontmostWindow = [[NSApp orderedWindows] objectAtIndex:0]; | 405 frontmostWindow = [[NSApp orderedWindows] objectAtIndex:0]; |
406 EXPECT_NSEQ(frontmostWindow, [native_window2->controller_ window]); | 406 EXPECT_NSEQ(frontmostWindow, [native_window2->controller_ window]); |
407 | 407 |
408 ClosePanelAndWait(panel); | 408 ClosePanelAndWait(panel); |
409 ClosePanelAndWait(panel2); | 409 ClosePanelAndWait(panel2); |
410 } | 410 } |
OLD | NEW |