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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 bridge_.reset(new PermissionBubbleCocoa(browser())); | 81 bridge_.reset(new PermissionBubbleCocoa(browser())); |
82 AddRequest(kPermissionA); | 82 AddRequest(kPermissionA); |
83 controller_ = | 83 controller_ = |
84 [[PermissionBubbleController alloc] initWithBrowser:browser() | 84 [[PermissionBubbleController alloc] initWithBrowser:browser() |
85 bridge:bridge_.get()]; | 85 bridge:bridge_.get()]; |
86 } | 86 } |
87 | 87 |
88 void TearDown() override { | 88 void TearDown() override { |
89 [controller_ close]; | 89 [controller_ close]; |
90 chrome::testing::NSRunLoopRunAllPending(); | 90 chrome::testing::NSRunLoopRunAllPending(); |
91 STLDeleteElements(&requests_); | 91 base::STLDeleteElements(&requests_); |
92 CocoaProfileTest::TearDown(); | 92 CocoaProfileTest::TearDown(); |
93 } | 93 } |
94 | 94 |
95 void AddRequest(const std::string& title) { | 95 void AddRequest(const std::string& title) { |
96 MockPermissionRequest* request = new MockPermissionRequest( | 96 MockPermissionRequest* request = new MockPermissionRequest( |
97 title, | 97 title, |
98 l10n_util::GetStringUTF8(IDS_PERMISSION_ALLOW), | 98 l10n_util::GetStringUTF8(IDS_PERMISSION_ALLOW), |
99 l10n_util::GetStringUTF8(IDS_PERMISSION_DENY)); | 99 l10n_util::GetStringUTF8(IDS_PERMISSION_DENY)); |
100 requests_.push_back(request); | 100 requests_.push_back(request); |
101 } | 101 } |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 base::mac::ScopedObjCClassSwizzler locationSwizzle( | 400 base::mac::ScopedObjCClassSwizzler locationSwizzle( |
401 [PermissionBubbleController class], [MockBubbleNoLocationBar class], | 401 [PermissionBubbleController class], [MockBubbleNoLocationBar class], |
402 @selector(hasVisibleLocationBarForBrowser:)); | 402 @selector(hasVisibleLocationBarForBrowser:)); |
403 withoutLocationBar = [controller_ getExpectedAnchorPoint]; | 403 withoutLocationBar = [controller_ getExpectedAnchorPoint]; |
404 } | 404 } |
405 | 405 |
406 // The bubble should be in different places depending if the location bar is | 406 // The bubble should be in different places depending if the location bar is |
407 // available or not. | 407 // available or not. |
408 EXPECT_NSNE(withLocationBar, withoutLocationBar); | 408 EXPECT_NSNE(withLocationBar, withoutLocationBar); |
409 } | 409 } |
OLD | NEW |