Commit 23e1f466 authored by Elly Fong-Jones's avatar Elly Fong-Jones Committed by Commit Bot

polychrome: fix some AutofillPopupView tests

This change:
1) Removes a conflicting definition of AutofillPopupView::Create by providing a
   polychrome shim;
2) Marks AutofillPopupBaseViewTest as Views-only because it seems tightly bound
   to BrowserView.

Bug: 817408
Change-Id: Icf164106f427dc9ee99f11234c9f3ca876ffe3df
Reviewed-on: https://chromium-review.googlesource.com/962999Reviewed-by: default avatarRobert Liao <robliao@chromium.org>
Commit-Queue: Elly Fong-Jones <ellyjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#543164}
parent e2add009
......@@ -9,6 +9,7 @@
#include "base/optional.h"
#include "base/strings/string16.h"
#include "build/build_config.h"
#include "chrome/browser/ui/autofill/autofill_popup_view_delegate.h"
namespace autofill {
......@@ -36,6 +37,10 @@ class AutofillPopupView {
// Factory function for creating the view.
static AutofillPopupView* Create(AutofillPopupController* controller);
#if defined(OS_MACOSX)
static AutofillPopupView* CreateCocoa(AutofillPopupController* controller);
#endif
protected:
virtual ~AutofillPopupView() {}
};
......
......@@ -7,10 +7,12 @@
#include "chrome/browser/ui/cocoa/autofill/autofill_popup_view_bridge.h"
#include "base/logging.h"
#include "build/buildflag.h"
#include "chrome/browser/ui/autofill/autofill_popup_controller.h"
#include "chrome/browser/ui/autofill/autofill_popup_layout_model.h"
#include "chrome/browser/ui/autofill/autofill_popup_view_delegate.h"
#import "chrome/browser/ui/cocoa/autofill/autofill_popup_view_cocoa.h"
#include "ui/base/ui_features.h"
#include "ui/gfx/geometry/rect.h"
namespace autofill {
......@@ -61,9 +63,16 @@ void AutofillPopupViewBridge::OnSuggestionsChanged() {
[view_ updateBoundsAndRedrawPopup];
}
AutofillPopupView* AutofillPopupView::Create(
AutofillPopupView* AutofillPopupView::CreateCocoa(
AutofillPopupController* controller) {
return new AutofillPopupViewBridge(controller);
}
#if !BUILDFLAG(MAC_VIEWS_BROWSER)
AutofillPopupView* AutofillPopupView::Create(
AutofillPopupController* controller) {
return CreateCocoa(controller);
}
#endif
} // namespace autofill
......@@ -10,6 +10,7 @@
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/views/scoped_macviews_browser_mode.h"
#include "components/autofill/core/browser/suggestion.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
......@@ -80,6 +81,7 @@ class AutofillPopupBaseViewTest : public InProcessBrowserTest {
}
protected:
test::ScopedMacViewsBrowserMode views_mode_{true};
testing::NiceMock<MockAutofillPopupViewDelegate> mock_delegate_;
AutofillPopupBaseView* view_;
};
......
......@@ -6,15 +6,18 @@
#include "base/feature_list.h"
#include "base/optional.h"
#include "build/buildflag.h"
#include "chrome/browser/ui/autofill/autofill_popup_controller.h"
#include "chrome/browser/ui/autofill/autofill_popup_layout_model.h"
#include "chrome/browser/ui/views/autofill/autofill_popup_view_native_views.h"
#include "chrome/browser/ui/views_mode_controller.h"
#include "chrome/grit/generated_resources.h"
#include "components/autofill/core/browser/autofill_experiments.h"
#include "components/autofill/core/browser/popup_item_ids.h"
#include "components/autofill/core/browser/suggestion.h"
#include "ui/accessibility/ax_node_data.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/ui_features.h"
#include "ui/events/keycodes/keyboard_codes.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/geometry/point.h"
......@@ -314,6 +317,10 @@ void AutofillPopupViewViews::CreateChildViews() {
AutofillPopupView* AutofillPopupView::Create(
AutofillPopupController* controller) {
#if BUILDFLAG(MAC_VIEWS_BROWSER)
if (views_mode_controller::IsViewsBrowserCocoa())
return CreateCocoa(controller);
#endif
views::Widget* observing_widget =
views::Widget::GetTopLevelWidgetForNativeView(
controller->container_view());
......
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