OLD | NEW |
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 "base/path_service.h" | 6 #include "base/path_service.h" |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "chrome/browser/chrome_notification_types.h" | 8 #include "chrome/browser/chrome_notification_types.h" |
9 #include "chrome/browser/infobars/confirm_infobar_delegate.h" | 9 #include "chrome/browser/infobars/confirm_infobar_delegate.h" |
| 10 #include "chrome/browser/infobars/infobar.h" |
10 #include "chrome/browser/infobars/infobar_service.h" | 11 #include "chrome/browser/infobars/infobar_service.h" |
11 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
12 #include "chrome/browser/ui/browser_commands.h" | 13 #include "chrome/browser/ui/browser_commands.h" |
13 #include "chrome/browser/ui/browser_navigator.h" | 14 #include "chrome/browser/ui/browser_navigator.h" |
14 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 15 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
15 #include "chrome/common/chrome_paths.h" | 16 #include "chrome/common/chrome_paths.h" |
16 #include "chrome/common/chrome_switches.h" | 17 #include "chrome/common/chrome_switches.h" |
17 #include "chrome/common/url_constants.h" | 18 #include "chrome/common/url_constants.h" |
18 #include "chrome/test/base/in_process_browser_test.h" | 19 #include "chrome/test/base/in_process_browser_test.h" |
19 #include "chrome/test/base/test_launcher_utils.h" | 20 #include "chrome/test/base/test_launcher_utils.h" |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 message_queue.ClearQueue(); | 128 message_queue.ClearQueue(); |
128 | 129 |
129 content::WindowedNotificationObserver infobar_added( | 130 content::WindowedNotificationObserver infobar_added( |
130 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED, | 131 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED, |
131 content::NotificationService::AllSources()); | 132 content::NotificationService::AllSources()); |
132 SimulateGPUCrash(browser()); | 133 SimulateGPUCrash(browser()); |
133 infobar_added.Wait(); | 134 infobar_added.Wait(); |
134 InfoBarService* infobar_service = InfoBarService::FromWebContents( | 135 InfoBarService* infobar_service = InfoBarService::FromWebContents( |
135 browser()->tab_strip_model()->GetActiveWebContents()); | 136 browser()->tab_strip_model()->GetActiveWebContents()); |
136 ASSERT_EQ(1u, infobar_service->infobar_count()); | 137 ASSERT_EQ(1u, infobar_service->infobar_count()); |
137 InfoBarDelegate* delegate = infobar_service->infobar_at(0); | 138 InfoBarDelegate* delegate = infobar_service->infobar_at(0)->delegate(); |
138 ASSERT_TRUE(delegate->AsThreeDAPIInfoBarDelegate()); | 139 ASSERT_TRUE(delegate->AsThreeDAPIInfoBarDelegate()); |
139 delegate->AsConfirmInfoBarDelegate()->Cancel(); | 140 delegate->AsConfirmInfoBarDelegate()->Cancel(); |
140 | 141 |
141 // The page should reload and another message sent to the | 142 // The page should reload and another message sent to the |
142 // DomAutomationController. | 143 // DomAutomationController. |
143 m.clear(); | 144 m.clear(); |
144 ASSERT_TRUE(message_queue.WaitForMessage(&m)); | 145 ASSERT_TRUE(message_queue.WaitForMessage(&m)); |
145 EXPECT_EQ("\"LOADED\"", m); | 146 EXPECT_EQ("\"LOADED\"", m); |
146 } | 147 } |
147 | 148 |
148 // There isn't any point in adding a test which calls Accept() on the | 149 // There isn't any point in adding a test which calls Accept() on the |
149 // ThreeDAPIInfoBarDelegate; doing so doesn't remove the infobar, and | 150 // ThreeDAPIInfoBarDelegate; doing so doesn't remove the infobar, and |
150 // there's no concrete event that could be observed in response. | 151 // there's no concrete event that could be observed in response. |
OLD | NEW |