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

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 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/debugger.h" 10 #include "base/debug/debugger.h"
11 #include "base/mac/scoped_nsautorelease_pool.h" 11 #include "base/mac/scoped_nsautorelease_pool.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "chrome/app/chrome_command_ids.h" // IDC_* 13 #include "chrome/app/chrome_command_ids.h" // IDC_*
14 #include "chrome/browser/ui/browser.h" 14 #include "chrome/browser/ui/browser.h"
15 #include "chrome/browser/ui/browser_list.h" 15 #include "chrome/browser/ui/browser_list.h"
16 #import "chrome/browser/ui/cocoa/browser_test_helper.h" 16 #import "chrome/browser/ui/cocoa/browser_test_helper.h"
17 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" 17 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h"
18 #import "chrome/browser/ui/cocoa/run_loop_testing.h"
18 #include "chrome/browser/ui/panels/panel.h" 19 #include "chrome/browser/ui/panels/panel.h"
19 #include "chrome/browser/ui/panels/panel_manager.h" 20 #include "chrome/browser/ui/panels/panel_manager.h"
20 #import "chrome/browser/ui/panels/panel_titlebar_view_cocoa.h" 21 #import "chrome/browser/ui/panels/panel_titlebar_view_cocoa.h"
21 #import "chrome/browser/ui/panels/panel_window_controller_cocoa.h" 22 #import "chrome/browser/ui/panels/panel_window_controller_cocoa.h"
22 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 23 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
23 #include "chrome/common/chrome_notification_types.h" 24 #include "chrome/common/chrome_notification_types.h"
24 #include "chrome/common/chrome_switches.h" 25 #include "chrome/common/chrome_switches.h"
25 #include "chrome/test/base/ui_test_utils.h" 26 #include "chrome/test/base/ui_test_utils.h"
26 #include "content/browser/tab_contents/test_tab_contents.h" 27 #include "content/browser/tab_contents/test_tab_contents.h"
27 #include "testing/gtest/include/gtest/gtest.h" 28 #include "testing/gtest/include/gtest/gtest.h"
29 #include "testing/gtest_mac.h"
28 30
29 // Main test class. 31 // Main test class.
30 class PanelBrowserWindowCocoaTest : public CocoaTest { 32 class PanelBrowserWindowCocoaTest : public CocoaTest {
31 public: 33 public:
32 virtual void SetUp() { 34 virtual void SetUp() {
33 CocoaTest::SetUp(); 35 CocoaTest::SetUp();
34 CommandLine::ForCurrentProcess()->AppendSwitch(switches::kEnablePanels); 36 CommandLine::ForCurrentProcess()->AppendSwitch(switches::kEnablePanels);
35 } 37 }
36 38
37 Panel* CreateTestPanel(const std::string& panel_name) { 39 Panel* CreateTestPanel(const std::string& panel_name) {
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 EXPECT_TRUE([close_window_menu_item isEnabled]); 303 EXPECT_TRUE([close_window_menu_item isEnabled]);
302 EXPECT_TRUE([find_menu_item isEnabled]); 304 EXPECT_TRUE([find_menu_item isEnabled]);
303 EXPECT_TRUE([find_previous_menu_item isEnabled]); 305 EXPECT_TRUE([find_previous_menu_item isEnabled]);
304 EXPECT_TRUE([find_next_menu_item isEnabled]); 306 EXPECT_TRUE([find_next_menu_item isEnabled]);
305 EXPECT_FALSE([fullscreen_menu_item isEnabled]); 307 EXPECT_FALSE([fullscreen_menu_item isEnabled]);
306 EXPECT_FALSE([presentation_menu_item isEnabled]); 308 EXPECT_FALSE([presentation_menu_item isEnabled]);
307 EXPECT_FALSE([bookmarks_menu_item isEnabled]); 309 EXPECT_FALSE([bookmarks_menu_item isEnabled]);
308 310
309 ClosePanelAndWait(panel->browser()); 311 ClosePanelAndWait(panel->browser());
310 } 312 }
313
314 // Verify that the theme provider is properly plumbed through.
315 TEST_F(PanelBrowserWindowCocoaTest, ThemeProvider) {
316 Panel* panel = CreateTestPanel("Test Panel");
317 ASSERT_TRUE(panel);
318
319 PanelBrowserWindowCocoa* native_window =
320 static_cast<PanelBrowserWindowCocoa*>(panel->native_panel());
321 ASSERT_TRUE(native_window);
322 EXPECT_TRUE(NULL != [[native_window->controller_ window] themeProvider]);
323 ClosePanelAndWait(panel->browser());
324 }
325
326 TEST_F(PanelBrowserWindowCocoaTest, SetTitle) {
327 Panel* panel = CreateTestPanel("Test Panel");
328 ASSERT_TRUE(panel);
329
330 PanelBrowserWindowCocoa* native_window =
331 static_cast<PanelBrowserWindowCocoa*>(panel->native_panel());
332 ASSERT_TRUE(native_window);
333 [native_window->controller_ updateTitleBar];
334 chrome::testing::NSRunLoopRunAllPending();
335 EXPECT_NSEQ(@"Untitled", [[native_window->controller_ window] title]);
Dmitry Titov 2011/09/01 01:44:13 It would be nice to check for previous value (whic
336 ClosePanelAndWait(panel->browser());
337 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/panels/panel_browser_window_cocoa.mm ('k') | chrome/browser/ui/panels/panel_titlebar_view_cocoa.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698