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

Side by Side Diff: chrome/browser/ui/webui/media_router/media_router_ui_unittest.cc

Issue 2549323002: [Media Router] Unit tests for sticky cast modes (Closed)
Patch Set: Rebase Created 3 years, 11 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/webui/media_router/media_router_ui.h" 5 #include "chrome/browser/ui/webui/media_router/media_router_ui.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 media_router_ui_->RecordCastModeSelection(MediaCastMode::DEFAULT); 570 media_router_ui_->RecordCastModeSelection(MediaCastMode::DEFAULT);
571 EXPECT_FALSE(media_router_ui_->UserSelectedTabMirroringForCurrentOrigin()); 571 EXPECT_FALSE(media_router_ui_->UserSelectedTabMirroringForCurrentOrigin());
572 572
573 media_router_ui_->RecordCastModeSelection(MediaCastMode::TAB_MIRROR); 573 media_router_ui_->RecordCastModeSelection(MediaCastMode::TAB_MIRROR);
574 CreateMediaRouterUIForURL(profile(), url_3); 574 CreateMediaRouterUIForURL(profile(), url_3);
575 // |url_1a| and |url_3| have the same domain "example.com" but different 575 // |url_1a| and |url_3| have the same domain "example.com" but different
576 // origins, so their preferences should be separate. 576 // origins, so their preferences should be separate.
577 EXPECT_FALSE(media_router_ui_->UserSelectedTabMirroringForCurrentOrigin()); 577 EXPECT_FALSE(media_router_ui_->UserSelectedTabMirroringForCurrentOrigin());
578 } 578 }
579 579
580 TEST_F(MediaRouterUITest, RecordCastModeSelectionsInIncognito) {
581 const GURL url = GURL("https://www.example.com/watch?v=AAAA");
582
583 CreateMediaRouterUIForURL(profile()->GetOffTheRecordProfile(), url);
584 EXPECT_FALSE(media_router_ui_->UserSelectedTabMirroringForCurrentOrigin());
585 media_router_ui_->RecordCastModeSelection(MediaCastMode::TAB_MIRROR);
586 EXPECT_TRUE(media_router_ui_->UserSelectedTabMirroringForCurrentOrigin());
587
588 // Selections recorded in incognito shouldn't be retrieved in the regular
589 // profile.
590 CreateMediaRouterUIForURL(profile(), url);
591 EXPECT_FALSE(media_router_ui_->UserSelectedTabMirroringForCurrentOrigin());
592 }
593
580 TEST_F(MediaRouterUITest, RecordDesktopMirroringCastModeSelection) { 594 TEST_F(MediaRouterUITest, RecordDesktopMirroringCastModeSelection) {
581 const GURL url = GURL("https://www.example.com/watch?v=AAAA"); 595 const GURL url = GURL("https://www.example.com/watch?v=AAAA");
582 CreateMediaRouterUIForURL(profile(), url); 596 CreateMediaRouterUIForURL(profile(), url);
583 597
584 EXPECT_FALSE(media_router_ui_->UserSelectedTabMirroringForCurrentOrigin()); 598 EXPECT_FALSE(media_router_ui_->UserSelectedTabMirroringForCurrentOrigin());
585 media_router_ui_->RecordCastModeSelection(MediaCastMode::DESKTOP_MIRROR); 599 media_router_ui_->RecordCastModeSelection(MediaCastMode::DESKTOP_MIRROR);
586 // Selecting desktop mirroring should not change the recorded preferences. 600 // Selecting desktop mirroring should not change the recorded preferences.
587 EXPECT_FALSE(media_router_ui_->UserSelectedTabMirroringForCurrentOrigin()); 601 EXPECT_FALSE(media_router_ui_->UserSelectedTabMirroringForCurrentOrigin());
588 602
589 media_router_ui_->RecordCastModeSelection(MediaCastMode::TAB_MIRROR); 603 media_router_ui_->RecordCastModeSelection(MediaCastMode::TAB_MIRROR);
590 EXPECT_TRUE(media_router_ui_->UserSelectedTabMirroringForCurrentOrigin()); 604 EXPECT_TRUE(media_router_ui_->UserSelectedTabMirroringForCurrentOrigin());
591 media_router_ui_->RecordCastModeSelection(MediaCastMode::DESKTOP_MIRROR); 605 media_router_ui_->RecordCastModeSelection(MediaCastMode::DESKTOP_MIRROR);
592 // Selecting desktop mirroring should not change the recorded preferences. 606 // Selecting desktop mirroring should not change the recorded preferences.
593 EXPECT_TRUE(media_router_ui_->UserSelectedTabMirroringForCurrentOrigin()); 607 EXPECT_TRUE(media_router_ui_->UserSelectedTabMirroringForCurrentOrigin());
594 } 608 }
609
595 } // namespace media_router 610 } // namespace media_router
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698