OLD | NEW |
---|---|
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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "chrome/browser/ui/browser_commands.h" | 6 #include "chrome/browser/ui/browser_commands.h" |
7 #include "chrome/browser/ui/browser_finder.h" | 7 #include "chrome/browser/ui/browser_finder.h" |
8 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 8 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
9 #include "chrome/browser/ui/webui/media_router/media_router_dialog_controller.h" | 9 #include "chrome/browser/ui/webui/media_router/media_router_dialog_controller_im pl.h" |
10 #include "chrome/browser/ui/webui/media_router/media_router_ui.h" | 10 #include "chrome/browser/ui/webui/media_router/media_router_ui.h" |
11 #include "chrome/common/chrome_switches.h" | 11 #include "chrome/common/chrome_switches.h" |
12 #include "chrome/test/base/in_process_browser_test.h" | 12 #include "chrome/test/base/in_process_browser_test.h" |
13 #include "chrome/test/base/ui_test_utils.h" | 13 #include "chrome/test/base/ui_test_utils.h" |
14 #include "content/public/common/url_constants.h" | 14 #include "content/public/common/url_constants.h" |
15 #include "content/public/test/browser_test_utils.h" | 15 #include "content/public/test/browser_test_utils.h" |
16 #include "content/public/test/test_navigation_observer.h" | 16 #include "content/public/test/test_navigation_observer.h" |
17 | 17 |
18 using content::WebContents; | 18 using content::WebContents; |
19 using content::TestNavigationObserver; | 19 using content::TestNavigationObserver; |
(...skipping 12 matching lines...) Expand all Loading... | |
32 ~MediaRouterDialogControllerBrowserTest() override {} | 32 ~MediaRouterDialogControllerBrowserTest() override {} |
33 | 33 |
34 protected: | 34 protected: |
35 void SetUpOnMainThread() override { | 35 void SetUpOnMainThread() override { |
36 // Start with one window with one tab. | 36 // Start with one window with one tab. |
37 EXPECT_EQ(1u, chrome::GetTotalBrowserCount()); | 37 EXPECT_EQ(1u, chrome::GetTotalBrowserCount()); |
38 EXPECT_EQ(1, browser()->tab_strip_model()->count()); | 38 EXPECT_EQ(1, browser()->tab_strip_model()->count()); |
39 | 39 |
40 initiator_ = browser()->tab_strip_model()->GetActiveWebContents(); | 40 initiator_ = browser()->tab_strip_model()->GetActiveWebContents(); |
41 ASSERT_TRUE(initiator_); | 41 ASSERT_TRUE(initiator_); |
42 MediaRouterDialogController::CreateForWebContents(initiator_); | 42 MediaRouterDialogControllerImpl::CreateForWebContents(initiator_); |
43 dialog_controller_ = | 43 dialog_controller_ = |
44 MediaRouterDialogController::FromWebContents(initiator_); | 44 MediaRouterDialogControllerImpl::FromWebContents(initiator_); |
45 ASSERT_TRUE(dialog_controller_); | 45 ASSERT_TRUE(dialog_controller_); |
46 | 46 |
47 // Get the media router dialog for the initiator. | 47 // Get the media router dialog for the initiator. |
48 media_router_dialog_ = dialog_controller_->ShowMediaRouterDialog(); | 48 media_router_dialog_ = dialog_controller_->ShowMediaRouterDialog(); |
49 ASSERT_TRUE(media_router_dialog_); | 49 ASSERT_TRUE(media_router_dialog_); |
50 } | 50 } |
51 | 51 |
52 MediaRouterDialogController* dialog_controller_; | 52 MediaRouterDialogControllerImpl* dialog_controller_; |
53 WebContents* initiator_; | 53 WebContents* initiator_; |
54 WebContents* media_router_dialog_; | 54 WebContents* media_router_dialog_; |
55 | 55 |
56 private: | 56 private: |
57 DISALLOW_COPY_AND_ASSIGN(MediaRouterDialogControllerBrowserTest); | 57 DISALLOW_COPY_AND_ASSIGN(MediaRouterDialogControllerBrowserTest); |
58 }; | 58 }; |
59 | 59 |
60 IN_PROC_BROWSER_TEST_F(MediaRouterDialogControllerBrowserTest, ShowDialog) { | 60 IN_PROC_BROWSER_TEST_F(MediaRouterDialogControllerBrowserTest, ShowDialog) { |
imcheng
2015/07/13 22:04:14
Looks like we should rename the test class and fil
| |
61 // Waits for the dialog to initialize. | 61 // Waits for the dialog to initialize. |
62 TestNavigationObserver nav_observer(media_router_dialog_); | 62 TestNavigationObserver nav_observer(media_router_dialog_); |
63 nav_observer.Wait(); | 63 nav_observer.Wait(); |
64 | 64 |
65 // New media router dialog is a constrained window, so the number of | 65 // New media router dialog is a constrained window, so the number of |
66 // tabs is still 1. | 66 // tabs is still 1. |
67 EXPECT_EQ(1, browser()->tab_strip_model()->count()); | 67 EXPECT_EQ(1, browser()->tab_strip_model()->count()); |
68 EXPECT_NE(initiator_, media_router_dialog_); | 68 EXPECT_NE(initiator_, media_router_dialog_); |
69 EXPECT_EQ(media_router_dialog_, dialog_controller_->GetMediaRouterDialog()); | 69 EXPECT_EQ(media_router_dialog_, dialog_controller_->GetMediaRouterDialog()); |
70 | 70 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
109 | 109 |
110 // Blocks until the dialog WebContents has been destroyed. | 110 // Blocks until the dialog WebContents has been destroyed. |
111 rph_watcher.Wait(); | 111 rph_watcher.Wait(); |
112 dialog_watcher.Wait(); | 112 dialog_watcher.Wait(); |
113 | 113 |
114 // Entry has been removed. | 114 // Entry has been removed. |
115 EXPECT_FALSE(dialog_controller_->GetMediaRouterDialog()); | 115 EXPECT_FALSE(dialog_controller_->GetMediaRouterDialog()); |
116 } | 116 } |
117 | 117 |
118 } // namespace media_router | 118 } // namespace media_router |
OLD | NEW |