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

Side by Side Diff: chrome/test/nacl/pnacl_header_test.cc

Issue 63433002: Reenable PnaclHeaderTest, set up observer before navigating. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/nacl/pnacl_header_test.h" 5 #include "chrome/test/nacl/pnacl_header_test.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "chrome/browser/ui/browser.h" 9 #include "chrome/browser/ui/browser.h"
10 #include "chrome/browser/ui/tabs/tab_strip_model.h" 10 #include "chrome/browser/ui/tabs/tab_strip_model.h"
(...skipping 30 matching lines...) Expand all
41 } 41 }
42 42
43 void PnaclHeaderTest::TearDown() { 43 void PnaclHeaderTest::TearDown() {
44 ASSERT_TRUE(embedded_test_server()->ShutdownAndWaitUntilComplete()); 44 ASSERT_TRUE(embedded_test_server()->ShutdownAndWaitUntilComplete());
45 InProcessBrowserTest::TearDown(); 45 InProcessBrowserTest::TearDown();
46 } 46 }
47 47
48 void PnaclHeaderTest::RunLoadTest(const std::string& url, 48 void PnaclHeaderTest::RunLoadTest(const std::string& url,
49 int expected_noncors, 49 int expected_noncors,
50 int expected_cors) { 50 int expected_cors) {
51 ui_test_utils::NavigateToURL(browser(), embedded_test_server()->GetURL(url));
52 // Wait until the NMF and pexe are also loaded, not just the HTML.
53 // Do this by waiting till the LoadTestMessageHandler responds.
54 LoadTestMessageHandler handler; 51 LoadTestMessageHandler handler;
55 JavascriptTestObserver observer( 52 JavascriptTestObserver observer(
56 browser()->tab_strip_model()->GetActiveWebContents()->GetRenderViewHost(), 53 browser()->tab_strip_model()->GetActiveWebContents()->GetRenderViewHost(),
57 &handler); 54 &handler);
55 ui_test_utils::NavigateToURL(browser(), embedded_test_server()->GetURL(url));
56 // Wait until the NMF and pexe are also loaded, not just the HTML.
57 // Do this by waiting till the LoadTestMessageHandler responds.
58 EXPECT_TRUE(observer.Run()) << handler.error_message(); 58 EXPECT_TRUE(observer.Run()) << handler.error_message();
59 EXPECT_TRUE(handler.test_passed()) << "Test failed."; 59 EXPECT_TRUE(handler.test_passed()) << "Test failed.";
60 EXPECT_EQ(expected_noncors, noncors_loads_); 60 EXPECT_EQ(expected_noncors, noncors_loads_);
61 EXPECT_EQ(expected_cors, cors_loads_); 61 EXPECT_EQ(expected_cors, cors_loads_);
62 } 62 }
63 63
64 scoped_ptr<HttpResponse> PnaclHeaderTest::WatchForPexeFetch( 64 scoped_ptr<HttpResponse> PnaclHeaderTest::WatchForPexeFetch(
65 const HttpRequest& request) { 65 const HttpRequest& request) {
66 // Avoid favicon.ico warning by giving it a dummy icon. 66 // Avoid favicon.ico warning by giving it a dummy icon.
67 if (request.relative_url.find("favicon.ico") != std::string::npos) { 67 if (request.relative_url.find("favicon.ico") != std::string::npos) {
(...skipping 30 matching lines...) Expand all
98 98
99 // After checking the header, just return a 404. We don't need to actually 99 // After checking the header, just return a 404. We don't need to actually
100 // compile and stopping with a 404 is faster. 100 // compile and stopping with a 404 is faster.
101 scoped_ptr<BasicHttpResponse> http_response(new BasicHttpResponse()); 101 scoped_ptr<BasicHttpResponse> http_response(new BasicHttpResponse());
102 http_response->set_code(net::HTTP_NOT_FOUND); 102 http_response->set_code(net::HTTP_NOT_FOUND);
103 http_response->set_content("PEXE ... not found"); 103 http_response->set_content("PEXE ... not found");
104 http_response->set_content_type("application/octet-stream"); 104 http_response->set_content_type("application/octet-stream");
105 return http_response.PassAs<HttpResponse>(); 105 return http_response.PassAs<HttpResponse>();
106 } 106 }
107 107
108 // Disabled: http://crbug.com/315328. 108 IN_PROC_BROWSER_TEST_F(PnaclHeaderTest, TestHasPnaclHeader) {
109 IN_PROC_BROWSER_TEST_F(PnaclHeaderTest, DISABLED_TestHasPnaclHeader) {
110 // Load 2 pexes, one same origin and one cross orgin. 109 // Load 2 pexes, one same origin and one cross orgin.
111 RunLoadTest("/nacl/pnacl_request_header/pnacl_request_header.html", 1, 1); 110 RunLoadTest("/nacl/pnacl_request_header/pnacl_request_header.html", 1, 1);
112 } 111 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698