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

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

Issue 11275088: Remove implicit scoped_refptr operator T* Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 8 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
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/file_path.h" 5 #include "base/file_path.h"
6 #include "base/file_util.h" 6 #include "base/file_util.h"
7 #include "base/scoped_temp_dir.h" 7 #include "base/scoped_temp_dir.h"
8 #include "content/browser/download/download_file_factory.h" 8 #include "content/browser/download/download_file_factory.h"
9 #include "content/browser/download/download_file_impl.h" 9 #include "content/browser/download/download_file_impl.h"
10 #include "content/browser/download/download_item_impl.h" 10 #include "content/browser/download/download_item_impl.h"
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 "DragDownloadFileTest_NetError.txt")); 94 "DragDownloadFileTest_NetError.txt"));
95 GURL url(URLRequestMockHTTPJob::GetMockUrl(FilePath(FILE_PATH_LITERAL( 95 GURL url(URLRequestMockHTTPJob::GetMockUrl(FilePath(FILE_PATH_LITERAL(
96 "download-test.lib")))); 96 "download-test.lib"))));
97 content::Referrer referrer; 97 content::Referrer referrer;
98 std::string referrer_encoding; 98 std::string referrer_encoding;
99 DragDownloadFile* file = new DragDownloadFile( 99 DragDownloadFile* file = new DragDownloadFile(
100 name, scoped_ptr<net::FileStream>(NULL), url, referrer, 100 name, scoped_ptr<net::FileStream>(NULL), url, referrer,
101 referrer_encoding, shell()->web_contents()); 101 referrer_encoding, shell()->web_contents());
102 scoped_refptr<MockDownloadFileObserver> observer( 102 scoped_refptr<MockDownloadFileObserver> observer(
103 new MockDownloadFileObserver()); 103 new MockDownloadFileObserver());
104 EXPECT_CALL(*observer, OnDownloadAborted()).WillOnce(InvokeWithoutArgs( 104 EXPECT_CALL(*observer.get(), OnDownloadAborted()).WillOnce(InvokeWithoutArgs(
105 this, &DragDownloadFileTest::Succeed)); 105 this, &DragDownloadFileTest::Succeed));
106 ON_CALL(*observer, OnDownloadCompleted(_)).WillByDefault(InvokeWithoutArgs( 106 ON_CALL(
107 this, &DragDownloadFileTest::FailFast)); 107 *observer.get(), OnDownloadCompleted(_)).WillByDefault(InvokeWithoutArgs(
108 file->Start(observer); 108 this, &DragDownloadFileTest::FailFast));
109 file->Start(observer.get());
109 RunMessageLoop(); 110 RunMessageLoop();
110 } 111 }
111 112
112 IN_PROC_BROWSER_TEST_F(DragDownloadFileTest, DragDownloadFileTest_Complete) { 113 IN_PROC_BROWSER_TEST_F(DragDownloadFileTest, DragDownloadFileTest_Complete) {
113 FilePath name(downloads_directory().AppendASCII( 114 FilePath name(downloads_directory().AppendASCII(
114 "DragDownloadFileTest_Complete.txt")); 115 "DragDownloadFileTest_Complete.txt"));
115 GURL url(URLRequestMockHTTPJob::GetMockUrl(FilePath(FILE_PATH_LITERAL( 116 GURL url(URLRequestMockHTTPJob::GetMockUrl(FilePath(FILE_PATH_LITERAL(
116 "download-test.lib")))); 117 "download-test.lib"))));
117 content::Referrer referrer; 118 content::Referrer referrer;
118 std::string referrer_encoding; 119 std::string referrer_encoding;
119 net::FileStream* stream = NULL; 120 net::FileStream* stream = NULL;
120 #if defined(OS_POSIX) 121 #if defined(OS_POSIX)
121 stream = CreateFileStreamForDrop( 122 stream = CreateFileStreamForDrop(
122 &name, GetContentClient()->browser()->GetNetLog()); 123 &name, GetContentClient()->browser()->GetNetLog());
123 #endif 124 #endif
124 SetUpServer(); 125 SetUpServer();
125 DragDownloadFile* file = new DragDownloadFile( 126 DragDownloadFile* file = new DragDownloadFile(
126 name, scoped_ptr<net::FileStream>(stream), url, referrer, 127 name, scoped_ptr<net::FileStream>(stream), url, referrer,
127 referrer_encoding, shell()->web_contents()); 128 referrer_encoding, shell()->web_contents());
128 scoped_refptr<MockDownloadFileObserver> observer( 129 scoped_refptr<MockDownloadFileObserver> observer(
129 new MockDownloadFileObserver()); 130 new MockDownloadFileObserver());
130 EXPECT_CALL(*observer, OnDownloadCompleted(_)).WillOnce(InvokeWithoutArgs( 131 EXPECT_CALL(
131 this, &DragDownloadFileTest::Succeed)); 132 *observer.get(), OnDownloadCompleted(_)).WillOnce(InvokeWithoutArgs(
132 ON_CALL(*observer, OnDownloadAborted()).WillByDefault(InvokeWithoutArgs( 133 this, &DragDownloadFileTest::Succeed));
134 ON_CALL(*observer.get(), OnDownloadAborted()).WillByDefault(InvokeWithoutArgs(
133 this, &DragDownloadFileTest::FailFast)); 135 this, &DragDownloadFileTest::FailFast));
134 file->Start(observer); 136 file->Start(observer.get());
135 RunMessageLoop(); 137 RunMessageLoop();
136 } 138 }
137 139
138 // TODO(benjhayden): Test Stop(). 140 // TODO(benjhayden): Test Stop().
139 141
140 } // namespace content 142 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/dom_storage/dom_storage_message_filter.cc ('k') | content/browser/geolocation/fake_access_token_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698