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

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: cr Created 4 years, 4 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 public:
30 void SetUpCommandLine(base::CommandLine* command_line) override {
31 InProcessBrowserTest::SetUpCommandLine(command_line);
32 command_line->AppendSwitch(switches::kForceFirstRun);
33 }
34
35 protected:
36 void TearDownInProcessBrowserTestFixture() override {
37 ASSERT_FALSE(SetAsDefaultBrowserUI::GetDialogWidgetForTesting());
38 }
39 };
40
41 IN_PROC_BROWSER_TEST_F(SetAsDefaultBrowserUIBrowserTestWithFirstRun, Test) {
42 // Windows 8 only test case.
43 if (base::win::GetVersion() <= base::win::VERSION_WIN7 ||
44 base::win::GetVersion() >= base::win::VERSION_WIN10) {
45 return;
46 }
47 ASSERT_FALSE(IsBrowserVisible(browser()));
48 views::Widget* dialog_widget =
49 SetAsDefaultBrowserUI::GetDialogWidgetForTesting();
50 ASSERT_TRUE(dialog_widget);
51 ASSERT_TRUE(dialog_widget->IsVisible());
52 dialog_widget->CloseNow();
53 ASSERT_TRUE(IsBrowserVisible(browser()));
54 }
55
56 IN_PROC_BROWSER_TEST_F(SetAsDefaultBrowserUIBrowserTestWithoutFirstRun,
57 TestWithoutFirstRun) {
58 ASSERT_TRUE(IsBrowserVisible(browser()));
59 EXPECT_EQ(nullptr, SetAsDefaultBrowserUI::GetDialogWidgetForTesting());
60 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/set_as_default_browser_ui.cc ('k') | chrome/browser/ui/webui/set_as_default_browser_ui_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698