Skip to content

Commit 008196f

Browse files
committed
Fix browser test for new icon and clang-format
1 parent f097016 commit 008196f

File tree

3 files changed

+18
-20
lines changed

3 files changed

+18
-20
lines changed

browser/tor/onion_location_navigation_throttle_browsertest.cc

+4-4
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,10 @@ class OnionLocationNavigationThrottleBrowserTest : public InProcessBrowserTest {
6666
BraveLocationBarView* brave_location_bar_view =
6767
static_cast<BraveLocationBarView*>(browser_view->GetLocationBarView());
6868
ASSERT_NE(brave_location_bar_view, nullptr);
69-
OnionLocationView* onion_label =
70-
brave_location_bar_view->GetOnionLocationView();
71-
EXPECT_TRUE(onion_label->GetVisible());
72-
EXPECT_EQ(onion_label->GetText(),
69+
views::LabelButton* onion_button =
70+
brave_location_bar_view->GetOnionLocationView()->GetButton();
71+
EXPECT_TRUE(onion_button->GetVisible());
72+
EXPECT_EQ(onion_button->GetText(),
7373
l10n_util::GetStringUTF16((IDS_LOCATION_BAR_OPEN_IN_TOR)));
7474
}
7575

browser/ui/views/location_bar/onion_location_view.cc

+10-14
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
#include "chrome/browser/ui/views/toolbar/toolbar_ink_drop_util.h"
2121
#include "components/grit/brave_components_resources.h"
2222
#include "ui/base/l10n/l10n_util.h"
23-
#include "ui/base/resource/resource_bundle.h"
2423
#include "ui/base/models/image_model.h"
24+
#include "ui/base/resource/resource_bundle.h"
2525
#include "ui/gfx/color_palette.h"
2626
#include "ui/gfx/geometry/size.h"
2727
#include "ui/gfx/image/image_skia.h"
@@ -59,8 +59,7 @@ void OnTorProfileCreated(GURL onion_location,
5959

6060
// Sets the focus and ink drop highlight path to match the background
6161
// along with it's corner radius.
62-
class HighlightPathGenerator
63-
: public views::HighlightPathGenerator {
62+
class HighlightPathGenerator : public views::HighlightPathGenerator {
6463
public:
6564
HighlightPathGenerator() = default;
6665

@@ -77,18 +76,18 @@ class HighlightPathGenerator
7776
};
7877

7978
class OnionLocationButtonView : public views::LabelButton,
80-
public views::ButtonListener {
79+
public views::ButtonListener {
8180
public:
8281
explicit OnionLocationButtonView(Profile* profile)
8382
: LabelButton(this,
84-
l10n_util::GetStringUTF16(IDS_LOCATION_BAR_OPEN_IN_TOR)) {
83+
l10n_util::GetStringUTF16(IDS_LOCATION_BAR_OPEN_IN_TOR)) {
8584
if (brave::IsTorProfile(profile))
8685
SetText(l10n_util::GetStringUTF16(IDS_LOCATION_BAR_ONION_AVAILABLE));
8786
// Render vector icon
88-
const gfx::ImageSkia image = gfx::CreateVectorIcon(
89-
kOpenInTorIcon, kIconSize, kIconColor);
87+
const gfx::ImageSkia image =
88+
gfx::CreateVectorIcon(kOpenInTorIcon, kIconSize, kIconColor);
9089
SetImageModel(views::Button::STATE_NORMAL,
91-
ui::ImageModel::FromImageSkia(image));
90+
ui::ImageModel::FromImageSkia(image));
9291
// Set style specifics
9392
SetEnabledTextColors(kTextColor);
9493
SetHorizontalAlignment(gfx::ALIGN_RIGHT);
@@ -104,17 +103,15 @@ class OnionLocationButtonView : public views::LabelButton,
104103
this, std::make_unique<HighlightPathGenerator>());
105104
}
106105

107-
~OnionLocationButtonView() override { }
106+
~OnionLocationButtonView() override {}
108107

109108
// views::ButtonListener
110109
void ButtonPressed(Button* sender, const ui::Event& event) override {
111110
profiles::SwitchToTorProfile(
112111
base::BindRepeating(&OnTorProfileCreated, GURL(onion_location_)));
113112
}
114113

115-
void SetOnionLocation(GURL location) {
116-
onion_location_ = location;
117-
}
114+
void SetOnionLocation(GURL location) { onion_location_ = location; }
118115

119116
private:
120117
// views::View
@@ -125,7 +122,7 @@ class OnionLocationButtonView : public views::LabelButton,
125122

126123
void UpdateBorder() {
127124
SetBackground(
128-
views::CreateRoundedRectBackground(kOpenInTorBg, height() / 2));
125+
views::CreateRoundedRectBackground(kOpenInTorBg, height() / 2));
129126
}
130127

131128
GURL onion_location_;
@@ -138,7 +135,6 @@ class OnionLocationButtonView : public views::LabelButton,
138135

139136
OnionLocationView::OnionLocationView(Profile* profile) {
140137
SetBorder(views::CreateEmptyBorder(gfx::Insets(3, 3)));
141-
// GetLayoutInsets(LOCATION_BAR_ICON_INTERIOR_PADDING)));
142138
SetVisible(false);
143139
// automatic layout
144140
auto vertical_container_layout = std::make_unique<views::BoxLayout>(

browser/ui/views/location_bar/onion_location_view.h

+4-2
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
#ifndef BRAVE_BROWSER_UI_VIEWS_LOCATION_BAR_ONION_LOCATION_VIEW_H_
77
#define BRAVE_BROWSER_UI_VIEWS_LOCATION_BAR_ONION_LOCATION_VIEW_H_
88

9+
#include "ui/gfx/geometry/size.h"
910
#include "ui/views/controls/button/label_button.h"
1011
#include "ui/views/controls/button/label_button_border.h"
11-
#include "ui/gfx/geometry/size.h"
1212

1313
class Profile;
1414

@@ -23,8 +23,10 @@ class OnionLocationView : public views::View {
2323

2424
void Update(content::WebContents* web_contents);
2525

26+
views::LabelButton* GetButton() { return button_; }
27+
2628
private:
27-
View* button_ = nullptr;
29+
views::LabelButton* button_ = nullptr;
2830

2931
OnionLocationView(const OnionLocationView&) = delete;
3032
OnionLocationView& operator=(const OnionLocationView&) = delete;

0 commit comments

Comments
 (0)