OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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 "chrome/browser/ui/webui/set_as_default_browser_ui_win.h" | 5 #include "chrome/browser/ui/webui/set_as_default_browser_ui_win.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/win/windows_version.h" | 8 #include "base/win/windows_version.h" |
9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
10 #include "chrome/browser/ui/browser_window.h" | 10 #include "chrome/browser/ui/browser_window.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 } | 21 } |
22 | 22 |
23 } // namespace | 23 } // namespace |
24 | 24 |
25 using SetAsDefaultBrowserUIBrowserTestWithoutFirstRun = InProcessBrowserTest; | 25 using SetAsDefaultBrowserUIBrowserTestWithoutFirstRun = InProcessBrowserTest; |
26 | 26 |
27 class SetAsDefaultBrowserUIBrowserTestWithFirstRun | 27 class SetAsDefaultBrowserUIBrowserTestWithFirstRun |
28 : public InProcessBrowserTest { | 28 : public InProcessBrowserTest { |
29 public: | 29 public: |
30 void SetUpCommandLine(base::CommandLine* command_line) override { | 30 void SetUpCommandLine(base::CommandLine* command_line) override { |
31 InProcessBrowserTest::SetUpCommandLine(command_line); | |
32 command_line->AppendSwitch(switches::kForceFirstRun); | 31 command_line->AppendSwitch(switches::kForceFirstRun); |
33 } | 32 } |
34 | 33 |
35 protected: | 34 protected: |
36 void TearDownInProcessBrowserTestFixture() override { | 35 void TearDownInProcessBrowserTestFixture() override { |
37 ASSERT_FALSE(SetAsDefaultBrowserUI::GetDialogWidgetForTesting()); | 36 ASSERT_FALSE(SetAsDefaultBrowserUI::GetDialogWidgetForTesting()); |
38 } | 37 } |
39 }; | 38 }; |
40 | 39 |
41 IN_PROC_BROWSER_TEST_F(SetAsDefaultBrowserUIBrowserTestWithFirstRun, Test) { | 40 IN_PROC_BROWSER_TEST_F(SetAsDefaultBrowserUIBrowserTestWithFirstRun, Test) { |
42 // Windows 8 only test case. | 41 // Windows 8 only test case. |
43 if (base::win::GetVersion() != base::win::VERSION_WIN8 && | 42 if (base::win::GetVersion() != base::win::VERSION_WIN8 && |
44 base::win::GetVersion() != base::win::VERSION_WIN8_1) { | 43 base::win::GetVersion() != base::win::VERSION_WIN8_1) { |
45 return; | 44 return; |
46 } | 45 } |
47 ASSERT_FALSE(IsBrowserVisible(browser())); | 46 ASSERT_FALSE(IsBrowserVisible(browser())); |
48 views::Widget* dialog_widget = | 47 views::Widget* dialog_widget = |
49 SetAsDefaultBrowserUI::GetDialogWidgetForTesting(); | 48 SetAsDefaultBrowserUI::GetDialogWidgetForTesting(); |
50 ASSERT_TRUE(dialog_widget); | 49 ASSERT_TRUE(dialog_widget); |
51 ASSERT_TRUE(dialog_widget->IsVisible()); | 50 ASSERT_TRUE(dialog_widget->IsVisible()); |
52 dialog_widget->CloseNow(); | 51 dialog_widget->CloseNow(); |
53 ASSERT_TRUE(IsBrowserVisible(browser())); | 52 ASSERT_TRUE(IsBrowserVisible(browser())); |
54 } | 53 } |
55 | 54 |
56 IN_PROC_BROWSER_TEST_F(SetAsDefaultBrowserUIBrowserTestWithoutFirstRun, | 55 IN_PROC_BROWSER_TEST_F(SetAsDefaultBrowserUIBrowserTestWithoutFirstRun, |
57 TestWithoutFirstRun) { | 56 TestWithoutFirstRun) { |
58 ASSERT_TRUE(IsBrowserVisible(browser())); | 57 ASSERT_TRUE(IsBrowserVisible(browser())); |
59 EXPECT_EQ(nullptr, SetAsDefaultBrowserUI::GetDialogWidgetForTesting()); | 58 EXPECT_EQ(nullptr, SetAsDefaultBrowserUI::GetDialogWidgetForTesting()); |
60 } | 59 } |
OLD | NEW |