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

Side by Side Diff: chrome/browser/first_run/try_chrome_dialog_view_browsertest.cc

Issue 2816293002: Description: Replace layout constants in chrome/browser/extensions and chrome/browser/first_run (Closed)
Patch Set: Update DEPS Created 3 years, 8 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/command_line.h" 5 #include "base/command_line.h"
6 #include "build/build_config.h" 6 #include "build/build_config.h"
7 #include "chrome/browser/ui/test/test_browser_dialog.h"
7 #include "chrome/common/chrome_result_codes.h" 8 #include "chrome/common/chrome_result_codes.h"
8 #include "chrome/common/chrome_switches.h" 9 #include "chrome/common/chrome_switches.h"
9 #include "chrome/test/base/in_process_browser_test.h" 10 #include "chrome/test/base/in_process_browser_test.h"
11 #include "ui/base/ui_base_switches.h"
10 12
11 // Unfortunately, this needs to be Windows only for now. Even though this test 13 // Unfortunately, this needs to be Windows only for now. Even though this test
12 // is meant to exercise code that is for Windows only, it is a good general 14 // is meant to exercise code that is for Windows only, it is a good general
13 // canary in the coal mine for problems related to early shutdown (aborted 15 // canary in the coal mine for problems related to early shutdown (aborted
14 // startup). Sadly, it times out on platforms other than Windows, so I can't 16 // startup). Sadly, it times out on platforms other than Windows, so I can't
15 // enable it for those platforms at the moment. I hope one day our test harness 17 // enable it for those platforms at the moment. I hope one day our test harness
16 // will be improved to support this so we can get coverage on other platforms. 18 // will be improved to support this so we can get coverage on other platforms.
17 // See http://crbug.com/45115 for details. 19 // See http://crbug.com/45115 for details.
18 #if defined(OS_WIN) 20 #if defined(OS_WIN)
21 #include "chrome/browser/ui/views/try_chrome_dialog_view.h"
19 22
20 // By passing kTryChromeAgain with a magic value > 10000 we cause Chrome 23 // By passing kTryChromeAgain with a magic value > 10000 we cause Chrome
21 // to exit fairly early. 24 // to exit fairly early.
22 // Quickly exiting Chrome (regardless of this particular flag -- it 25 // Quickly exiting Chrome (regardless of this particular flag -- it
23 // doesn't do anything other than cause Chrome to quit on startup on 26 // doesn't do anything other than cause Chrome to quit on startup on
24 // non-Windows) was a cause of crashes (see bug 34799 for example) so 27 // non-Windows) was a cause of crashes (see bug 34799 for example) so
25 // this is a useful test of the startup/quick-shutdown cycle. 28 // this is a useful test of the startup/quick-shutdown cycle.
26 class TryChromeDialogBrowserTest : public InProcessBrowserTest { 29 class TryChromeDialogBrowserTest : public InProcessBrowserTest {
27 public: 30 public:
28 TryChromeDialogBrowserTest() { 31 TryChromeDialogBrowserTest() {
(...skipping 19 matching lines...) Expand all
48 // Run chrome.exe --try-chrome-again=10001. This is all that the test does and 51 // Run chrome.exe --try-chrome-again=10001. This is all that the test does and
49 // should be enough to trigger the failure. If it is a crash (most likely) then 52 // should be enough to trigger the failure. If it is a crash (most likely) then
50 // look at the callstack and see if any of the components have been touched 53 // look at the callstack and see if any of the components have been touched
51 // recently. Look at recent changes to startup, such as any change to 54 // recently. Look at recent changes to startup, such as any change to
52 // ChromeBrowserMainParts, specifically PreCreateThreadsImpl and see if someone 55 // ChromeBrowserMainParts, specifically PreCreateThreadsImpl and see if someone
53 // has been reordering code blocks for startup. Try reverting any suspicious 56 // has been reordering code blocks for startup. Try reverting any suspicious
54 // changes to see if it affects the test. History shows that waiting until later 57 // changes to see if it affects the test. History shows that waiting until later
55 // only makes the problem worse. 58 // only makes the problem worse.
56 IN_PROC_BROWSER_TEST_F(TryChromeDialogBrowserTest, ToastCrasher) {} 59 IN_PROC_BROWSER_TEST_F(TryChromeDialogBrowserTest, ToastCrasher) {}
57 60
61 // Helper class to display the TryChromeDialog for testing.
62 class TryChromeDialogTest : public DialogBrowserTest {
63 public:
64 TryChromeDialogTest() {}
65
66 static void SetActiveModalDialog(gfx::NativeWindow active_dialog) {}
67
68 // DialogBrowserTest:
69 void ShowDialog(const std::string& name) override {
70 TryChromeDialogView::Show(
71 1000, base::Bind(&TryChromeDialogTest::SetActiveModalDialog));
Peter Kasting 2017/04/27 01:08:05 It looks to me like instead of passing 1000 here,
ananta 2017/04/27 01:29:52 Yeah. Sorry about that. I was chatting with Greg.
72 }
73
74 // content::BrowserTestBase:
75 void SetUpCommandLine(base::CommandLine* command_line) override {
76 command_line->AppendSwitch(switches::kExtendMdToSecondaryUi);
77 }
78
79 private:
80 DISALLOW_COPY_AND_ASSIGN(TryChromeDialogTest);
81 };
82
83 // Test that calls ShowDialog("default"). Interactive when run via
84 // browser_tests --gtest_filter=BrowserDialogTest.Invoke --interactive
85 // --dialog=TryChromeDialogTest.InvokeDialog_default
Peter Kasting 2017/04/27 01:08:05 Nit: Looks like most other test files omit this co
ananta 2017/04/27 01:29:52 Done.
86 IN_PROC_BROWSER_TEST_F(TryChromeDialogTest, InvokeDialog_default) {
87 RunDialog();
88 }
89
58 #endif // defined(OS_WIN) 90 #endif // defined(OS_WIN)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698