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

Side by Side Diff: chrome/browser/ui/webui/print_preview/print_preview_ui_browsertest.cc

Issue 1924683003: [making a diff] Remove the old task manager view (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: delete disabled tests Created 4 years, 7 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/strings/utf_string_conversions.h" 5 #include "base/strings/utf_string_conversions.h"
6 #include "build/build_config.h" 6 #include "build/build_config.h"
7 #include "chrome/app/chrome_command_ids.h" 7 #include "chrome/app/chrome_command_ids.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/task_manager/task_manager_browsertest_util.h"
10 #include "chrome/browser/ui/browser.h" 9 #include "chrome/browser/ui/browser.h"
11 #include "chrome/browser/ui/browser_commands.h" 10 #include "chrome/browser/ui/browser_commands.h"
12 #include "chrome/browser/ui/browser_dialogs.h" 11 #include "chrome/browser/ui/browser_dialogs.h"
13 #include "chrome/browser/ui/tabs/tab_strip_model.h" 12 #include "chrome/browser/ui/tabs/tab_strip_model.h"
14 #include "chrome/common/url_constants.h" 13 #include "chrome/common/url_constants.h"
15 #include "chrome/test/base/in_process_browser_test.h" 14 #include "chrome/test/base/in_process_browser_test.h"
16 #include "chrome/test/base/ui_test_utils.h" 15 #include "chrome/test/base/ui_test_utils.h"
17 #include "components/content_settings/core/browser/host_content_settings_map.h" 16 #include "components/content_settings/core/browser/host_content_settings_map.h"
18 #include "components/prefs/pref_service.h" 17 #include "components/prefs/pref_service.h"
19 #include "content/public/browser/web_contents.h" 18 #include "content/public/browser/web_contents.h"
20 #include "content/public/browser/web_contents_observer.h" 19 #include "content/public/browser/web_contents_observer.h"
21 #include "content/public/test/browser_test_utils.h" 20 #include "content/public/test/browser_test_utils.h"
22 #include "content/public/test/test_navigation_observer.h" 21 #include "content/public/test/test_navigation_observer.h"
23 #include "content/public/test/test_utils.h" 22 #include "content/public/test/test_utils.h"
24 #include "url/url_constants.h" 23 #include "url/url_constants.h"
25 24
26 #if defined(OS_WIN) 25 #if defined(OS_WIN)
27 #include "ui/aura/window.h" 26 #include "ui/aura/window.h"
28 #include "ui/aura/window_tree_host.h" 27 #include "ui/aura/window_tree_host.h"
29 #endif 28 #endif
30 29
31 using task_manager::browsertest_util::MatchAboutBlankTab;
32 using task_manager::browsertest_util::MatchAnyPrint;
33 using task_manager::browsertest_util::MatchAnyTab;
34 using task_manager::browsertest_util::MatchPrint;
35 using task_manager::browsertest_util::WaitForTaskManagerRows;
36
37 namespace { 30 namespace {
38 31
39 class PrintPreviewTest : public InProcessBrowserTest { 32 class PrintPreviewTest : public InProcessBrowserTest {
40 public: 33 public:
41 PrintPreviewTest() {} 34 PrintPreviewTest() {}
42 35
43 void Print() { 36 void Print() {
44 content::TestNavigationObserver nav_observer(NULL); 37 content::TestNavigationObserver nav_observer(NULL);
45 nav_observer.StartWatchingNewWebContents(); 38 nav_observer.StartWatchingNewWebContents();
46 chrome::ExecuteCommand(browser(), IDC_PRINT); 39 chrome::ExecuteCommand(browser(), IDC_PRINT);
(...skipping 30 matching lines...) Expand all
77 browser()->tab_strip_model()->GetActiveWebContents()); 70 browser()->tab_strip_model()->GetActiveWebContents());
78 chrome::Reload(browser(), CURRENT_TAB); 71 chrome::Reload(browser(), CURRENT_TAB);
79 reload_observer.Wait(); 72 reload_observer.Wait();
80 73
81 ASSERT_TRUE(chrome::IsCommandEnabled(browser(), IDC_PRINT)); 74 ASSERT_TRUE(chrome::IsCommandEnabled(browser(), IDC_PRINT));
82 75
83 ASSERT_EQ(is_basic_print_expected, 76 ASSERT_EQ(is_basic_print_expected,
84 chrome::IsCommandEnabled(browser(), IDC_BASIC_PRINT)); 77 chrome::IsCommandEnabled(browser(), IDC_BASIC_PRINT));
85 } 78 }
86 79
87 // Disable the test for mac, see http://crbug/367665.
88 #if defined(OS_MACOSX) || defined(OS_LINUX)
89 #define MAYBE_TaskManagerNewPrintPreview DISABLED_TaskManagerNewPrintPreview
90 #else
91 #define MAYBE_TaskManagerNewPrintPreview TaskManagerNewPrintPreview
92 #endif
93 IN_PROC_BROWSER_TEST_F(PrintPreviewTest, MAYBE_TaskManagerNewPrintPreview) {
94 // This test is for the old implementation of the task manager. We must
95 // explicitly disable the new one.
96 task_manager::browsertest_util::EnableOldTaskManager();
97
98 chrome::ShowTaskManager(browser()); // Show task manager BEFORE print dialog.
99
100 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAboutBlankTab()));
101 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab()));
102 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(0, MatchAnyPrint()));
103
104 // Create the print preview dialog.
105 Print();
106
107 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAboutBlankTab()));
108 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab()));
109 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyPrint()));
110 ASSERT_NO_FATAL_FAILURE(
111 WaitForTaskManagerRows(1, MatchPrint(url::kAboutBlankURL)));
112 }
113
114 // http://crbug/367665.
115 IN_PROC_BROWSER_TEST_F(PrintPreviewTest,
116 DISABLED_TaskManagerExistingPrintPreview) {
117 // This test is for the old implementation of the task manager. We must
118 // explicitly disable the new one.
119 task_manager::browsertest_util::EnableOldTaskManager();
120
121 // Create the print preview dialog.
122 Print();
123
124 chrome::ShowTaskManager(browser()); // Show task manager AFTER print dialog.
125
126 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAboutBlankTab()));
127 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab()));
128 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyPrint()));
129 ASSERT_NO_FATAL_FAILURE(
130 WaitForTaskManagerRows(1, MatchPrint(url::kAboutBlankURL)));
131 }
132
133 #if defined(OS_WIN) 80 #if defined(OS_WIN)
134 // http://crbug.com/396360 81 // http://crbug.com/396360
135 IN_PROC_BROWSER_TEST_F(PrintPreviewTest, DISABLED_NoCrashOnCloseWithOtherTabs) { 82 IN_PROC_BROWSER_TEST_F(PrintPreviewTest, DISABLED_NoCrashOnCloseWithOtherTabs) {
136 // Now print preview. 83 // Now print preview.
137 Print(); 84 Print();
138 85
139 ui_test_utils::NavigateToURLWithDisposition( 86 ui_test_utils::NavigateToURLWithDisposition(
140 browser(), GURL("about:blank"), NEW_FOREGROUND_TAB, 87 browser(), GURL("about:blank"), NEW_FOREGROUND_TAB,
141 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); 88 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
142 89
143 browser()->tab_strip_model()->ActivateTabAt(0, true); 90 browser()->tab_strip_model()->ActivateTabAt(0, true);
144 91
145 // Navigate main tab to hide print preview. 92 // Navigate main tab to hide print preview.
146 ui_test_utils::NavigateToURL(browser(), GURL("about:blank")); 93 ui_test_utils::NavigateToURL(browser(), GURL("about:blank"));
147 94
148 browser()->tab_strip_model()->ActivateTabAt(1, true); 95 browser()->tab_strip_model()->ActivateTabAt(1, true);
149 } 96 }
150 #endif // defined(OS_WIN) 97 #endif // defined(OS_WIN)
151 98
152 } // namespace 99 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698