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

Side by Side Diff: chrome/browser/ui/webui/set_as_default_browser_ui_browsertest.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.h"
sky 2016/07/06 19:21:19 As this file is win only please name it as such.
zmin 2016/07/06 20:04:31 You mean the name of all three files, not just the
sky 2016/07/06 23:53:16 Good point. I had only thtought this file was win,
zmin 2016/07/18 21:12:14 Done.
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 class SetAsDefaultBrowserUIBrowserTest : public InProcessBrowserTest {
16 protected:
17 bool IsMainWindowVisible() {
sky 2016/07/06 19:21:19 You shouldn't need a subclass just for this functi
zmin 2016/07/06 20:04:31 Done.
18 return views::Widget::GetWidgetForNativeWindow(
19 browser()->window()->GetNativeWindow())
20 ->IsVisible();
21 }
22 };
23
24 class SetAsDefaultBrowserUIBrowserTestWithFirstRun
25 : public SetAsDefaultBrowserUIBrowserTest {
26 void SetUpCommandLine(base::CommandLine* command_line) override {
27 InProcessBrowserTest::SetUpCommandLine(command_line);
28 command_line->AppendSwitch(switches::kForceFirstRun);
29 }
30 };
31
32 IN_PROC_BROWSER_TEST_F(SetAsDefaultBrowserUIBrowserTestWithFirstRun, Test) {
33 // Windows 8 only test case.
34 if (base::win::GetVersion() <= base::win::VERSION_WIN7 ||
35 base::win::GetVersion() >= base::win::VERSION_WIN10) {
36 return;
37 }
38 ASSERT_FALSE(IsMainWindowVisible());
39 views::Widget* dialog_widget =
40 SetAsDefaultBrowserUI::GetDialogWidgetForTesting();
41 EXPECT_NE(nullptr, dialog_widget);
sky 2016/07/06 19:21:19 ASSERT_TRUE(dialog_widget), otherwise if dialog_wi
zmin 2016/07/06 20:04:31 Done.
42 dialog_widget->CloseNow();
43 ASSERT_TRUE(IsMainWindowVisible());
44 }
45
46 IN_PROC_BROWSER_TEST_F(SetAsDefaultBrowserUIBrowserTest, TestWithoutFirstRun) {
47 ASSERT_TRUE(IsMainWindowVisible());
48 EXPECT_EQ(nullptr, SetAsDefaultBrowserUI::GetDialogWidgetForTesting());
49 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698