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

Unified Diff: chrome/browser/ui/views/chooser_content_view_unittest.cc

Issue 2155743002: Add throbber and status text to WebBluetooth chooser UI on non-Mac desktops (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed compile error on Mac Created 4 years, 5 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/views/chooser_content_view_unittest.cc
diff --git a/chrome/browser/ui/views/chooser_content_view_unittest.cc b/chrome/browser/ui/views/chooser_content_view_unittest.cc
index 1002e7eb3033b6588644c2792da0b8c2e39ee86f..c753830dfd754a0598b39438161a25eb3948d87e 100644
--- a/chrome/browser/ui/views/chooser_content_view_unittest.cc
+++ b/chrome/browser/ui/views/chooser_content_view_unittest.cc
@@ -9,32 +9,22 @@
#include "base/macros.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/chooser_controller/mock_chooser_controller.h"
-#include "chrome/grit/generated_resources.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "ui/base/l10n/l10n_util.h"
#include "ui/views/controls/styled_label.h"
-#include "ui/views/controls/styled_label_listener.h"
#include "ui/views/controls/table/table_view.h"
#include "ui/views/controls/table/table_view_observer.h"
namespace {
+const char kNoDevicesFound[] = "No devices found.";
msw 2016/07/19 22:08:11 nit: don't do this; use IDS_DEVICE_CHOOSER_NO_DEVI
juncai 2016/07/19 22:58:24 Done.
+
class MockTableViewObserver : public views::TableViewObserver {
public:
// views::TableViewObserver:
MOCK_METHOD0(OnSelectionChanged, void());
};
-class MockStyledLabelListener : public views::StyledLabelListener {
- public:
- // views::StyledLabelListener:
- MOCK_METHOD3(StyledLabelLinkClicked,
- void(views::StyledLabel* label,
- const gfx::Range& range,
- int event_flags));
-};
-
} // namespace
class ChooserContentViewTest : public testing::Test {
@@ -53,9 +43,7 @@ class ChooserContentViewTest : public testing::Test {
ASSERT_TRUE(table_view_);
table_model_ = table_view_->model();
ASSERT_TRUE(table_model_);
- mock_styled_label_listener_.reset(new MockStyledLabelListener());
- styled_label_.reset(chooser_content_view_->CreateFootnoteView(
- mock_styled_label_listener_.get()));
+ styled_label_.reset(chooser_content_view_->CreateFootnoteView());
ASSERT_TRUE(styled_label_);
}
@@ -65,7 +53,6 @@ class ChooserContentViewTest : public testing::Test {
MockChooserController* mock_chooser_controller_;
views::TableView* table_view_;
ui::TableModel* table_model_;
- std::unique_ptr<MockStyledLabelListener> mock_styled_label_listener_;
std::unique_ptr<views::StyledLabel> styled_label_;
private:
@@ -78,9 +65,7 @@ TEST_F(ChooserContentViewTest, InitialState) {
// Since "No devices found." needs to be displayed on the |table_view_|,
// the number of rows is 1.
EXPECT_EQ(1, table_view_->RowCount());
- EXPECT_EQ(
- l10n_util::GetStringUTF16(IDS_DEVICE_CHOOSER_NO_DEVICES_FOUND_PROMPT),
- table_model_->GetText(0, 0));
+ EXPECT_EQ(base::ASCIIToUTF16(kNoDevicesFound), table_model_->GetText(0, 0));
// |table_view_| should be disabled since there is no option shown.
EXPECT_FALSE(table_view_->enabled());
// No option selected.
@@ -151,9 +136,7 @@ TEST_F(ChooserContentViewTest, RemoveOption) {
// There is no option shown now. But since "No devices found."
// needs to be displayed on the |table_view_|, the number of rows is 1.
EXPECT_EQ(1, table_view_->RowCount());
- EXPECT_EQ(
- l10n_util::GetStringUTF16(IDS_DEVICE_CHOOSER_NO_DEVICES_FOUND_PROMPT),
- table_model_->GetText(0, 0));
+ EXPECT_EQ(base::ASCIIToUTF16(kNoDevicesFound), table_model_->GetText(0, 0));
// |table_view_| should be disabled since all options are removed.
EXPECT_FALSE(table_view_->enabled());
EXPECT_EQ(0, table_view_->SelectedRowCount());
@@ -296,9 +279,7 @@ TEST_F(ChooserContentViewTest,
// There is no option shown now. But since "No devices found."
// needs to be displayed on the |table_view_|, the number of rows is 1.
EXPECT_EQ(1, table_view_->RowCount());
- EXPECT_EQ(
- l10n_util::GetStringUTF16(IDS_DEVICE_CHOOSER_NO_DEVICES_FOUND_PROMPT),
- table_model_->GetText(0, 0));
+ EXPECT_EQ(base::ASCIIToUTF16(kNoDevicesFound), table_model_->GetText(0, 0));
// |table_view_| should be disabled since all options are removed.
EXPECT_FALSE(table_view_->enabled());
// No option selected.
@@ -307,8 +288,6 @@ TEST_F(ChooserContentViewTest,
}
TEST_F(ChooserContentViewTest, ClickStyledLabelLink) {
- EXPECT_CALL(*mock_styled_label_listener_,
- StyledLabelLinkClicked(styled_label_.get(), testing::_, 0))
- .Times(1);
+ EXPECT_CALL(*mock_chooser_controller_, OpenHelpCenterUrl()).Times(1);
styled_label_->LinkClicked(nullptr, 0);
}

Powered by Google App Engine
This is Rietveld 408576698