| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/website_settings/permission_bubble_controller.h
" | 5 #import "chrome/browser/ui/cocoa/website_settings/permission_bubble_controller.h
" |
| 6 | 6 |
| 7 #include <Carbon/Carbon.h> | 7 #include <Carbon/Carbon.h> |
| 8 | 8 |
| 9 #include "base/mac/foundation_util.h" | 9 #include "base/mac/foundation_util.h" |
| 10 #import "base/mac/scoped_objc_class_swizzler.h" | 10 #import "base/mac/scoped_objc_class_swizzler.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 + (bool)hasVisibleLocationBarForBrowser:(Browser*)browser { return false; } | 58 + (bool)hasVisibleLocationBarForBrowser:(Browser*)browser { return false; } |
| 59 @end | 59 @end |
| 60 | 60 |
| 61 namespace { | 61 namespace { |
| 62 const char* const kPermissionA = "Permission A"; | 62 const char* const kPermissionA = "Permission A"; |
| 63 const char* const kPermissionB = "Permission B"; | 63 const char* const kPermissionB = "Permission B"; |
| 64 const char* const kPermissionC = "Permission C"; | 64 const char* const kPermissionC = "Permission C"; |
| 65 } | 65 } |
| 66 | 66 |
| 67 class PermissionBubbleControllerTest : public CocoaProfileTest, | 67 class PermissionBubbleControllerTest : public CocoaProfileTest, |
| 68 public PermissionBubbleView::Delegate { | 68 public PermissionPrompt::Delegate { |
| 69 public: | 69 public: |
| 70 | 70 |
| 71 MOCK_METHOD2(ToggleAccept, void(int, bool)); | 71 MOCK_METHOD2(ToggleAccept, void(int, bool)); |
| 72 MOCK_METHOD0(SetCustomizationMode, void()); | 72 MOCK_METHOD0(SetCustomizationMode, void()); |
| 73 MOCK_METHOD0(Accept, void()); | 73 MOCK_METHOD0(Accept, void()); |
| 74 MOCK_METHOD0(Deny, void()); | 74 MOCK_METHOD0(Deny, void()); |
| 75 MOCK_METHOD0(Closing, void()); | 75 MOCK_METHOD0(Closing, void()); |
| 76 MOCK_METHOD1(SetView, void(PermissionBubbleView*)); | 76 MOCK_METHOD1(SetView, void(PermissionPrompt*)); |
| 77 | 77 |
| 78 void SetUp() override { | 78 void SetUp() override { |
| 79 CocoaProfileTest::SetUp(); | 79 CocoaProfileTest::SetUp(); |
| 80 bridge_.reset(new PermissionBubbleCocoa(browser())); | 80 bridge_.reset(new PermissionBubbleCocoa(browser())); |
| 81 AddRequest(kPermissionA); | 81 AddRequest(kPermissionA); |
| 82 controller_ = | 82 controller_ = |
| 83 [[PermissionBubbleController alloc] initWithBrowser:browser() | 83 [[PermissionBubbleController alloc] initWithBrowser:browser() |
| 84 bridge:bridge_.get()]; | 84 bridge:bridge_.get()]; |
| 85 } | 85 } |
| 86 | 86 |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 base::mac::ScopedObjCClassSwizzler locationSwizzle( | 397 base::mac::ScopedObjCClassSwizzler locationSwizzle( |
| 398 [PermissionBubbleController class], [MockBubbleNoLocationBar class], | 398 [PermissionBubbleController class], [MockBubbleNoLocationBar class], |
| 399 @selector(hasVisibleLocationBarForBrowser:)); | 399 @selector(hasVisibleLocationBarForBrowser:)); |
| 400 withoutLocationBar = [controller_ getExpectedAnchorPoint]; | 400 withoutLocationBar = [controller_ getExpectedAnchorPoint]; |
| 401 } | 401 } |
| 402 | 402 |
| 403 // The bubble should be in different places depending if the location bar is | 403 // The bubble should be in different places depending if the location bar is |
| 404 // available or not. | 404 // available or not. |
| 405 EXPECT_NSNE(withLocationBar, withoutLocationBar); | 405 EXPECT_NSNE(withLocationBar, withoutLocationBar); |
| 406 } | 406 } |
| OLD | NEW |