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

Side by Side Diff: chrome/browser/ui/toolbar/media_router_contextual_menu_unittest.cc

Issue 2118503004: Media Router: Remove unnecessary and incorrect static_cast in test. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: SigninManagerBase 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "base/macros.h" 5 #include "base/macros.h"
6 #include "chrome/app/chrome_command_ids.h" 6 #include "chrome/app/chrome_command_ids.h"
7 #include "chrome/browser/extensions/browser_action_test_util.h" 7 #include "chrome/browser/extensions/browser_action_test_util.h"
8 #include "chrome/browser/signin/fake_signin_manager_builder.h" 8 #include "chrome/browser/signin/fake_signin_manager_builder.h"
9 #include "chrome/browser/signin/signin_manager_factory.h" 9 #include "chrome/browser/signin/signin_manager_factory.h"
10 #include "chrome/browser/ui/toolbar/media_router_action.h" 10 #include "chrome/browser/ui/toolbar/media_router_action.h"
11 #include "chrome/browser/ui/toolbar/media_router_contextual_menu.h" 11 #include "chrome/browser/ui/toolbar/media_router_contextual_menu.h"
12 #include "chrome/test/base/browser_with_test_window_test.h" 12 #include "chrome/test/base/browser_with_test_window_test.h"
13 13
14 class MediaRouterContextualMenuUnitTest : public BrowserWithTestWindowTest { 14 class MediaRouterContextualMenuUnitTest : public BrowserWithTestWindowTest {
15 public: 15 public:
16 MediaRouterContextualMenuUnitTest() {} 16 MediaRouterContextualMenuUnitTest() {}
17 ~MediaRouterContextualMenuUnitTest() override {} 17 ~MediaRouterContextualMenuUnitTest() override {}
18 18
19 void SetUp() override { 19 void SetUp() override {
20 BrowserWithTestWindowTest::SetUp(); 20 BrowserWithTestWindowTest::SetUp();
21 signin_manager_ = static_cast<FakeSigninManagerForTesting*>( 21 signin_manager_ =
22 SigninManagerFactory::GetInstance()->GetForProfile(profile())); 22 SigninManagerFactory::GetInstance()->GetForProfile(profile());
23 browser_action_test_util_.reset( 23 browser_action_test_util_.reset(
24 new BrowserActionTestUtil(browser(), false)); 24 new BrowserActionTestUtil(browser(), false));
25 action_.reset(new MediaRouterAction(browser(), 25 action_.reset(new MediaRouterAction(browser(),
26 browser_action_test_util_->GetToolbarActionsBar())); 26 browser_action_test_util_->GetToolbarActionsBar()));
27 model_ = static_cast<ui::SimpleMenuModel*>(action_->GetContextMenu()); 27 model_ = static_cast<ui::SimpleMenuModel*>(action_->GetContextMenu());
28 } 28 }
29 29
30 void TearDown() override { 30 void TearDown() override {
31 action_.reset(); 31 action_.reset();
32 browser_action_test_util_.reset(); 32 browser_action_test_util_.reset();
33 BrowserWithTestWindowTest::TearDown(); 33 BrowserWithTestWindowTest::TearDown();
34 } 34 }
35 35
36 FakeSigninManagerForTesting* signin_manager() { return signin_manager_; } 36 SigninManagerBase* signin_manager() { return signin_manager_; }
37 ui::SimpleMenuModel* model() { return model_; } 37 ui::SimpleMenuModel* model() { return model_; }
38 38
39 private: 39 private:
40 std::unique_ptr<BrowserActionTestUtil> browser_action_test_util_; 40 std::unique_ptr<BrowserActionTestUtil> browser_action_test_util_;
41 std::unique_ptr<MediaRouterAction> action_; 41 std::unique_ptr<MediaRouterAction> action_;
42 FakeSigninManagerForTesting* signin_manager_; 42 SigninManagerBase* signin_manager_;
43 ui::SimpleMenuModel* model_; 43 ui::SimpleMenuModel* model_;
44 44
45 DISALLOW_COPY_AND_ASSIGN(MediaRouterContextualMenuUnitTest); 45 DISALLOW_COPY_AND_ASSIGN(MediaRouterContextualMenuUnitTest);
46 }; 46 };
47 47
48 // Tests the basic state of the contextual menu. 48 // Tests the basic state of the contextual menu.
49 TEST_F(MediaRouterContextualMenuUnitTest, Basic) { 49 TEST_F(MediaRouterContextualMenuUnitTest, Basic) {
50 int expected_number_items = 7; 50 int expected_number_items = 7;
51 51
52 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_CHROMEOS) 52 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_CHROMEOS)
(...skipping 29 matching lines...) Expand all
82 signin_manager()->SetAuthenticatedAccountInfo("foo@bar.com", "password"); 82 signin_manager()->SetAuthenticatedAccountInfo("foo@bar.com", "password");
83 83
84 // Run the same checks as before. All existing menu items should be now 84 // Run the same checks as before. All existing menu items should be now
85 // enabled and visible. 85 // enabled and visible.
86 EXPECT_EQ(model()->GetItemCount(), expected_number_items); 86 EXPECT_EQ(model()->GetItemCount(), expected_number_items);
87 for (int i = 0; i < expected_number_items; i++) { 87 for (int i = 0; i < expected_number_items; i++) {
88 EXPECT_TRUE(model()->IsEnabledAt(i)); 88 EXPECT_TRUE(model()->IsEnabledAt(i));
89 EXPECT_TRUE(model()->IsVisibleAt(i)); 89 EXPECT_TRUE(model()->IsVisibleAt(i));
90 } 90 }
91 } 91 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698