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

Side by Side Diff: chrome/browser/ui/browser_close_unittest.cc

Issue 2479593006: Move enable extensions define to a build flag. (Closed)
Patch Set: Merge Created 4 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
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | chrome/browser/ui/browser_commands.cc » ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "chrome/browser/download/chrome_download_manager_delegate.h" 10 #include "chrome/browser/download/chrome_download_manager_delegate.h"
11 #include "chrome/browser/download/download_service.h" 11 #include "chrome/browser/download/download_service.h"
12 #include "chrome/browser/download/download_service_factory.h" 12 #include "chrome/browser/download/download_service_factory.h"
13 #include "chrome/browser/profiles/profile_manager.h" 13 #include "chrome/browser/profiles/profile_manager.h"
14 #include "chrome/test/base/test_browser_window.h" 14 #include "chrome/test/base/test_browser_window.h"
15 #include "chrome/test/base/testing_browser_process.h" 15 #include "chrome/test/base/testing_browser_process.h"
16 #include "chrome/test/base/testing_profile.h" 16 #include "chrome/test/base/testing_profile.h"
17 #include "chrome/test/base/testing_profile_manager.h" 17 #include "chrome/test/base/testing_profile_manager.h"
18 #include "components/keyed_service/core/keyed_service.h" 18 #include "components/keyed_service/core/keyed_service.h"
19 #include "content/public/browser/browser_context.h" 19 #include "content/public/browser/browser_context.h"
20 #include "content/public/test/test_browser_thread_bundle.h" 20 #include "content/public/test/test_browser_thread_bundle.h"
21 #include "extensions/features/features.h"
21 #include "testing/gtest/include/gtest/gtest.h" 22 #include "testing/gtest/include/gtest/gtest.h"
22 23
23 class TestingDownloadService : public DownloadService { 24 class TestingDownloadService : public DownloadService {
24 public: 25 public:
25 TestingDownloadService() : download_count_(0) {} 26 TestingDownloadService() : download_count_(0) {}
26 ~TestingDownloadService() override {} 27 ~TestingDownloadService() override {}
27 28
28 // All methods that aren't expected to be called in the execution of 29 // All methods that aren't expected to be called in the execution of
29 // this unit test are marked to result in test failure. Using a simple 30 // this unit test are marked to result in test failure. Using a simple
30 // mock for this class should be re-evaluated if any of these 31 // mock for this class should be re-evaluated if any of these
31 // methods are being called; it may mean that a more fully featured 32 // methods are being called; it may mean that a more fully featured
32 // DownloadService implementation is needed. 33 // DownloadService implementation is needed.
33 34
34 void SetDownloadCount(int download_count) { 35 void SetDownloadCount(int download_count) {
35 download_count_ = download_count; 36 download_count_ = download_count;
36 } 37 }
37 38
38 // DownloadService 39 // DownloadService
39 ChromeDownloadManagerDelegate* GetDownloadManagerDelegate() override { 40 ChromeDownloadManagerDelegate* GetDownloadManagerDelegate() override {
40 ADD_FAILURE(); 41 ADD_FAILURE();
41 return nullptr; 42 return nullptr;
42 } 43 }
43 44
44 DownloadHistory* GetDownloadHistory() override { 45 DownloadHistory* GetDownloadHistory() override {
45 ADD_FAILURE(); 46 ADD_FAILURE();
46 return nullptr; 47 return nullptr;
47 } 48 }
48 49
49 #if defined(ENABLE_EXTENSIONS) 50 #if BUILDFLAG(ENABLE_EXTENSIONS)
50 extensions::ExtensionDownloadsEventRouter* GetExtensionEventRouter() 51 extensions::ExtensionDownloadsEventRouter* GetExtensionEventRouter()
51 override { 52 override {
52 ADD_FAILURE(); 53 ADD_FAILURE();
53 return nullptr; 54 return nullptr;
54 } 55 }
55 #endif 56 #endif
56 bool HasCreatedDownloadManager() override { return true; } 57 bool HasCreatedDownloadManager() override { return true; }
57 58
58 int NonMaliciousDownloadCount() const override { return download_count_; } 59 int NonMaliciousDownloadCount() const override { return download_count_; }
59 60
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 Profile* profile = CreateProfile(1, 0); 341 Profile* profile = CreateProfile(1, 0);
341 Profile* incognito_profile = CreateIncognitoProfile(profile, 1, 2); 342 Profile* incognito_profile = CreateIncognitoProfile(profile, 1, 2);
342 343
343 Browser* browser = GetProfileBrowser(incognito_profile, 0); 344 Browser* browser = GetProfileBrowser(incognito_profile, 0);
344 345
345 int num_downloads_blocking = 0; 346 int num_downloads_blocking = 0;
346 EXPECT_EQ(Browser::DOWNLOAD_CLOSE_LAST_WINDOW_IN_INCOGNITO_PROFILE, 347 EXPECT_EQ(Browser::DOWNLOAD_CLOSE_LAST_WINDOW_IN_INCOGNITO_PROFILE,
347 browser->OkToCloseWithInProgressDownloads(&num_downloads_blocking)); 348 browser->OkToCloseWithInProgressDownloads(&num_downloads_blocking));
348 EXPECT_EQ(2, num_downloads_blocking); 349 EXPECT_EQ(2, num_downloads_blocking);
349 } 350 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | chrome/browser/ui/browser_commands.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698