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

Side by Side Diff: chrome/browser/download/download_request_limiter_unittest.cc

Issue 10534104: TabContentsWrapper -> TabContents, part 55. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 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 | Annotate | Revision Log
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/bind.h" 5 #include "base/bind.h"
6 #include "chrome/browser/download/download_request_limiter.h" 6 #include "chrome/browser/download/download_request_limiter.h"
7 #include "chrome/browser/ui/tab_contents/tab_contents.h" 7 #include "chrome/browser/ui/tab_contents/tab_contents.h"
8 #include "chrome/browser/ui/tab_contents/test_tab_contents.h" 8 #include "chrome/browser/ui/tab_contents/test_tab_contents.h"
9 #include "chrome/test/base/testing_profile.h" 9 #include "chrome/test/base/testing_profile.h"
10 #include "content/public/browser/navigation_controller.h" 10 #include "content/public/browser/navigation_controller.h"
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 } 233 }
234 234
235 TEST_F(DownloadRequestLimiterTest, 235 TEST_F(DownloadRequestLimiterTest,
236 DownloadRequestLimiter_RawWebContents) { 236 DownloadRequestLimiter_RawWebContents) {
237 // By-pass TabContentsTestHarness and use 237 // By-pass TabContentsTestHarness and use
238 // RenderViewHostTestHarness::CreateTestWebContents() directly so that there 238 // RenderViewHostTestHarness::CreateTestWebContents() directly so that there
239 // will be no TabContents for web_contents. 239 // will be no TabContents for web_contents.
240 scoped_ptr<WebContents> web_contents(CreateTestWebContents()); 240 scoped_ptr<WebContents> web_contents(CreateTestWebContents());
241 TabContents* tab_contents = TabContents::FromWebContents(web_contents.get()); 241 TabContents* tab_contents = TabContents::FromWebContents(web_contents.get());
242 ASSERT_TRUE(tab_contents == NULL); 242 ASSERT_TRUE(tab_contents == NULL);
243 // DRL won't try to make an infobar if it doesn't have a TCW, and we want to 243 // DownloadRequestLimiter won't try to make an infobar if it doesn't have a
244 // test that it will Cancel() instead of prompting when it doesn't have a TCW, 244 // TabContents, and we want to test that it will Cancel() instead of prompting
245 // so unset the delegate. 245 // when it doesn't have a TabContents, so unset the delegate.
246 UnsetDelegate(); 246 UnsetDelegate();
247 EXPECT_EQ(0, continue_count_); 247 EXPECT_EQ(0, continue_count_);
248 EXPECT_EQ(0, cancel_count_); 248 EXPECT_EQ(0, cancel_count_);
249 EXPECT_EQ(DownloadRequestLimiter::ALLOW_ONE_DOWNLOAD, 249 EXPECT_EQ(DownloadRequestLimiter::ALLOW_ONE_DOWNLOAD,
250 download_request_limiter_->GetDownloadStatus(web_contents.get())); 250 download_request_limiter_->GetDownloadStatus(web_contents.get()));
251 // You get one freebie. 251 // You get one freebie.
252 CanDownloadFor(web_contents.get()); 252 CanDownloadFor(web_contents.get());
253 EXPECT_EQ(1, continue_count_); 253 EXPECT_EQ(1, continue_count_);
254 EXPECT_EQ(0, cancel_count_); 254 EXPECT_EQ(0, cancel_count_);
255 EXPECT_EQ(DownloadRequestLimiter::PROMPT_BEFORE_DOWNLOAD, 255 EXPECT_EQ(DownloadRequestLimiter::PROMPT_BEFORE_DOWNLOAD,
(...skipping 13 matching lines...) Expand all
269 download_request_limiter_->GetDownloadStatus(web_contents.get())); 269 download_request_limiter_->GetDownloadStatus(web_contents.get()));
270 OnUserGestureFor(web_contents.get()); 270 OnUserGestureFor(web_contents.get());
271 EXPECT_EQ(DownloadRequestLimiter::ALLOW_ONE_DOWNLOAD, 271 EXPECT_EQ(DownloadRequestLimiter::ALLOW_ONE_DOWNLOAD,
272 download_request_limiter_->GetDownloadStatus(web_contents.get())); 272 download_request_limiter_->GetDownloadStatus(web_contents.get()));
273 CanDownloadFor(web_contents.get()); 273 CanDownloadFor(web_contents.get());
274 EXPECT_EQ(3, continue_count_); 274 EXPECT_EQ(3, continue_count_);
275 EXPECT_EQ(1, cancel_count_); 275 EXPECT_EQ(1, cancel_count_);
276 EXPECT_EQ(DownloadRequestLimiter::PROMPT_BEFORE_DOWNLOAD, 276 EXPECT_EQ(DownloadRequestLimiter::PROMPT_BEFORE_DOWNLOAD,
277 download_request_limiter_->GetDownloadStatus(web_contents.get())); 277 download_request_limiter_->GetDownloadStatus(web_contents.get()));
278 } 278 }
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/webui_login_view.cc ('k') | chrome/browser/instant/instant_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698