Commit 5da19f1b authored by Trent Apted's avatar Trent Apted Committed by Commit Bot

Disable SecondaryUiMd in some tests that only test Cocoa UI.

These test harnesses specifically test Cocoa dialogs that are not shown
when SecondaryUiMd is enabled.

Bug: 780409
Change-Id: Ibdce953bad102464bed17b998c4fcabdf64ace53
Reviewed-on: https://chromium-review.googlesource.com/748487Reviewed-by: default avatarElly Fong-Jones <ellyjones@chromium.org>
Commit-Queue: Trent Apted <tapted@chromium.org>
Cr-Commit-Position: refs/heads/master@{#513306}
parent 1940e2b9
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#import "ui/base/cocoa/touch_bar_forward_declarations.h" #import "ui/base/cocoa/touch_bar_forward_declarations.h"
#import "ui/base/cocoa/touch_bar_util.h" #import "ui/base/cocoa/touch_bar_util.h"
#include "ui/base/material_design/material_design_controller.h" #include "ui/base/material_design/material_design_controller.h"
#include "ui/base/ui_base_features.h"
using base::ASCIIToUTF16; using base::ASCIIToUTF16;
using bookmarks::BookmarkBubbleObserver; using bookmarks::BookmarkBubbleObserver;
...@@ -84,6 +85,14 @@ class BookmarkBubbleControllerTest : public CocoaProfileTest { ...@@ -84,6 +85,14 @@ class BookmarkBubbleControllerTest : public CocoaProfileTest {
edits_ = 0; edits_ = 0;
} }
// CocoaProfileTest:
void SetUp() override {
CocoaProfileTest::SetUp();
// This file only tests Cocoa UI and can be deleted when kSecondaryUiMd is
// default.
scoped_feature_list_.InitAndDisableFeature(features::kSecondaryUiMd);
}
void TearDown() override { void TearDown() override {
[controller_ close]; [controller_ close];
CocoaProfileTest::TearDown(); CocoaProfileTest::TearDown();
...@@ -130,6 +139,11 @@ class BookmarkBubbleControllerTest : public CocoaProfileTest { ...@@ -130,6 +139,11 @@ class BookmarkBubbleControllerTest : public CocoaProfileTest {
bool IsWindowClosing() { bool IsWindowClosing() {
return [static_cast<InfoBubbleWindow*>([controller_ window]) isClosing]; return [static_cast<InfoBubbleWindow*>([controller_ window]) isClosing];
} }
private:
base::test::ScopedFeatureList scoped_feature_list_;
DISALLOW_COPY_AND_ASSIGN(BookmarkBubbleControllerTest);
}; };
// static // static
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
#include "base/macros.h" #include "base/macros.h"
#include "base/test/scoped_feature_list.h"
#include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/browser_window.h"
#import "chrome/browser/ui/cocoa/browser_window_controller.h" #import "chrome/browser/ui/cocoa/browser_window_controller.h"
#import "chrome/browser/ui/cocoa/extensions/browser_action_button.h" #import "chrome/browser/ui/cocoa/extensions/browser_action_button.h"
...@@ -13,6 +14,7 @@ ...@@ -13,6 +14,7 @@
#include "chrome/browser/ui/extensions/extension_message_bubble_browsertest.h" #include "chrome/browser/ui/extensions/extension_message_bubble_browsertest.h"
#include "chrome/browser/ui/extensions/settings_api_bubble_helpers.h" #include "chrome/browser/ui/extensions/settings_api_bubble_helpers.h"
#include "ui/base/cocoa/cocoa_base_utils.h" #include "ui/base/cocoa/cocoa_base_utils.h"
#include "ui/base/ui_base_features.h"
#include "ui/events/test/cocoa_test_event_utils.h" #include "ui/events/test/cocoa_test_event_utils.h"
namespace { namespace {
...@@ -89,9 +91,14 @@ class ExtensionMessageBubbleBrowserTestMac ...@@ -89,9 +91,14 @@ class ExtensionMessageBubbleBrowserTestMac
: public ExtensionMessageBubbleBrowserTest { : public ExtensionMessageBubbleBrowserTest {
public: public:
ExtensionMessageBubbleBrowserTestMac() {} ExtensionMessageBubbleBrowserTestMac() {}
~ExtensionMessageBubbleBrowserTestMac() override {}
// ExtensionMessageBubbleBrowserTest: // ExtensionMessageBubbleBrowserTest:
void SetUp() override {
ExtensionMessageBubbleBrowserTest::SetUp();
// This file only tests Cocoa UI and can be deleted when kSecondaryUiMd is
// default.
scoped_feature_list_.InitAndDisableFeature(features::kSecondaryUiMd);
}
void SetUpCommandLine(base::CommandLine* command_line) override; void SetUpCommandLine(base::CommandLine* command_line) override;
private: private:
...@@ -103,6 +110,8 @@ class ExtensionMessageBubbleBrowserTestMac ...@@ -103,6 +110,8 @@ class ExtensionMessageBubbleBrowserTestMac
void ClickActionButton(Browser* browser) override; void ClickActionButton(Browser* browser) override;
void ClickDismissButton(Browser* browser) override; void ClickDismissButton(Browser* browser) override;
base::test::ScopedFeatureList scoped_feature_list_;
DISALLOW_COPY_AND_ASSIGN(ExtensionMessageBubbleBrowserTestMac); DISALLOW_COPY_AND_ASSIGN(ExtensionMessageBubbleBrowserTestMac);
}; };
......
...@@ -5,10 +5,12 @@ ...@@ -5,10 +5,12 @@
#import "chrome/browser/ui/cocoa/page_info/permission_selector_button.h" #import "chrome/browser/ui/cocoa/page_info/permission_selector_button.h"
#include "base/mac/scoped_nsobject.h" #include "base/mac/scoped_nsobject.h"
#include "base/test/scoped_feature_list.h"
#import "chrome/browser/ui/cocoa/test/cocoa_test_helper.h" #import "chrome/browser/ui/cocoa/test/cocoa_test_helper.h"
#include "chrome/browser/ui/page_info/page_info_ui.h" #include "chrome/browser/ui/page_info/page_info_ui.h"
#include "chrome/test/base/testing_profile.h" #include "chrome/test/base/testing_profile.h"
#include "content/public/test/test_browser_thread_bundle.h" #include "content/public/test/test_browser_thread_bundle.h"
#include "ui/base/ui_base_features.h"
@interface PermissionSelectorButton (Testing) @interface PermissionSelectorButton (Testing)
- (NSMenu*)permissionMenu; - (NSMenu*)permissionMenu;
...@@ -39,6 +41,14 @@ class PermissionSelectorButtonTest : public CocoaTest { ...@@ -39,6 +41,14 @@ class PermissionSelectorButtonTest : public CocoaTest {
[[test_window() contentView] addSubview:view_]; [[test_window() contentView] addSubview:view_];
} }
// CocoaTest:
void SetUp() override {
CocoaTest::SetUp();
// This file only tests Cocoa UI and can be deleted when kSecondaryUiMd is
// default.
scoped_feature_list_.InitAndDisableFeature(features::kSecondaryUiMd);
}
void Callback(const PageInfoUI::PermissionInfo& permission) { void Callback(const PageInfoUI::PermissionInfo& permission) {
EXPECT_TRUE(permission.type == kTestPermissionType); EXPECT_TRUE(permission.type == kTestPermissionType);
got_callback_ = true; got_callback_ = true;
...@@ -49,6 +59,11 @@ class PermissionSelectorButtonTest : public CocoaTest { ...@@ -49,6 +59,11 @@ class PermissionSelectorButtonTest : public CocoaTest {
bool got_callback_; bool got_callback_;
base::scoped_nsobject<PermissionSelectorButton> view_; base::scoped_nsobject<PermissionSelectorButton> view_;
private:
base::test::ScopedFeatureList scoped_feature_list_;
DISALLOW_COPY_AND_ASSIGN(PermissionSelectorButtonTest);
}; };
TEST_VIEW(PermissionSelectorButtonTest, view_); TEST_VIEW(PermissionSelectorButtonTest, view_);
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include "base/mac/foundation_util.h" #include "base/mac/foundation_util.h"
#include "base/mac/scoped_objc_class_swizzler.h" #include "base/mac/scoped_objc_class_swizzler.h"
#include "base/test/scoped_feature_list.h"
#include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/browser_window.h"
#import "chrome/browser/ui/cocoa/browser_window_controller.h" #import "chrome/browser/ui/cocoa/browser_window_controller.h"
...@@ -17,6 +18,7 @@ ...@@ -17,6 +18,7 @@
#include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "content/public/test/test_utils.h" #include "content/public/test/test_utils.h"
#include "testing/gtest_mac.h" #include "testing/gtest_mac.h"
#include "ui/base/ui_base_features.h"
// A helper class to swizzle [NSWindow isKeyWindow] to always return true. // A helper class to swizzle [NSWindow isKeyWindow] to always return true.
@interface AlwaysKeyNSWindow : NSWindow @interface AlwaysKeyNSWindow : NSWindow
...@@ -32,8 +34,13 @@ ...@@ -32,8 +34,13 @@
// Integration tests for the Mac password bubble. // Integration tests for the Mac password bubble.
class ManagePasswordsBubbleTest : public ManagePasswordsTest { class ManagePasswordsBubbleTest : public ManagePasswordsTest {
public: public:
ManagePasswordsBubbleTest() {}
void SetUpOnMainThread() override { void SetUpOnMainThread() override {
ManagePasswordsTest::SetUpOnMainThread(); ManagePasswordsTest::SetUpOnMainThread();
// This file only tests Cocoa UI and can be deleted when kSecondaryUiMd is
// default.
scoped_feature_list_.InitAndDisableFeature(features::kSecondaryUiMd);
browser()->window()->Show(); browser()->window()->Show();
} }
...@@ -69,6 +76,11 @@ class ManagePasswordsBubbleTest : public ManagePasswordsTest { ...@@ -69,6 +76,11 @@ class ManagePasswordsBubbleTest : public ManagePasswordsTest {
} }
ManagePasswordsIconCocoa* GetView() { return decoration()->icon(); } ManagePasswordsIconCocoa* GetView() { return decoration()->icon(); }
private:
base::test::ScopedFeatureList scoped_feature_list_;
DISALLOW_COPY_AND_ASSIGN(ManagePasswordsBubbleTest);
}; };
IN_PROC_BROWSER_TEST_F(ManagePasswordsBubbleTest, IN_PROC_BROWSER_TEST_F(ManagePasswordsBubbleTest,
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
#include "base/mac/foundation_util.h" #include "base/mac/foundation_util.h"
#include "base/test/scoped_feature_list.h"
#include "chrome/browser/password_manager/password_store_factory.h" #include "chrome/browser/password_manager/password_store_factory.h"
#include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_command_controller.h" #include "chrome/browser/ui/browser_command_controller.h"
...@@ -30,15 +31,23 @@ ...@@ -30,15 +31,23 @@
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "testing/gtest_mac.h" #include "testing/gtest_mac.h"
#include "testing/platform_test.h" #include "testing/platform_test.h"
#include "ui/base/ui_base_features.h"
using testing::Return; using testing::Return;
using testing::ReturnRef; using testing::ReturnRef;
class ManagePasswordsBubbleCocoaTest : public CocoaProfileTest { class ManagePasswordsBubbleCocoaTest : public CocoaProfileTest {
public: public:
ManagePasswordsBubbleCocoaTest() {}
// CocoaProfileTest:
void SetUp() override { void SetUp() override {
CocoaProfileTest::SetUp(); CocoaProfileTest::SetUp();
// This file only tests Cocoa UI and can be deleted when kSecondaryUiMd is
// default.
scoped_feature_list_.InitAndDisableFeature(features::kSecondaryUiMd);
// Create the WebContents. // Create the WebContents.
siteInstance_ = content::SiteInstance::Create(profile()); siteInstance_ = content::SiteInstance::Create(profile());
test_web_contents_ = CreateWebContents(); test_web_contents_ = CreateWebContents();
...@@ -109,8 +118,11 @@ class ManagePasswordsBubbleCocoaTest : public CocoaProfileTest { ...@@ -109,8 +118,11 @@ class ManagePasswordsBubbleCocoaTest : public CocoaProfileTest {
} }
private: private:
base::test::ScopedFeatureList scoped_feature_list_;
scoped_refptr<content::SiteInstance> siteInstance_; scoped_refptr<content::SiteInstance> siteInstance_;
content::WebContents* test_web_contents_; // weak content::WebContents* test_web_contents_; // weak
DISALLOW_COPY_AND_ASSIGN(ManagePasswordsBubbleCocoaTest);
}; };
TEST_F(ManagePasswordsBubbleCocoaTest, ShowShouldCreateAndShowBubble) { TEST_F(ManagePasswordsBubbleCocoaTest, ShowShouldCreateAndShowBubble) {
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include "base/message_loop/message_loop.h" #include "base/message_loop/message_loop.h"
#include "base/test/histogram_tester.h" #include "base/test/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#import "chrome/browser/ui/browser.h" #import "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/browser_window.h"
#import "chrome/browser/ui/cocoa/browser_window_controller.h" #import "chrome/browser/ui/cocoa/browser_window_controller.h"
...@@ -15,6 +16,7 @@ ...@@ -15,6 +16,7 @@
#include "chrome/browser/ui/translate/translate_bubble_model.h" #include "chrome/browser/ui/translate/translate_bubble_model.h"
#include "chrome/common/url_constants.h" #include "chrome/common/url_constants.h"
#include "content/public/browser/site_instance.h" #include "content/public/browser/site_instance.h"
#include "ui/base/ui_base_features.h"
@implementation BrowserWindowController (ForTesting) @implementation BrowserWindowController (ForTesting)
...@@ -38,8 +40,16 @@ ...@@ -38,8 +40,16 @@
class TranslateBubbleControllerTest : public CocoaProfileTest { class TranslateBubbleControllerTest : public CocoaProfileTest {
public: public:
TranslateBubbleControllerTest() {}
// CocoaProfileTest:
void SetUp() override { void SetUp() override {
CocoaProfileTest::SetUp(); CocoaProfileTest::SetUp();
// This file only tests Cocoa UI and can be deleted when kSecondaryUiMd is
// default.
scoped_feature_list_.InitAndDisableFeature(features::kSecondaryUiMd);
site_instance_ = content::SiteInstance::Create(profile()); site_instance_ = content::SiteInstance::Create(profile());
NSWindow* nativeWindow = browser()->window()->GetNativeWindow(); NSWindow* nativeWindow = browser()->window()->GetNativeWindow();
...@@ -89,9 +99,12 @@ class TranslateBubbleControllerTest : public CocoaProfileTest { ...@@ -89,9 +99,12 @@ class TranslateBubbleControllerTest : public CocoaProfileTest {
} }
private: private:
base::test::ScopedFeatureList scoped_feature_list_;
scoped_refptr<content::SiteInstance> site_instance_; scoped_refptr<content::SiteInstance> site_instance_;
BrowserWindowController* bwc_; BrowserWindowController* bwc_;
content::WebContents* web_contents_; content::WebContents* web_contents_;
DISALLOW_COPY_AND_ASSIGN(TranslateBubbleControllerTest);
}; };
TEST_F(TranslateBubbleControllerTest, ShowAndClose) { TEST_F(TranslateBubbleControllerTest, ShowAndClose) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment