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

Side by Side Diff: chrome/browser/extensions/api/streams_private/streams_private_apitest.cc

Issue 667483002: Account for NULL headers in streams. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add a test Created 6 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
« no previous file with comments | « no previous file | chrome/test/data/extensions/api_test/streams_private/handle_mime_type/background.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/message_loop/message_loop.h" 6 #include "base/message_loop/message_loop.h"
7 #include "base/prefs/pref_service.h" 7 #include "base/prefs/pref_service.h"
8 #include "chrome/browser/download/download_prefs.h" 8 #include "chrome/browser/download/download_prefs.h"
9 #include "chrome/browser/extensions/extension_apitest.h" 9 #include "chrome/browser/extensions/extension_apitest.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 DownloadManager* download_manager = GetDownloadManager(); 262 DownloadManager* download_manager = GetDownloadManager();
263 std::vector<DownloadItem*> downloads; 263 std::vector<DownloadItem*> downloads;
264 download_manager->GetAllDownloads(&downloads); 264 download_manager->GetAllDownloads(&downloads);
265 ASSERT_EQ(0u, downloads.size()); 265 ASSERT_EQ(0u, downloads.size());
266 266
267 // The test extension should receive onExecuteContentHandler event with MIME 267 // The test extension should receive onExecuteContentHandler event with MIME
268 // type 'application/msword' (and call chrome.test.notifySuccess). 268 // type 'application/msword' (and call chrome.test.notifySuccess).
269 EXPECT_TRUE(catcher.GetNextResult()); 269 EXPECT_TRUE(catcher.GetNextResult());
270 } 270 }
271 271
272 // Tests that navigating to a file URL also intercepts despite there being no
273 // HTTP headers. This is a regression test for https://crbug.com/416433.
274 IN_PROC_BROWSER_TEST_F(StreamsPrivateApiTest, FileURL) {
275 #if defined(OS_WIN) && defined(USE_ASH)
276 // Disable this test in Metro+Ash for now (http://crbug.com/262796).
277 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests))
278 return;
279 #endif
280
281 ASSERT_TRUE(LoadTestExtension()) << message_;
282
283 ResultCatcher catcher;
284
285 ui_test_utils::NavigateToURL(browser(), ui_test_utils::GetTestUrl(
286 base::FilePath(FILE_PATH_LITERAL("downloads")),
287 base::FilePath(FILE_PATH_LITERAL("Picture_1.doc"))));
288
289 // There should be no downloads started by the navigation.
290 DownloadManager* download_manager = GetDownloadManager();
291 std::vector<DownloadItem*> downloads;
292 download_manager->GetAllDownloads(&downloads);
293 ASSERT_EQ(0u, downloads.size());
294
295 // The test extension should receive onExecuteContentHandler event with MIME
296 // type 'application/msword' (and call chrome.test.notifySuccess).
297 EXPECT_TRUE(catcher.GetNextResult());
298 }
299
272 // Tests that navigating cross-site to a resource with a MIME type handleable by 300 // Tests that navigating cross-site to a resource with a MIME type handleable by
273 // an installed, white-listed extension invokes the extension's 301 // an installed, white-listed extension invokes the extension's
274 // onExecuteContentHandler event (and does not start a download). 302 // onExecuteContentHandler event (and does not start a download).
275 // Regression test for http://crbug.com/342999. 303 // Regression test for http://crbug.com/342999.
276 IN_PROC_BROWSER_TEST_F(StreamsPrivateApiTest, NavigateCrossSite) { 304 IN_PROC_BROWSER_TEST_F(StreamsPrivateApiTest, NavigateCrossSite) {
277 #if defined(OS_WIN) && defined(USE_ASH) 305 #if defined(OS_WIN) && defined(USE_ASH)
278 // Disable this test in Metro+Ash for now (http://crbug.com/262796). 306 // Disable this test in Metro+Ash for now (http://crbug.com/262796).
279 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) 307 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests))
280 return; 308 return;
281 #endif 309 #endif
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 base::MessageLoop::current()->RunUntilIdle(); 475 base::MessageLoop::current()->RunUntilIdle();
448 EXPECT_TRUE(catcher.GetNextResult()); 476 EXPECT_TRUE(catcher.GetNextResult());
449 477
450 ui_test_utils::NavigateToURL(browser(), 478 ui_test_utils::NavigateToURL(browser(),
451 test_server_->GetURL("/abort.rtf")); 479 test_server_->GetURL("/abort.rtf"));
452 base::MessageLoop::current()->RunUntilIdle(); 480 base::MessageLoop::current()->RunUntilIdle();
453 EXPECT_TRUE(catcher.GetNextResult()); 481 EXPECT_TRUE(catcher.GetNextResult());
454 } 482 }
455 483
456 } // namespace 484 } // namespace
OLDNEW
« no previous file with comments | « no previous file | chrome/test/data/extensions/api_test/streams_private/handle_mime_type/background.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698