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

Side by Side Diff: chrome/test/gpu/webgl_infobar_browsertest.cc

Issue 22694006: Infobar system refactor. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 2 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 | Annotate | Revision Log
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 "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 22 matching lines...) Expand all
42 GURL(content::kChromeUIGpuCrashURL), 43 GURL(content::kChromeUIGpuCrashURL),
43 static_cast<content::PageTransition>( 44 static_cast<content::PageTransition>(
44 content::PAGE_TRANSITION_TYPED | 45 content::PAGE_TRANSITION_TYPED |
45 content::PAGE_TRANSITION_FROM_ADDRESS_BAR)); 46 content::PAGE_TRANSITION_FROM_ADDRESS_BAR));
46 params.disposition = NEW_BACKGROUND_TAB; 47 params.disposition = NEW_BACKGROUND_TAB;
47 chrome::Navigate(&params); 48 chrome::Navigate(&params);
48 } 49 }
49 50
50 } // namespace 51 } // namespace
51 52
52 class WebGLInfobarTest : public InProcessBrowserTest { 53 class WebGLInfoBarTest : public InProcessBrowserTest {
53 protected: 54 protected:
54 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { 55 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE {
55 base::FilePath test_dir; 56 base::FilePath test_dir;
56 ASSERT_TRUE(PathService::Get(content::DIR_TEST_DATA, &test_dir)); 57 ASSERT_TRUE(PathService::Get(content::DIR_TEST_DATA, &test_dir));
57 gpu_test_dir_ = test_dir.AppendASCII("gpu"); 58 gpu_test_dir_ = test_dir.AppendASCII("gpu");
58 } 59 }
59 base::FilePath gpu_test_dir_; 60 base::FilePath gpu_test_dir_;
60 }; 61 };
61 62
62 IN_PROC_BROWSER_TEST_F(WebGLInfobarTest, ContextLossRaisesInfobar) { 63 IN_PROC_BROWSER_TEST_F(WebGLInfoBarTest, ContextLossRaisesInfoBar) {
63 #if defined(OS_WIN) && defined(USE_ASH) 64 #if defined(OS_WIN) && defined(USE_ASH)
64 // Disable this test in Metro+Ash for now (http://crbug.com/262796). 65 // Disable this test in Metro+Ash for now (http://crbug.com/262796).
65 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) 66 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests))
66 return; 67 return;
67 #endif 68 #endif
68 69
69 if (gpu::GPUTestBotConfig::CurrentConfigMatches("XP")) 70 if (gpu::GPUTestBotConfig::CurrentConfigMatches("XP"))
70 return; 71 return;
71 72
72 // Load page and wait for it to load. 73 // Load page and wait for it to load.
(...skipping 10 matching lines...) Expand all
83 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED, 84 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED,
84 content::NotificationService::AllSources()); 85 content::NotificationService::AllSources());
85 SimulateGPUCrash(browser()); 86 SimulateGPUCrash(browser());
86 infobar_added.Wait(); 87 infobar_added.Wait();
87 EXPECT_EQ(1u, 88 EXPECT_EQ(1u,
88 InfoBarService::FromWebContents( 89 InfoBarService::FromWebContents(
89 browser()->tab_strip_model()->GetActiveWebContents())-> 90 browser()->tab_strip_model()->GetActiveWebContents())->
90 infobar_count()); 91 infobar_count());
91 } 92 }
92 93
93 IN_PROC_BROWSER_TEST_F(WebGLInfobarTest, ContextLossInfobarReload) { 94 IN_PROC_BROWSER_TEST_F(WebGLInfoBarTest, ContextLossInfoBarReload) {
94 #if defined(OS_WIN) && defined(USE_ASH) 95 #if defined(OS_WIN) && defined(USE_ASH)
95 // Disable this test in Metro+Ash for now (http://crbug.com/262796). 96 // Disable this test in Metro+Ash for now (http://crbug.com/262796).
96 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) 97 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests))
97 return; 98 return;
98 #endif 99 #endif
99 100
100 if (gpu::GPUTestBotConfig::CurrentConfigMatches("XP")) 101 if (gpu::GPUTestBotConfig::CurrentConfigMatches("XP"))
101 return; 102 return;
102 103
103 content::DOMMessageQueue message_queue; 104 content::DOMMessageQueue message_queue;
(...skipping 16 matching lines...) Expand all
120 message_queue.ClearQueue(); 121 message_queue.ClearQueue();
121 122
122 content::WindowedNotificationObserver infobar_added( 123 content::WindowedNotificationObserver infobar_added(
123 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED, 124 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED,
124 content::NotificationService::AllSources()); 125 content::NotificationService::AllSources());
125 SimulateGPUCrash(browser()); 126 SimulateGPUCrash(browser());
126 infobar_added.Wait(); 127 infobar_added.Wait();
127 InfoBarService* infobar_service = InfoBarService::FromWebContents( 128 InfoBarService* infobar_service = InfoBarService::FromWebContents(
128 browser()->tab_strip_model()->GetActiveWebContents()); 129 browser()->tab_strip_model()->GetActiveWebContents());
129 ASSERT_EQ(1u, infobar_service->infobar_count()); 130 ASSERT_EQ(1u, infobar_service->infobar_count());
130 InfoBarDelegate* delegate = infobar_service->infobar_at(0); 131 InfoBarDelegate* delegate = infobar_service->infobar_at(0)->delegate();
131 ASSERT_TRUE(delegate->AsThreeDAPIInfoBarDelegate()); 132 ASSERT_TRUE(delegate->AsThreeDAPIInfoBarDelegate());
132 delegate->AsConfirmInfoBarDelegate()->Cancel(); 133 delegate->AsConfirmInfoBarDelegate()->Cancel();
133 134
134 // The page should reload and another message sent to the 135 // The page should reload and another message sent to the
135 // DomAutomationController. 136 // DomAutomationController.
136 m.clear(); 137 m.clear();
137 ASSERT_TRUE(message_queue.WaitForMessage(&m)); 138 ASSERT_TRUE(message_queue.WaitForMessage(&m));
138 EXPECT_EQ("\"LOADED\"", m); 139 EXPECT_EQ("\"LOADED\"", m);
139 } 140 }
140 141
141 // There isn't any point in adding a test which calls Accept() on the 142 // There isn't any point in adding a test which calls Accept() on the
142 // ThreeDAPIInfoBarDelegate; doing so doesn't remove the infobar, and 143 // ThreeDAPIInfoBarDelegate; doing so doesn't remove the infobar, and
143 // there's no concrete event that could be observed in response. 144 // there's no concrete event that could be observed in response.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698