| 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 #import "chrome/browser/ui/cocoa/browser_window_cocoa.h" | 5 #import "chrome/browser/ui/cocoa/browser_window_cocoa.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/mac/mac_util.h" |
| 9 #include "base/mac/scoped_nsobject.h" | 10 #include "base/mac/scoped_nsobject.h" |
| 10 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
| 11 #include "chrome/browser/chrome_notification_types.h" | 12 #include "chrome/browser/chrome_notification_types.h" |
| 12 #include "chrome/browser/ui/bookmarks/bookmark_utils.h" | 13 #include "chrome/browser/ui/bookmarks/bookmark_utils.h" |
| 13 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 14 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
| 14 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" | 15 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" |
| 15 #include "chrome/test/base/testing_profile.h" | 16 #include "chrome/test/base/testing_profile.h" |
| 16 #include "content/public/browser/notification_details.h" | 17 #include "content/public/browser/notification_details.h" |
| 17 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
| 18 #import "third_party/ocmock/OCMock/OCMock.h" | 19 #import "third_party/ocmock/OCMock/OCMock.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 bwc->UpdateAlertState(TabAlertState::NONE); | 68 bwc->UpdateAlertState(TabAlertState::NONE); |
| 68 EXPECT_EQ(static_cast<NSUInteger>(NSNotFound), | 69 EXPECT_EQ(static_cast<NSUInteger>(NSNotFound), |
| 69 [bwc->WindowTitle() rangeOfString:playing_emoji].location); | 70 [bwc->WindowTitle() rangeOfString:playing_emoji].location); |
| 70 EXPECT_EQ(static_cast<NSUInteger>(NSNotFound), | 71 EXPECT_EQ(static_cast<NSUInteger>(NSNotFound), |
| 71 [bwc->WindowTitle() rangeOfString:muting_emoji].location); | 72 [bwc->WindowTitle() rangeOfString:muting_emoji].location); |
| 72 } | 73 } |
| 73 | 74 |
| 74 // Test that IsMaximized() returns false when the browser window goes from | 75 // Test that IsMaximized() returns false when the browser window goes from |
| 75 // maximized to minimized state - http://crbug/452976. | 76 // maximized to minimized state - http://crbug/452976. |
| 76 TEST_F(BrowserWindowCocoaTest, TestMinimizeState) { | 77 TEST_F(BrowserWindowCocoaTest, TestMinimizeState) { |
| 78 if (base::mac::IsOS10_10()) |
| 79 return; // Fails when swarmed. http://crbug.com/660582 |
| 77 std::unique_ptr<BrowserWindowCocoa> bwc( | 80 std::unique_ptr<BrowserWindowCocoa> bwc( |
| 78 new BrowserWindowCocoa(browser(), controller_)); | 81 new BrowserWindowCocoa(browser(), controller_)); |
| 79 | 82 |
| 80 EXPECT_FALSE(bwc->IsMinimized()); | 83 EXPECT_FALSE(bwc->IsMinimized()); |
| 81 bwc->Maximize(); | 84 bwc->Maximize(); |
| 82 EXPECT_TRUE(bwc->IsMaximized()); | 85 EXPECT_TRUE(bwc->IsMaximized()); |
| 83 EXPECT_FALSE(bwc->IsMinimized()); | 86 EXPECT_FALSE(bwc->IsMinimized()); |
| 84 bwc->Minimize(); | 87 bwc->Minimize(); |
| 85 EXPECT_FALSE(bwc->IsMaximized()); | 88 EXPECT_FALSE(bwc->IsMaximized()); |
| 86 EXPECT_TRUE(bwc->IsMinimized()); | 89 EXPECT_TRUE(bwc->IsMinimized()); |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 [[[window_ stub] andReturn:nil] delegate]; | 204 [[[window_ stub] andReturn:nil] delegate]; |
| 202 [[[controller_ stub] andReturn:window_] window]; | 205 [[[controller_ stub] andReturn:window_] window]; |
| 203 [[window_ expect] orderOut:nil]; | 206 [[window_ expect] orderOut:nil]; |
| 204 [[window_ expect] close]; | 207 [[window_ expect] close]; |
| 205 CreateAndCloseBrowserWindow(); | 208 CreateAndCloseBrowserWindow(); |
| 206 EXPECT_OCMOCK_VERIFY(controller_); | 209 EXPECT_OCMOCK_VERIFY(controller_); |
| 207 EXPECT_OCMOCK_VERIFY(window_); | 210 EXPECT_OCMOCK_VERIFY(window_); |
| 208 } | 211 } |
| 209 | 212 |
| 210 // TODO(???): test other methods of BrowserWindowCocoa | 213 // TODO(???): test other methods of BrowserWindowCocoa |
| OLD | NEW |