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/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "chrome/browser/infobars/confirm_infobar_delegate.h" | 8 #include "chrome/browser/infobars/confirm_infobar_delegate.h" |
9 #include "chrome/browser/infobars/infobar_service.h" | 9 #include "chrome/browser/infobars/infobar_service.h" |
10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 observer.Wait(); | 80 observer.Wait(); |
81 | 81 |
82 content::WindowedNotificationObserver infobar_added( | 82 content::WindowedNotificationObserver infobar_added( |
83 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED, | 83 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED, |
84 content::NotificationService::AllSources()); | 84 content::NotificationService::AllSources()); |
85 SimulateGPUCrash(browser()); | 85 SimulateGPUCrash(browser()); |
86 infobar_added.Wait(); | 86 infobar_added.Wait(); |
87 EXPECT_EQ(1u, | 87 EXPECT_EQ(1u, |
88 InfoBarService::FromWebContents( | 88 InfoBarService::FromWebContents( |
89 browser()->tab_strip_model()->GetActiveWebContents())-> | 89 browser()->tab_strip_model()->GetActiveWebContents())-> |
90 GetInfoBarCount()); | 90 infobar_count()); |
91 } | 91 } |
92 | 92 |
93 IN_PROC_BROWSER_TEST_F(WebGLInfobarTest, ContextLossInfobarReload) { | 93 IN_PROC_BROWSER_TEST_F(WebGLInfobarTest, ContextLossInfobarReload) { |
94 if (GPUTestBotConfig::CurrentConfigMatches("XP")) | 94 if (GPUTestBotConfig::CurrentConfigMatches("XP")) |
95 return; | 95 return; |
96 | 96 |
97 content::DOMMessageQueue message_queue; | 97 content::DOMMessageQueue message_queue; |
98 | 98 |
99 // Load page and wait for it to load. | 99 // Load page and wait for it to load. |
100 content::WindowedNotificationObserver observer( | 100 content::WindowedNotificationObserver observer( |
(...skipping 10 matching lines...) Expand all Loading... |
111 ASSERT_TRUE(message_queue.WaitForMessage(&m)); | 111 ASSERT_TRUE(message_queue.WaitForMessage(&m)); |
112 EXPECT_EQ("\"LOADED\"", m); | 112 EXPECT_EQ("\"LOADED\"", m); |
113 | 113 |
114 message_queue.ClearQueue(); | 114 message_queue.ClearQueue(); |
115 | 115 |
116 content::WindowedNotificationObserver infobar_added( | 116 content::WindowedNotificationObserver infobar_added( |
117 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED, | 117 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED, |
118 content::NotificationService::AllSources()); | 118 content::NotificationService::AllSources()); |
119 SimulateGPUCrash(browser()); | 119 SimulateGPUCrash(browser()); |
120 infobar_added.Wait(); | 120 infobar_added.Wait(); |
121 EXPECT_EQ(1u, | 121 InfoBarService* infobar_service = InfoBarService::FromWebContents( |
122 InfoBarService::FromWebContents( | 122 browser()->tab_strip_model()->GetActiveWebContents()); |
123 browser()->tab_strip_model()->GetActiveWebContents())-> | 123 EXPECT_EQ(1u, infobar_service->infobar_count()); |
124 GetInfoBarCount()); | 124 InfoBarDelegate* delegate = infobar_service->infobar_at(0); |
125 InfoBarDelegate* delegate = InfoBarService::FromWebContents( | |
126 browser()->tab_strip_model()->GetActiveWebContents())-> | |
127 GetInfoBarDelegateAt(0); | |
128 ASSERT_TRUE(delegate); | 125 ASSERT_TRUE(delegate); |
129 ASSERT_TRUE(delegate->AsThreeDAPIInfoBarDelegate()); | 126 ASSERT_TRUE(delegate->AsThreeDAPIInfoBarDelegate()); |
130 delegate->AsConfirmInfoBarDelegate()->Cancel(); | 127 delegate->AsConfirmInfoBarDelegate()->Cancel(); |
131 | 128 |
132 // The page should reload and another message sent to the | 129 // The page should reload and another message sent to the |
133 // DomAutomationController. | 130 // DomAutomationController. |
134 m = ""; | 131 m = ""; |
135 ASSERT_TRUE(message_queue.WaitForMessage(&m)); | 132 ASSERT_TRUE(message_queue.WaitForMessage(&m)); |
136 EXPECT_EQ("\"LOADED\"", m); | 133 EXPECT_EQ("\"LOADED\"", m); |
137 } | 134 } |
138 | 135 |
139 // There isn't any point in adding a test which calls Accept() on the | 136 // There isn't any point in adding a test which calls Accept() on the |
140 // ThreeDAPIInfoBarDelegate; doing so doesn't remove the infobar, and | 137 // ThreeDAPIInfoBarDelegate; doing so doesn't remove the infobar, and |
141 // there's no concrete event that could be observed in response. | 138 // there's no concrete event that could be observed in response. |
OLD | NEW |