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

Side by Side Diff: chrome/browser/notifications/notifications_interactive_uitest.cc

Issue 9372065: Update clients to use new TestServer constructor. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Remove files that were reviewed and committed separately. Created 8 years, 10 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/test/automation/automation_proxy.h" 5 #include "chrome/test/automation/automation_proxy.h"
6 #include "chrome/test/automation/browser_proxy.h" 6 #include "chrome/test/automation/browser_proxy.h"
7 #include "chrome/test/automation/tab_proxy.h" 7 #include "chrome/test/automation/tab_proxy.h"
8 #include "chrome/test/ui/ui_test.h" 8 #include "chrome/test/ui/ui_test.h"
9 #include "net/base/net_util.h" 9 #include "net/base/net_util.h"
10 #include "net/test/test_server.h" 10 #include "net/test/test_server.h"
11 11
12 class NotificationsPermissionTest : public UITest { 12 class NotificationsPermissionTest : public UITest {
13 public: 13 public:
14 NotificationsPermissionTest() { 14 NotificationsPermissionTest() {
15 dom_automation_enabled_ = true; 15 dom_automation_enabled_ = true;
16 show_window_ = true; 16 show_window_ = true;
17 } 17 }
18 }; 18 };
19 19
20 // Flaky, http://crbug.com/62311 and http://crbug.com/74428. 20 // Flaky, http://crbug.com/62311 and http://crbug.com/74428.
21 TEST_F(NotificationsPermissionTest, DISABLED_TestUserGestureInfobar) { 21 TEST_F(NotificationsPermissionTest, DISABLED_TestUserGestureInfobar) {
22 net::TestServer test_server(net::TestServer::TYPE_HTTP, 22 net::TestServer test_server(net::TestServer::TYPE_HTTP,
23 net::TestServer::kLocalhost,
23 FilePath(FILE_PATH_LITERAL("chrome/test/data"))); 24 FilePath(FILE_PATH_LITERAL("chrome/test/data")));
24 ASSERT_TRUE(test_server.Start()); 25 ASSERT_TRUE(test_server.Start());
25 26
26 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); 27 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
27 ASSERT_TRUE(browser.get()); 28 ASSERT_TRUE(browser.get());
28 scoped_refptr<TabProxy> tab(browser->GetActiveTab()); 29 scoped_refptr<TabProxy> tab(browser->GetActiveTab());
29 ASSERT_TRUE(tab.get()); 30 ASSERT_TRUE(tab.get());
30 ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, 31 ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS,
31 tab->NavigateToURL(test_server.GetURL( 32 tab->NavigateToURL(test_server.GetURL(
32 "files/notifications/notifications_request_function.html"))); 33 "files/notifications/notifications_request_function.html")));
33 WaitUntilTabCount(1); 34 WaitUntilTabCount(1);
34 35
35 // Request permission by calling request() while eval'ing an inline script; 36 // Request permission by calling request() while eval'ing an inline script;
36 // That's considered a user gesture to webkit, and should produce an infobar. 37 // That's considered a user gesture to webkit, and should produce an infobar.
37 bool result; 38 bool result;
38 ASSERT_TRUE(tab->ExecuteAndExtractBool( 39 ASSERT_TRUE(tab->ExecuteAndExtractBool(
39 L"", 40 L"",
40 L"window.domAutomationController.send(request());", 41 L"window.domAutomationController.send(request());",
41 &result)); 42 &result));
42 EXPECT_TRUE(result); 43 EXPECT_TRUE(result);
43 44
44 EXPECT_TRUE(tab->WaitForInfoBarCount(1)); 45 EXPECT_TRUE(tab->WaitForInfoBarCount(1));
45 } 46 }
46 47
47 // Flaky, http://crbug.com/62311. 48 // Flaky, http://crbug.com/62311.
48 TEST_F(NotificationsPermissionTest, DISABLED_TestNoUserGestureInfobar) { 49 TEST_F(NotificationsPermissionTest, DISABLED_TestNoUserGestureInfobar) {
49 net::TestServer test_server(net::TestServer::TYPE_HTTP, 50 net::TestServer test_server(net::TestServer::TYPE_HTTP,
51 net::TestServer::kLocalhost,
50 FilePath(FILE_PATH_LITERAL("chrome/test/data"))); 52 FilePath(FILE_PATH_LITERAL("chrome/test/data")));
51 ASSERT_TRUE(test_server.Start()); 53 ASSERT_TRUE(test_server.Start());
52 54
53 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); 55 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
54 ASSERT_TRUE(browser.get()); 56 ASSERT_TRUE(browser.get());
55 scoped_refptr<TabProxy> tab(browser->GetActiveTab()); 57 scoped_refptr<TabProxy> tab(browser->GetActiveTab());
56 ASSERT_TRUE(tab.get()); 58 ASSERT_TRUE(tab.get());
57 59
58 // Load a page which just does a request; no user gesture should result 60 // Load a page which just does a request; no user gesture should result
59 // in no infobar. 61 // in no infobar.
60 ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, 62 ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS,
61 tab->NavigateToURL(test_server.GetURL( 63 tab->NavigateToURL(test_server.GetURL(
62 "files/notifications/notifications_request_inline.html"))); 64 "files/notifications/notifications_request_inline.html")));
63 WaitUntilTabCount(1); 65 WaitUntilTabCount(1);
64 66
65 size_t info_bar_count; 67 size_t info_bar_count;
66 ASSERT_TRUE(tab->GetInfoBarCount(&info_bar_count)); 68 ASSERT_TRUE(tab->GetInfoBarCount(&info_bar_count));
67 EXPECT_EQ(0U, info_bar_count); 69 EXPECT_EQ(0U, info_bar_count);
68 } 70 }
OLDNEW
« no previous file with comments | « chrome/browser/infobars/infobars_uitest.cc ('k') | chrome/browser/prerender/prerender_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698