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

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

Issue 7734003: Implement basic theming for panel titlebars. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 3 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_test_helper.h" 17 #import "chrome/browser/ui/cocoa/browser_test_helper.h"
18 #import "chrome/browser/ui/cocoa/browser_window_utils.h" 18 #import "chrome/browser/ui/cocoa/browser_window_utils.h"
19 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" 19 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h"
20 #import "chrome/browser/ui/cocoa/run_loop_testing.h"
20 #include "chrome/browser/ui/panels/panel.h" 21 #include "chrome/browser/ui/panels/panel.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/browser/ui/tab_contents/tab_contents_wrapper.h" 25 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
25 #include "chrome/common/chrome_notification_types.h" 26 #include "chrome/common/chrome_notification_types.h"
26 #include "chrome/common/chrome_switches.h" 27 #include "chrome/common/chrome_switches.h"
27 #include "chrome/test/base/ui_test_utils.h" 28 #include "chrome/test/base/ui_test_utils.h"
28 #include "content/browser/tab_contents/test_tab_contents.h" 29 #include "content/browser/tab_contents/test_tab_contents.h"
29 #include "testing/gtest/include/gtest/gtest.h" 30 #include "testing/gtest/include/gtest/gtest.h"
31 #include "testing/gtest_mac.h"
30 32
31 // Main test class. 33 // Main test class.
32 class PanelBrowserWindowCocoaTest : public CocoaTest { 34 class PanelBrowserWindowCocoaTest : public CocoaTest {
33 public: 35 public:
34 virtual void SetUp() { 36 virtual void SetUp() {
35 CocoaTest::SetUp(); 37 CocoaTest::SetUp();
36 CommandLine::ForCurrentProcess()->AppendSwitch(switches::kEnablePanels); 38 CommandLine::ForCurrentProcess()->AppendSwitch(switches::kEnablePanels);
37 } 39 }
38 40
39 Panel* CreateTestPanel(const std::string& panel_name) { 41 Panel* CreateTestPanel(const std::string& panel_name) {
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 characters:@"" 324 characters:@""
323 charactersIgnoringModifiers:@"" 325 charactersIgnoringModifiers:@""
324 isARepeat:NO 326 isARepeat:NO
325 keyCode:kVK_Tab]; 327 keyCode:kVK_Tab];
326 PanelBrowserWindowCocoa* native_window = 328 PanelBrowserWindowCocoa* native_window =
327 static_cast<PanelBrowserWindowCocoa*>(panel->native_panel()); 329 static_cast<PanelBrowserWindowCocoa*>(panel->native_panel());
328 [BrowserWindowUtils handleKeyboardEvent:event 330 [BrowserWindowUtils handleKeyboardEvent:event
329 inWindow:[native_window->controller_ window]]; 331 inWindow:[native_window->controller_ window]];
330 ClosePanelAndWait(panel->browser()); 332 ClosePanelAndWait(panel->browser());
331 } 333 }
334
335 // Verify that the theme provider is properly plumbed through.
336 TEST_F(PanelBrowserWindowCocoaTest, ThemeProvider) {
337 Panel* panel = CreateTestPanel("Test Panel");
338 ASSERT_TRUE(panel);
339
340 PanelBrowserWindowCocoa* native_window =
341 static_cast<PanelBrowserWindowCocoa*>(panel->native_panel());
342 ASSERT_TRUE(native_window);
343 EXPECT_TRUE(NULL != [[native_window->controller_ window] themeProvider]);
344 ClosePanelAndWait(panel->browser());
345 }
346
347 TEST_F(PanelBrowserWindowCocoaTest, SetTitle) {
348 Panel* panel = CreateTestPanel("Test Panel");
349 ASSERT_TRUE(panel);
350
351 PanelBrowserWindowCocoa* native_window =
352 static_cast<PanelBrowserWindowCocoa*>(panel->native_panel());
353 ASSERT_TRUE(native_window);
354 [native_window->controller_ updateTitleBar];
355 chrome::testing::NSRunLoopRunAllPending();
356 EXPECT_NSEQ(@"Untitled", [[native_window->controller_ window] title]);
357 ClosePanelAndWait(panel->browser());
358 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698