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

Side by Side Diff: content/browser/download/download_browsertest.cc

Issue 2860593003: Refactoring DownloadManager::DownloadURL to add proper annotation. (Closed)
Patch Set: Annotation moved to DownloadManager::DownloadUrl. Created 3 years, 6 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) 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 // This file contains download browser tests that are known to be runnable 5 // This file contains download browser tests that are known to be runnable
6 // in a pure content context. Over time tests should be migrated here. 6 // in a pure content context. Over time tests should be migrated here.
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 #include <utility> 10 #include <utility>
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 #include "content/shell/browser/shell_browser_context.h" 56 #include "content/shell/browser/shell_browser_context.h"
57 #include "content/shell/browser/shell_download_manager_delegate.h" 57 #include "content/shell/browser/shell_download_manager_delegate.h"
58 #include "content/shell/browser/shell_network_delegate.h" 58 #include "content/shell/browser/shell_network_delegate.h"
59 #include "content/test/content_browser_test_utils_internal.h" 59 #include "content/test/content_browser_test_utils_internal.h"
60 #include "net/dns/mock_host_resolver.h" 60 #include "net/dns/mock_host_resolver.h"
61 #include "net/test/embedded_test_server/embedded_test_server.h" 61 #include "net/test/embedded_test_server/embedded_test_server.h"
62 #include "net/test/embedded_test_server/http_request.h" 62 #include "net/test/embedded_test_server/http_request.h"
63 #include "net/test/embedded_test_server/http_response.h" 63 #include "net/test/embedded_test_server/http_response.h"
64 #include "net/test/url_request/url_request_mock_http_job.h" 64 #include "net/test/url_request/url_request_mock_http_job.h"
65 #include "net/test/url_request/url_request_slow_download_job.h" 65 #include "net/test/url_request/url_request_slow_download_job.h"
66 #include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
66 #include "ppapi/features/features.h" 67 #include "ppapi/features/features.h"
67 #include "testing/gmock/include/gmock/gmock.h" 68 #include "testing/gmock/include/gmock/gmock.h"
68 #include "testing/gtest/include/gtest/gtest.h" 69 #include "testing/gtest/include/gtest/gtest.h"
69 #include "url/gurl.h" 70 #include "url/gurl.h"
70 71
71 #if BUILDFLAG(ENABLE_PLUGINS) 72 #if BUILDFLAG(ENABLE_PLUGINS)
72 #include "content/browser/plugin_service_impl.h" 73 #include "content/browser/plugin_service_impl.h"
73 #endif 74 #endif
74 75
75 using ::testing::AllOf; 76 using ::testing::AllOf;
(...skipping 2272 matching lines...) Expand 10 before | Expand all | Expand 10 after
2348 origin_two.RegisterRequestHandler( 2349 origin_two.RegisterRequestHandler(
2349 CreateRedirectHandler("/bar", origin_one.GetURL("/foo"))); 2350 CreateRedirectHandler("/bar", origin_one.GetURL("/foo")));
2350 ASSERT_TRUE(origin_two.Start()); 2351 ASSERT_TRUE(origin_two.Start());
2351 2352
2352 // Download the file. 2353 // Download the file.
2353 SetupEnsureNoPendingDownloads(); 2354 SetupEnsureNoPendingDownloads();
2354 std::unique_ptr<DownloadUrlParameters> download_parameters( 2355 std::unique_ptr<DownloadUrlParameters> download_parameters(
2355 DownloadUrlParameters::CreateForWebContentsMainFrame( 2356 DownloadUrlParameters::CreateForWebContentsMainFrame(
2356 shell()->web_contents(), origin_two.GetURL("/bar"))); 2357 shell()->web_contents(), origin_two.GetURL("/bar")));
2357 std::unique_ptr<DownloadTestObserver> observer(CreateWaiter(shell(), 1)); 2358 std::unique_ptr<DownloadTestObserver> observer(CreateWaiter(shell(), 1));
2358 DownloadManagerForShell(shell())->DownloadUrl(std::move(download_parameters)); 2359 DownloadManagerForShell(shell())->DownloadUrl(std::move(download_parameters),
2360 TRAFFIC_ANNOTATION_FOR_TESTS);
2359 observer->WaitForFinished(); 2361 observer->WaitForFinished();
2360 2362
2361 // Get the important info from other threads and check it. 2363 // Get the important info from other threads and check it.
2362 EXPECT_TRUE(EnsureNoPendingDownloads()); 2364 EXPECT_TRUE(EnsureNoPendingDownloads());
2363 2365
2364 std::vector<DownloadItem*> downloads; 2366 std::vector<DownloadItem*> downloads;
2365 DownloadManagerForShell(shell())->GetAllDownloads(&downloads); 2367 DownloadManagerForShell(shell())->GetAllDownloads(&downloads);
2366 ASSERT_EQ(1u, downloads.size()); 2368 ASSERT_EQ(1u, downloads.size());
2367 ASSERT_EQ(DownloadItem::COMPLETE, downloads[0]->GetState()); 2369 ASSERT_EQ(DownloadItem::COMPLETE, downloads[0]->GetState());
2368 2370
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
2737 2739
2738 std::vector<DownloadItem*> downloads; 2740 std::vector<DownloadItem*> downloads;
2739 DownloadManagerForShell(shell())->GetAllDownloads(&downloads); 2741 DownloadManagerForShell(shell())->GetAllDownloads(&downloads);
2740 ASSERT_EQ(1u, downloads.size()); 2742 ASSERT_EQ(1u, downloads.size());
2741 2743
2742 EXPECT_EQ(FILE_PATH_LITERAL("foo"), 2744 EXPECT_EQ(FILE_PATH_LITERAL("foo"),
2743 downloads[0]->GetTargetFilePath().BaseName().value()); 2745 downloads[0]->GetTargetFilePath().BaseName().value());
2744 } 2746 }
2745 2747
2746 } // namespace content 2748 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698