diff options
-rw-r--r-- | ash/ash.gyp | 13 | ||||
-rw-r--r-- | ash/test/test_suite.cc | 10 | ||||
-rw-r--r-- | ash/test/test_suite_init.h | 11 | ||||
-rw-r--r-- | ash/test/test_suite_init.mm | 26 | ||||
-rw-r--r-- | ash/wm/base_layout_manager_unittest.cc | 9 | ||||
-rw-r--r-- | ash/wm/shelf_layout_manager_unittest.cc | 8 | ||||
-rw-r--r-- | ash/wm/toplevel_layout_manager_unittest.cc | 9 | ||||
-rw-r--r-- | ui/aura/root_window.cc | 4 | ||||
-rw-r--r-- | ui/aura/root_window_host_mac.mm | 12 |
9 files changed, 94 insertions, 8 deletions
diff --git a/ash/ash.gyp b/ash/ash.gyp index 04759880..a4dfdef 100644 --- a/ash/ash.gyp +++ b/ash/ash.gyp @@ -220,6 +220,8 @@ 'test/test_shell_delegate.h', 'test/test_suite.cc', 'test/test_suite.h', + 'test/test_suite_init.h', + 'test/test_suite_init.mm', 'tooltips/tooltip_controller_unittest.cc', 'wm/activation_controller_unittest.cc', 'wm/base_layout_manager_unittest.cc', @@ -251,8 +253,17 @@ }], ['OS=="mac"', { 'sources/': [ + ['exclude', 'accelerators/accelerator_filter_unittest.cc'], ['exclude', 'drag_drop/drag_drop_controller_unittest.cc'], + ['exclude', 'tooltips/tooltip_controller_unittest.cc'], ], + 'dependencies': [ + # Mac tests access resources via the 'AuraShell.app' directory. + 'ash_shell', + ], + # Special linker instructions that avoids stripping Obj-C classes that + # are not referenced in code, but are referenced in nibs. + 'xcode_settings': {'OTHER_LDFLAGS': ['-Wl,-ObjC']}, }], ], }, @@ -283,8 +294,8 @@ 'shell/example_factory.h', 'shell/lock_view.cc', 'shell/shell_main.cc', - 'shell/shell_main_parts.h', 'shell/shell_main_parts.cc', + 'shell/shell_main_parts.h', 'shell/shell_main_parts_mac.mm', 'shell/toplevel_window.cc', 'shell/toplevel_window.h', diff --git a/ash/test/test_suite.cc b/ash/test/test_suite.cc index a8a8c87..48e3f45 100644 --- a/ash/test/test_suite.cc +++ b/ash/test/test_suite.cc @@ -9,10 +9,13 @@ #include "build/build_config.h" #include "ui/base/resource/resource_bundle.h" #include "ui/base/ui_base_paths.h" +#include "ui/gfx/compositor/compositor_setup.h" #include "ui/gfx/compositor/test/compositor_test_support.h" #include "ui/gfx/gfx_paths.h" -#include "ui/gfx/compositor/compositor_setup.h" +#if defined(OS_MACOSX) +#include "ash/test/test_suite_init.h" +#endif namespace ash { namespace test { @@ -26,6 +29,10 @@ void AuraShellTestSuite::Initialize() { gfx::RegisterPathProvider(); ui::RegisterPathProvider(); +#if defined(OS_MACOSX) + ash::test::OverrideFrameworkBundle(); +#endif + // Force unittests to run using en-US so if we test against string // output, it'll pass regardless of the system language. ui::ResourceBundle::InitSharedInstanceWithLocale("en-US"); @@ -36,7 +43,6 @@ void AuraShellTestSuite::Initialize() { void AuraShellTestSuite::Shutdown() { ui::CompositorTestSupport::Terminate(); ui::ResourceBundle::CleanupSharedInstance(); - base::TestSuite::Shutdown(); } diff --git a/ash/test/test_suite_init.h b/ash/test/test_suite_init.h new file mode 100644 index 0000000..1a0cc14 --- /dev/null +++ b/ash/test/test_suite_init.h @@ -0,0 +1,11 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +namespace ash { +namespace test { + +void OverrideFrameworkBundle(); + +} // namespace test +} // namespace ash diff --git a/ash/test/test_suite_init.mm b/ash/test/test_suite_init.mm new file mode 100644 index 0000000..df14114 --- /dev/null +++ b/ash/test/test_suite_init.mm @@ -0,0 +1,26 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ash/test/test_suite_init.h" + +#import <Cocoa/Cocoa.h> + +#include "base/file_path.h" +#include "base/mac/bundle_locations.h" +#include "base/memory/scoped_nsobject.h" +#include "base/path_service.h" + +namespace ash { +namespace test { + +void OverrideFrameworkBundle() { + // Look in the AuraShell.app directory for resources. + FilePath path; + PathService::Get(base::DIR_EXE, &path); + path = path.Append(FILE_PATH_LITERAL("AuraShell.app")); + base::mac::SetOverrideFrameworkBundlePath(path); +} + +} // namespace test +} // namespace ash diff --git a/ash/wm/base_layout_manager_unittest.cc b/ash/wm/base_layout_manager_unittest.cc index 5fe3d73..34c2019 100644 --- a/ash/wm/base_layout_manager_unittest.cc +++ b/ash/wm/base_layout_manager_unittest.cc @@ -103,9 +103,16 @@ TEST_F(BaseLayoutManagerTest, FullscreenRootWindowResize) { window->bounds()); } +// Fails on Mac only. Need to be implemented. http://crbug.com/111279. +#if defined(OS_MACOSX) +#define MAYBE_RootWindowResizeShrinksWindows \ + FAILS_RootWindowResizeShrinksWindows +#else +#define MAYBE_RootWindowResizeShrinksWindows RootWindowResizeShrinksWindows +#endif // Tests that when the screen gets smaller the windows aren't bigger than // the screen. -TEST_F(BaseLayoutManagerTest, RootWindowResizeShrinksWindows) { +TEST_F(BaseLayoutManagerTest, MAYBE_RootWindowResizeShrinksWindows) { scoped_ptr<aura::Window> window( CreateTestWindow(gfx::Rect(10, 20, 500, 400))); gfx::Rect work_area = gfx::Screen::GetMonitorAreaNearestWindow(window.get()); diff --git a/ash/wm/shelf_layout_manager_unittest.cc b/ash/wm/shelf_layout_manager_unittest.cc index b09e2f1..5eeb130 100644 --- a/ash/wm/shelf_layout_manager_unittest.cc +++ b/ash/wm/shelf_layout_manager_unittest.cc @@ -38,8 +38,14 @@ ShelfLayoutManager* GetShelfLayoutManager() { typedef ash::test::AuraShellTestBase ShelfLayoutManagerTest; +// Fails on Mac only. Need to be implemented. http://crbug.com/111279. +#if defined(OS_MACOSX) +#define MAYBE_SetVisible FAILS_SetVisible +#else +#define MAYBE_SetVisible SetVisible +#endif // Makes sure SetVisible updates work area and widget appropriately. -TEST_F(ShelfLayoutManagerTest, SetVisible) { +TEST_F(ShelfLayoutManagerTest, MAYBE_SetVisible) { ShelfLayoutManager* shelf = GetShelfLayoutManager(); // Force an initial layout. shelf->LayoutShelf(); diff --git a/ash/wm/toplevel_layout_manager_unittest.cc b/ash/wm/toplevel_layout_manager_unittest.cc index e50dc4d..5245c85 100644 --- a/ash/wm/toplevel_layout_manager_unittest.cc +++ b/ash/wm/toplevel_layout_manager_unittest.cc @@ -119,9 +119,16 @@ TEST_F(ToplevelLayoutManagerTest, FullscreenRootWindowResize) { window->bounds()); } +// Fails on Mac only. Need to be implemented. http://crbug.com/111279. +#if defined(OS_MACOSX) +#define MAYBE_RootWindowResizeShrinksWindows \ + FAILS_RootWindowResizeShrinksWindows +#else +#define MAYBE_RootWindowResizeShrinksWindows RootWindowResizeShrinksWindows +#endif // Tests that when the screen gets smaller the windows aren't bigger than // the screen. -TEST_F(ToplevelLayoutManagerTest, RootWindowResizeShrinksWindows) { +TEST_F(ToplevelLayoutManagerTest, MAYBE_RootWindowResizeShrinksWindows) { scoped_ptr<aura::Window> window( CreateTestWindow(gfx::Rect(10, 20, 500, 400))); gfx::Rect work_area = gfx::Screen::GetMonitorAreaNearestWindow(window.get()); diff --git a/ui/aura/root_window.cc b/ui/aura/root_window.cc index 8f5c7ee..2d66c34 100644 --- a/ui/aura/root_window.cc +++ b/ui/aura/root_window.cc @@ -446,6 +446,10 @@ RootWindow::~RootWindow() { // Make sure to destroy the compositor before terminating so that state is // cleared and we don't hit asserts. compositor_ = NULL; + + // Tear down in reverse. Frees any references held by the host. + host_.reset(NULL); + // An observer may have been added by an animation on the RootWindow. layer()->GetAnimator()->RemoveObserver(this); ui::Compositor::Terminate(); diff --git a/ui/aura/root_window_host_mac.mm b/ui/aura/root_window_host_mac.mm index 9fba814..1160f0e 100644 --- a/ui/aura/root_window_host_mac.mm +++ b/ui/aura/root_window_host_mac.mm @@ -7,6 +7,7 @@ #import <Cocoa/Cocoa.h> #include "base/compiler_specific.h" +#include "base/mac/bundle_locations.h" #include "base/memory/scoped_nsobject.h" #include "ui/aura/event.h" #include "ui/aura/root_window.h" @@ -74,13 +75,20 @@ RootWindowHostMacDelegate::~RootWindowHostMacDelegate() { RootWindowHostMac::RootWindowHostMac(const gfx::Rect& bounds) : root_window_(NULL), bounds_(bounds) { - controller_.reset([[NSWindowController alloc] - initWithWindowNibName:@"RootWindow"]); + NSString* nibpath = [base::mac::FrameworkBundle() + pathForResource:@"RootWindow" + ofType:@"nib"]; + NSWindowController* controller = [NSWindowController alloc]; + controller_.reset([controller initWithWindowNibPath:nibpath + owner:controller]); SetSize(bounds.size()); SetLocation(bounds); } RootWindowHostMac::~RootWindowHostMac() { + RootWindowView* view = [[controller_ window] contentView]; + [view setCompositor:NULL]; + [controller_ close]; } // static |