OLD | NEW |
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 #include "base/memory/scoped_nsobject.h" | 5 #include "base/memory/scoped_nsobject.h" |
6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
8 #include "chrome/browser/bookmarks/bookmark_utils.h" | 8 #include "chrome/browser/bookmarks/bookmark_utils.h" |
9 #include "chrome/browser/ui/cocoa/browser_test_helper.h" | 9 #include "chrome/browser/ui/cocoa/browser_test_helper.h" |
10 #include "chrome/browser/ui/cocoa/browser_window_cocoa.h" | 10 #include "chrome/browser/ui/cocoa/browser_window_cocoa.h" |
11 #include "chrome/browser/ui/cocoa/browser_window_controller.h" | 11 #include "chrome/browser/ui/cocoa/browser_window_controller.h" |
12 #include "chrome/browser/ui/cocoa/cocoa_test_helper.h" | 12 #include "chrome/browser/ui/cocoa/cocoa_test_helper.h" |
13 #include "content/common/notification_type.h" | 13 #include "chrome/common/chrome_notification_types.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
15 | 15 |
16 // A BrowserWindowCocoa that goes PONG when | 16 // A BrowserWindowCocoa that goes PONG when |
17 // BOOKMARK_BAR_VISIBILITY_PREF_CHANGED is sent. This is so we can be | 17 // BOOKMARK_BAR_VISIBILITY_PREF_CHANGED is sent. This is so we can be |
18 // sure we are observing it. | 18 // sure we are observing it. |
19 class BrowserWindowCocoaPong : public BrowserWindowCocoa { | 19 class BrowserWindowCocoaPong : public BrowserWindowCocoa { |
20 public: | 20 public: |
21 BrowserWindowCocoaPong(Browser* browser, | 21 BrowserWindowCocoaPong(Browser* browser, |
22 BrowserWindowController* controller) : | 22 BrowserWindowController* controller) : |
23 BrowserWindowCocoa(browser, controller, [controller window]) { | 23 BrowserWindowCocoa(browser, controller, [controller window]) { |
24 pong_ = false; | 24 pong_ = false; |
25 } | 25 } |
26 virtual ~BrowserWindowCocoaPong() { } | 26 virtual ~BrowserWindowCocoaPong() { } |
27 | 27 |
28 void Observe(NotificationType type, | 28 void Observe(int type, |
29 const NotificationSource& source, | 29 const NotificationSource& source, |
30 const NotificationDetails& details) { | 30 const NotificationDetails& details) { |
31 if (type.value == NotificationType::BOOKMARK_BAR_VISIBILITY_PREF_CHANGED) | 31 if (type == chrome::NOTIFICATION_BOOKMARK_BAR_VISIBILITY_PREF_CHANGED) |
32 pong_ = true; | 32 pong_ = true; |
33 BrowserWindowCocoa::Observe(type, source, details); | 33 BrowserWindowCocoa::Observe(type, source, details); |
34 } | 34 } |
35 | 35 |
36 bool pong_; | 36 bool pong_; |
37 }; | 37 }; |
38 | 38 |
39 // Main test class. | 39 // Main test class. |
40 class BrowserWindowCocoaTest : public CocoaTest { | 40 class BrowserWindowCocoaTest : public CocoaTest { |
41 virtual void SetUp() { | 41 virtual void SetUp() { |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 | 111 |
112 EXPECT_FALSE(bwc->IsFullscreen()); | 112 EXPECT_FALSE(bwc->IsFullscreen()); |
113 bwc->SetFullscreen(true); | 113 bwc->SetFullscreen(true); |
114 EXPECT_TRUE(bwc->IsFullscreen()); | 114 EXPECT_TRUE(bwc->IsFullscreen()); |
115 bwc->SetFullscreen(false); | 115 bwc->SetFullscreen(false); |
116 EXPECT_FALSE(bwc->IsFullscreen()); | 116 EXPECT_FALSE(bwc->IsFullscreen()); |
117 [fake_controller close]; | 117 [fake_controller close]; |
118 } | 118 } |
119 | 119 |
120 // TODO(???): test other methods of BrowserWindowCocoa | 120 // TODO(???): test other methods of BrowserWindowCocoa |
OLD | NEW |