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

Side by Side Diff: chrome/browser/ui/webui/set_as_default_browser_ui_browsertest_win.cc

Issue 2090773002: Improves first run dialog performance on Win8 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/ui/webui/set_as_default_browser_ui_win.h"
6
7 #include "base/command_line.h"
8 #include "base/win/windows_version.h"
9 #include "chrome/browser/ui/browser.h"
10 #include "chrome/browser/ui/browser_window.h"
11 #include "chrome/common/chrome_switches.h"
12 #include "chrome/test/base/in_process_browser_test.h"
13 #include "ui/views/widget/widget.h"
14
15 namespace {
16
17 bool IsBrowserVisible(Browser* browser) {
18 return views::Widget::GetWidgetForNativeWindow(
19 browser->window()->GetNativeWindow())
20 ->IsVisible();
21 }
22
23 } // namespace
24
25 using SetAsDefaultBrowserUIBrowserTestWithoutFirstRun = InProcessBrowserTest;
26
27 class SetAsDefaultBrowserUIBrowserTestWithFirstRun
28 : public InProcessBrowserTest {
29 void SetUpCommandLine(base::CommandLine* command_line) override {
grt (UTC plus 2) 2016/07/19 08:13:01 nit: retain the visibility of these methods. Brows
zmin 2016/07/20 16:35:45 Done.
30 InProcessBrowserTest::SetUpCommandLine(command_line);
31 command_line->AppendSwitch(switches::kForceFirstRun);
32 }
33 void TearDownInProcessBrowserTestFixture() override {
34 ASSERT_FALSE(SetAsDefaultBrowserUI::GetDialogWidgetForTesting());
35 }
36 };
37
38 IN_PROC_BROWSER_TEST_F(SetAsDefaultBrowserUIBrowserTestWithFirstRun, Test) {
39 // Windows 8 only test case.
40 if (base::win::GetVersion() <= base::win::VERSION_WIN7 ||
41 base::win::GetVersion() >= base::win::VERSION_WIN10) {
42 return;
43 }
44 ASSERT_FALSE(IsBrowserVisible(browser()));
45 views::Widget* dialog_widget =
46 SetAsDefaultBrowserUI::GetDialogWidgetForTesting();
47 ASSERT_TRUE(dialog_widget);
48 ASSERT_TRUE(dialog_widget->IsVisible());
49 dialog_widget->CloseNow();
50 ASSERT_TRUE(IsBrowserVisible(browser()));
51 }
52
53 IN_PROC_BROWSER_TEST_F(SetAsDefaultBrowserUIBrowserTestWithoutFirstRun,
54 TestWithoutFirstRun) {
55 ASSERT_TRUE(IsBrowserVisible(browser()));
56 EXPECT_EQ(nullptr, SetAsDefaultBrowserUI::GetDialogWidgetForTesting());
57 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698