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

Unified Diff: chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa_browsertest.mm

Issue 2921083003: [Mac] Touch Bar Support for Dialogs (Closed)
Patch Set: Added test and renamed methods Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa_browsertest.mm
diff --git a/chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa_browsertest.mm b/chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa_browsertest.mm
index 806c4002a936f847cda1e27df8726628c0b8241d..336f19095e6466737f796d65a2a7b77d58436b97 100644
--- a/chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa_browsertest.mm
+++ b/chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa_browsertest.mm
@@ -7,9 +7,11 @@
#import <Cocoa/Cocoa.h>
#include "base/mac/foundation_util.h"
+#include "base/mac/mac_util.h"
#include "base/mac/scoped_nsautorelease_pool.h"
#include "base/mac/scoped_nsobject.h"
#include "base/strings/sys_string_conversions.h"
+#include "base/test/scoped_feature_list.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/content_settings/tab_specific_content_settings.h"
#include "chrome/browser/download/download_request_limiter.h"
@@ -20,13 +22,26 @@
#include "chrome/browser/ui/content_settings/content_setting_bubble_model.h"
#include "chrome/browser/ui/content_settings/content_setting_image_model.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
+#include "chrome/common/chrome_features.h"
#include "chrome/grit/generated_resources.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "components/strings/grit/components_strings.h"
#include "content/public/common/media_stream_request.h"
#include "testing/gtest_mac.h"
+#include "ui/base/cocoa/touch_bar_util.h"
#include "ui/base/l10n/l10n_util.h"
+namespace {
+
+// Touch bar identifier.
+NSString* const kContentSettingsBubbleTouchBarId = @"content-settings-bubble";
+
+// Touch bar item identifiers.
+NSString* const kManageTouchBarId = @"MANAGE";
+NSString* const kDoneTouchBarId = @"DONE";
+
+} // namespace
+
class ContentSettingBubbleControllerTest : public InProcessBrowserTest {
protected:
ContentSettingBubbleControllerTest() {}
@@ -184,3 +199,32 @@ IN_PROC_BROWSER_TEST_F(ContentSettingBubbleControllerTest,
[parent_ close];
}
+
+// Verifies the bubble's touch bar.
+IN_PROC_BROWSER_TEST_F(ContentSettingBubbleControllerTest, TouchBar) {
+ if (!base::mac::IsAtLeastOS10_12()) {
+ [parent_ close];
+ return;
+ }
+
+ base::test::ScopedFeatureList feature_list;
+ feature_list.InitAndEnableFeature(features::kBrowserTouchBar);
+
+ TabSpecificContentSettings::FromWebContents(web_contents())
+ ->BlockAllContentForTesting();
+ ContentSettingBubbleController* controller =
+ CreateBubbleController(new ContentSettingMediaStreamBubbleModel(
+ nullptr, web_contents(), profile()));
+ EXPECT_TRUE(controller);
+
+ NSTouchBar* touch_bar = [controller makeTouchBar];
+ NSArray* touch_bar_items = [touch_bar itemIdentifiers];
+ EXPECT_TRUE([touch_bar_items
+ containsObject:ui::GetTouchBarItemId(kContentSettingsBubbleTouchBarId,
+ kDoneTouchBarId)]);
+ EXPECT_TRUE([touch_bar_items
+ containsObject:ui::GetTouchBarItemId(kContentSettingsBubbleTouchBarId,
+ kManageTouchBarId)]);
+
+ [parent_ close];
+}

Powered by Google App Engine
This is Rietveld 408576698