|
|
Description[Media Router] Unit tests for sticky cast modes
This CL adds test cases to MediaRouterUITest and
MediaRouterWebUIMessageHandlerTest that test recording and retrieving users'
preferred cast modes (whether they chose tab mirroring for the current origin)
in regular and incognito profiles.
BUG=664671
Committed: https://crrev.com/a600d8d8827e214ea10131ce041419118abaec30
Cr-Commit-Position: refs/heads/master@{#440908}
Patch Set 1 #Patch Set 2 : Rebase #Patch Set 3 : Just the unit tests #Patch Set 4 : Rebase #
Messages
Total messages: 50 (40 generated)
Description was changed from ========== . BUG= ========== to ========== [Media Router] Don't record/retrieve cast mode pref in incognito When the user is in incognito mode, we shouldn't record their cast mode selections in the MR dialog. We also shouldn't change the initial cast mode based on user pref in incognito. BUG=664671 ==========
Description was changed from ========== [Media Router] Don't record/retrieve cast mode pref in incognito When the user is in incognito mode, we shouldn't record their cast mode selections in the MR dialog. We also shouldn't change the initial cast mode based on user pref in incognito. BUG=664671 ========== to ========== [Media Router] Don't record/retrieve cast mode pref in incognito When the user is in incognito mode, we shouldn't record their cast mode selections in the MR dialog. We also shouldn't change the initial cast mode based on user pref in incognito. BUG=664671 ==========
takumif@chromium.org changed reviewers: + apacible@chromium.org
Please take a look, thank you!
lgtm
The CQ bit was checked by takumif@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: ios-device on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/ios-device/builds...) ios-simulator on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/ios-simulator/bui...)
The CQ bit was checked by takumif@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: ios-device on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/ios-device/builds...) ios-simulator on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/ios-simulator/bui...)
The CQ bit was checked by takumif@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
Patchset #3 (id:40001) has been deleted
Patchset #3 (id:60001) has been deleted
Patchset #3 (id:80001) has been deleted
Patchset #2 (id:20001) has been deleted
Description was changed from ========== [Media Router] Don't record/retrieve cast mode pref in incognito When the user is in incognito mode, we shouldn't record their cast mode selections in the MR dialog. We also shouldn't change the initial cast mode based on user pref in incognito. BUG=664671 ========== to ========== [Media Router] Unit tests for sticky cast modes This CL adds test cases to MediaRouterUITest and MediaRouterWebUIMessageHandlerTest that test recording and retrieving users' preferred cast modes (whether they chose tab mirroring for the current origin) in regular and incognito profiles. BUG=664671 ==========
Description was changed from ========== [Media Router] Unit tests for sticky cast modes This CL adds test cases to MediaRouterUITest and MediaRouterWebUIMessageHandlerTest that test recording and retrieving users' preferred cast modes (whether they chose tab mirroring for the current origin) in regular and incognito profiles. BUG=664671 ========== to ========== [Media Router] Unit tests for sticky cast modes This CL adds test cases to MediaRouterUITest and MediaRouterWebUIMessageHandlerTest that test recording and retrieving users' preferred cast modes (whether they chose tab mirroring for the current origin) in regular and incognito profiles. BUG=664671 ==========
Since we took care of incognito cases in this CL [1], I've removed incognito-related changes from this CL and modified the unit tests a bit. Please take another look, thanks. [1] https://codereview.chromium.org/2517833004/
The CQ bit was checked by takumif@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
I've added a new patch set to this CL, so it'd be great if you could take a look at this again. Thanks!
lgtm
The CQ bit was checked by takumif@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
The CQ bit was checked by takumif@chromium.org
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Failed to apply patch for chrome/browser/ui/webui/media_router/media_router_webui_message_handler_unittest.cc: While running git apply --index -p1; error: patch failed: chrome/browser/ui/webui/media_router/media_router_webui_message_handler_unittest.cc:577 error: chrome/browser/ui/webui/media_router/media_router_webui_message_handler_unittest.cc: patch does not apply Patch: chrome/browser/ui/webui/media_router/media_router_webui_message_handler_unittest.cc Index: chrome/browser/ui/webui/media_router/media_router_webui_message_handler_unittest.cc diff --git a/chrome/browser/ui/webui/media_router/media_router_webui_message_handler_unittest.cc b/chrome/browser/ui/webui/media_router/media_router_webui_message_handler_unittest.cc index cc22450104a0b94dea07f0f8189c1ceac9046cc7..93b1925b804d68a9c2ec88bd98b1d031d0f8d703 100644 --- a/chrome/browser/ui/webui/media_router/media_router_webui_message_handler_unittest.cc +++ b/chrome/browser/ui/webui/media_router/media_router_webui_message_handler_unittest.cc @@ -15,6 +15,7 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +using testing::Return; using testing::ReturnRef; namespace media_router { @@ -30,6 +31,10 @@ class MockMediaRouterUI : public MediaRouterUI { : MediaRouterUI(web_ui) {} ~MockMediaRouterUI() {} + MOCK_METHOD0(UIInitialized, void()); + MOCK_CONST_METHOD0(UserSelectedTabMirroringForCurrentOrigin, bool()); + MOCK_METHOD1(RecordCastModeSelection, void(MediaCastMode cast_mode)); + MOCK_CONST_METHOD0(cast_modes, const std::set<MediaCastMode>&()); MOCK_CONST_METHOD0(GetRouteProviderExtensionId, const std::string&()); }; @@ -577,4 +582,51 @@ TEST_F(MediaRouterWebUIMessageHandlerTest, UpdateIssue) { EXPECT_EQ(is_blocking, actual_is_blocking); } +TEST_F(MediaRouterWebUIMessageHandlerTest, RecordCastModeSelection) { + base::ListValue args; + args.AppendInteger(MediaCastMode::DEFAULT); + EXPECT_CALL(*mock_media_router_ui_.get(), + RecordCastModeSelection(MediaCastMode::DEFAULT)) + .Times(1); + handler_->OnReportSelectedCastMode(&args); + + args.Clear(); + args.AppendInteger(MediaCastMode::TAB_MIRROR); + EXPECT_CALL(*mock_media_router_ui_.get(), + RecordCastModeSelection(MediaCastMode::TAB_MIRROR)) + .Times(1); + handler_->OnReportSelectedCastMode(&args); +} + +TEST_F(MediaRouterWebUIMessageHandlerTest, RetrieveCastModeSelection) { + base::ListValue args; + std::set<MediaCastMode> cast_modes = {MediaCastMode::TAB_MIRROR}; + EXPECT_CALL(*mock_media_router_ui_, GetRouteProviderExtensionId()) + .WillRepeatedly(ReturnRef(provider_extension_id())); + EXPECT_CALL(*mock_media_router_ui_, cast_modes()) + .WillRepeatedly(ReturnRef(cast_modes)); + + EXPECT_CALL(*mock_media_router_ui_, + UserSelectedTabMirroringForCurrentOrigin()) + .WillOnce(Return(true)); + handler_->OnRequestInitialData(&args); + const content::TestWebUI::CallData& call_data1 = *web_ui_->call_data()[0]; + ASSERT_EQ("media_router.ui.setInitialData", call_data1.function_name()); + const base::DictionaryValue* initial_data = nullptr; + ASSERT_TRUE(call_data1.arg1()->GetAsDictionary(&initial_data)); + bool use_tab_mirroring = false; + EXPECT_TRUE(initial_data->GetBoolean("useTabMirroring", &use_tab_mirroring)); + EXPECT_TRUE(use_tab_mirroring); + + EXPECT_CALL(*mock_media_router_ui_, + UserSelectedTabMirroringForCurrentOrigin()) + .WillOnce(Return(false)); + handler_->OnRequestInitialData(&args); + const content::TestWebUI::CallData& call_data2 = *web_ui_->call_data()[1]; + ASSERT_EQ("media_router.ui.setInitialData", call_data2.function_name()); + ASSERT_TRUE(call_data2.arg1()->GetAsDictionary(&initial_data)); + EXPECT_TRUE(initial_data->GetBoolean("useTabMirroring", &use_tab_mirroring)); + EXPECT_FALSE(use_tab_mirroring); +} + } // namespace media_router
The CQ bit was checked by takumif@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
The CQ bit was checked by takumif@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from apacible@chromium.org Link to the patchset: https://codereview.chromium.org/2549323002/#ps140001 (title: "Rebase")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
CQ is committing da patch. Bot data: {"patchset_id": 140001, "attempt_start_ts": 1482969485891570, "parent_rev": "72040f543b53b4e9151efc169d414219d7404dc1", "commit_rev": "c421ae7020ed0e27dfcf2707942ada303c0da633"}
Message was sent while issue was closed.
Description was changed from ========== [Media Router] Unit tests for sticky cast modes This CL adds test cases to MediaRouterUITest and MediaRouterWebUIMessageHandlerTest that test recording and retrieving users' preferred cast modes (whether they chose tab mirroring for the current origin) in regular and incognito profiles. BUG=664671 ========== to ========== [Media Router] Unit tests for sticky cast modes This CL adds test cases to MediaRouterUITest and MediaRouterWebUIMessageHandlerTest that test recording and retrieving users' preferred cast modes (whether they chose tab mirroring for the current origin) in regular and incognito profiles. BUG=664671 Review-Url: https://codereview.chromium.org/2549323002 ==========
Message was sent while issue was closed.
Committed patchset #4 (id:140001)
Message was sent while issue was closed.
Description was changed from ========== [Media Router] Unit tests for sticky cast modes This CL adds test cases to MediaRouterUITest and MediaRouterWebUIMessageHandlerTest that test recording and retrieving users' preferred cast modes (whether they chose tab mirroring for the current origin) in regular and incognito profiles. BUG=664671 Review-Url: https://codereview.chromium.org/2549323002 ========== to ========== [Media Router] Unit tests for sticky cast modes This CL adds test cases to MediaRouterUITest and MediaRouterWebUIMessageHandlerTest that test recording and retrieving users' preferred cast modes (whether they chose tab mirroring for the current origin) in regular and incognito profiles. BUG=664671 Committed: https://crrev.com/a600d8d8827e214ea10131ce041419118abaec30 Cr-Commit-Position: refs/heads/master@{#440908} ==========
Message was sent while issue was closed.
Patchset 4 (id:??) landed as https://crrev.com/a600d8d8827e214ea10131ce041419118abaec30 Cr-Commit-Position: refs/heads/master@{#440908} |