Commit 0dcfa559 authored by Tim Song's avatar Tim Song Committed by Commit Bot

[CrOS PhoneHub] Update unit tests to check for proper view ids.

BUG=1106937,1126208

Change-Id: Ic8178b1c481db1b74a9abd775f8e98b30d81e6a8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2444126
Commit-Queue: Tim Song <tengs@chromium.org>
Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
Reviewed-by: default avatarMeilin Wang <meilinw@chromium.org>
Cr-Commit-Position: refs/heads/master@{#813396}
parent e31a7af5
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "ash/strings/grit/ash_strings.h" #include "ash/strings/grit/ash_strings.h"
#include "ash/style/ash_color_provider.h" #include "ash/style/ash_color_provider.h"
#include "ash/system/phonehub/phone_hub_interstitial_view.h" #include "ash/system/phonehub/phone_hub_interstitial_view.h"
#include "ash/system/phonehub/phone_hub_view_ids.h"
#include "ash/system/unified/rounded_label_button.h" #include "ash/system/unified/rounded_label_button.h"
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h" #include "ui/base/resource/resource_bundle.h"
...@@ -25,6 +26,8 @@ constexpr int kOkButtonTag = 2; ...@@ -25,6 +26,8 @@ constexpr int kOkButtonTag = 2;
} // namespace } // namespace
BluetoothDisabledView::BluetoothDisabledView() { BluetoothDisabledView::BluetoothDisabledView() {
SetID(PhoneHubViewID::kBluetoothDisabledView);
SetLayoutManager(std::make_unique<views::FillLayout>()); SetLayoutManager(std::make_unique<views::FillLayout>());
content_view_ = AddChildView( content_view_ = AddChildView(
std::make_unique<PhoneHubInterstitialView>(/*show_progress=*/false)); std::make_unique<PhoneHubInterstitialView>(/*show_progress=*/false));
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "ash/public/cpp/resources/grit/ash_public_unscaled_resources.h" #include "ash/public/cpp/resources/grit/ash_public_unscaled_resources.h"
#include "ash/strings/grit/ash_strings.h" #include "ash/strings/grit/ash_strings.h"
#include "ash/system/phonehub/phone_hub_interstitial_view.h" #include "ash/system/phonehub/phone_hub_interstitial_view.h"
#include "ash/system/phonehub/phone_hub_view_ids.h"
#include "base/strings/string16.h" #include "base/strings/string16.h"
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h" #include "ui/base/resource/resource_bundle.h"
...@@ -18,6 +19,7 @@ ...@@ -18,6 +19,7 @@
namespace ash { namespace ash {
InitialConnectingView::InitialConnectingView() { InitialConnectingView::InitialConnectingView() {
SetID(PhoneHubViewID::kInitialConnectingView);
SetLayoutManager(std::make_unique<views::FillLayout>()); SetLayoutManager(std::make_unique<views::FillLayout>());
content_view_ = AddChildView( content_view_ = AddChildView(
std::make_unique<PhoneHubInterstitialView>(/*show_progress=*/true)); std::make_unique<PhoneHubInterstitialView>(/*show_progress=*/true));
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "ash/style/ash_color_provider.h" #include "ash/style/ash_color_provider.h"
#include "ash/system/phonehub/notification_opt_in_view.h" #include "ash/system/phonehub/notification_opt_in_view.h"
#include "ash/system/phonehub/phone_hub_view_ids.h"
#include "ash/system/phonehub/phone_status_view.h" #include "ash/system/phonehub/phone_status_view.h"
#include "ash/system/phonehub/quick_actions_view.h" #include "ash/system/phonehub/quick_actions_view.h"
#include "ash/system/phonehub/task_continuation_view.h" #include "ash/system/phonehub/task_continuation_view.h"
...@@ -31,6 +32,8 @@ constexpr int kPaddingBetweenTitleAndSeparator = 3; ...@@ -31,6 +32,8 @@ constexpr int kPaddingBetweenTitleAndSeparator = 3;
PhoneConnectedView::PhoneConnectedView( PhoneConnectedView::PhoneConnectedView(
TrayBubbleView* bubble_view, TrayBubbleView* bubble_view,
chromeos::phonehub::PhoneHubManager* phone_hub_manager) { chromeos::phonehub::PhoneHubManager* phone_hub_manager) {
SetID(PhoneHubViewID::kPhoneConnectedView);
auto setup_layered_view = [](views::View* view) { auto setup_layered_view = [](views::View* view) {
view->SetPaintToLayer(); view->SetPaintToLayer();
view->layer()->SetFillsBoundsOpaquely(false); view->layer()->SetFillsBoundsOpaquely(false);
......
...@@ -200,8 +200,7 @@ TEST_F(PhoneHubTrayTest, TransitionContentView) { ...@@ -200,8 +200,7 @@ TEST_F(PhoneHubTrayTest, TransitionContentView) {
EXPECT_TRUE(phone_hub_tray_->is_active()); EXPECT_TRUE(phone_hub_tray_->is_active());
EXPECT_TRUE(content_view()); EXPECT_TRUE(content_view());
// TODO(tengs) Test the actual view id. EXPECT_EQ(PhoneHubViewID::kPhoneConnectedView, content_view()->GetID());
EXPECT_EQ(0, content_view()->GetID());
GetFeatureStatusProvider()->SetStatus( GetFeatureStatusProvider()->SetStatus(
chromeos::phonehub::FeatureStatus::kEnabledButDisconnected); chromeos::phonehub::FeatureStatus::kEnabledButDisconnected);
...@@ -237,6 +236,8 @@ TEST_F(PhoneHubTrayTest, ClickButtonsOnDisconnectedView) { ...@@ -237,6 +236,8 @@ TEST_F(PhoneHubTrayTest, ClickButtonsOnDisconnectedView) {
// Simulates a click on the "Learn more" button. // Simulates a click on the "Learn more" button.
ClickOnAndWait(disconnected_learn_more_button()); ClickOnAndWait(disconnected_learn_more_button());
EXPECT_TRUE(content_view());
EXPECT_EQ(PhoneHubViewID::kDisconnectedView, content_view()->GetID());
} }
} // namespace ash } // namespace ash
...@@ -104,8 +104,7 @@ TEST_F(PhoneHubUiControllerTest, PhoneConnectingForOnboarding) { ...@@ -104,8 +104,7 @@ TEST_F(PhoneHubUiControllerTest, PhoneConnectingForOnboarding) {
controller_.ui_state()); controller_.ui_state());
auto content_view = controller_.CreateContentView(/*bubble_view=*/nullptr); auto content_view = controller_.CreateContentView(/*bubble_view=*/nullptr);
// TODO(tengs): Test the actual view id. EXPECT_EQ(PhoneHubViewID::kInitialConnectingView, content_view->GetID());
EXPECT_EQ(0, content_view->GetID());
} }
TEST_F(PhoneHubUiControllerTest, BluetoothOff) { TEST_F(PhoneHubUiControllerTest, BluetoothOff) {
...@@ -115,8 +114,7 @@ TEST_F(PhoneHubUiControllerTest, BluetoothOff) { ...@@ -115,8 +114,7 @@ TEST_F(PhoneHubUiControllerTest, BluetoothOff) {
controller_.ui_state()); controller_.ui_state());
auto content_view = controller_.CreateContentView(/*bubble_view=*/nullptr); auto content_view = controller_.CreateContentView(/*bubble_view=*/nullptr);
// TODO(tengs): Test the actual view id. EXPECT_EQ(PhoneHubViewID::kBluetoothDisabledView, content_view->GetID());
EXPECT_EQ(0, content_view->GetID());
} }
TEST_F(PhoneHubUiControllerTest, PhoneDisconnected) { TEST_F(PhoneHubUiControllerTest, PhoneDisconnected) {
...@@ -143,8 +141,7 @@ TEST_F(PhoneHubUiControllerTest, PhoneConnected) { ...@@ -143,8 +141,7 @@ TEST_F(PhoneHubUiControllerTest, PhoneConnected) {
controller_.ui_state()); controller_.ui_state());
auto content_view = controller_.CreateContentView(/*bubble_view=*/nullptr); auto content_view = controller_.CreateContentView(/*bubble_view=*/nullptr);
// TODO(tengs): Test the actual view id. EXPECT_EQ(kPhoneConnectedView, content_view->GetID());
EXPECT_EQ(0, content_view->GetID());
} }
} // namespace ash } // namespace ash
...@@ -28,6 +28,10 @@ enum PhoneHubViewID { ...@@ -28,6 +28,10 @@ enum PhoneHubViewID {
kReconnectingView, kReconnectingView,
kDisconnectedLearnMoreButton, kDisconnectedLearnMoreButton,
kDisconnectedRefreshButton, kDisconnectedRefreshButton,
kPhoneConnectedView,
kInitialConnectingView,
kBluetoothDisabledView,
}; };
} // namespace ash } // namespace ash
......
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