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

Side by Side Diff: chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc

Issue 209613002: Download shelf autohides on showing in shell, just same as regular open Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added browser and unit tests. Renamed 'UserActed' to 'OpenedOrShown'. 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
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 // Disable everything on windows only. http://crbug.com/306144 5 // Disable everything on windows only. http://crbug.com/306144
6 #ifndef OS_WIN 6 #ifndef OS_WIN
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 11 matching lines...) Expand all
22 #include "build/build_config.h" 22 #include "build/build_config.h"
23 #include "chrome/browser/download/download_file_icon_extractor.h" 23 #include "chrome/browser/download/download_file_icon_extractor.h"
24 #include "chrome/browser/download/download_service.h" 24 #include "chrome/browser/download/download_service.h"
25 #include "chrome/browser/download/download_service_factory.h" 25 #include "chrome/browser/download/download_service_factory.h"
26 #include "chrome/browser/download/download_test_file_activity_observer.h" 26 #include "chrome/browser/download/download_test_file_activity_observer.h"
27 #include "chrome/browser/extensions/api/downloads/downloads_api.h" 27 #include "chrome/browser/extensions/api/downloads/downloads_api.h"
28 #include "chrome/browser/extensions/browser_action_test_util.h" 28 #include "chrome/browser/extensions/browser_action_test_util.h"
29 #include "chrome/browser/extensions/extension_apitest.h" 29 #include "chrome/browser/extensions/extension_apitest.h"
30 #include "chrome/browser/extensions/extension_function_test_utils.h" 30 #include "chrome/browser/extensions/extension_function_test_utils.h"
31 #include "chrome/browser/net/url_request_mock_util.h" 31 #include "chrome/browser/net/url_request_mock_util.h"
32 #include "chrome/browser/platform_util_internal.h"
32 #include "chrome/browser/profiles/profile.h" 33 #include "chrome/browser/profiles/profile.h"
33 #include "chrome/browser/ui/browser.h" 34 #include "chrome/browser/ui/browser.h"
34 #include "chrome/browser/ui/browser_tabstrip.h" 35 #include "chrome/browser/ui/browser_tabstrip.h"
35 #include "chrome/common/extensions/api/downloads.h" 36 #include "chrome/common/extensions/api/downloads.h"
36 #include "chrome/common/pref_names.h" 37 #include "chrome/common/pref_names.h"
37 #include "chrome/test/base/in_process_browser_test.h" 38 #include "chrome/test/base/in_process_browser_test.h"
38 #include "chrome/test/base/ui_test_utils.h" 39 #include "chrome/test/base/ui_test_utils.h"
39 #include "components/prefs/pref_service.h" 40 #include "components/prefs/pref_service.h"
40 #include "content/public/browser/browser_context.h" 41 #include "content/public/browser/browser_context.h"
41 #include "content/public/browser/browser_thread.h" 42 #include "content/public/browser/browser_thread.h"
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 InProcessBrowserTest::SetUpOnMainThread(); 319 InProcessBrowserTest::SetUpOnMainThread();
319 GoOnTheRecord(); 320 GoOnTheRecord();
320 CreateAndSetDownloadsDirectory(); 321 CreateAndSetDownloadsDirectory();
321 current_browser()->profile()->GetPrefs()->SetBoolean( 322 current_browser()->profile()->GetPrefs()->SetBoolean(
322 prefs::kPromptForDownload, false); 323 prefs::kPromptForDownload, false);
323 GetOnRecordManager()->RemoveAllDownloads(); 324 GetOnRecordManager()->RemoveAllDownloads();
324 events_listener_.reset(new DownloadsEventsListener()); 325 events_listener_.reset(new DownloadsEventsListener());
325 // Disable file chooser for current profile. 326 // Disable file chooser for current profile.
326 DownloadTestFileActivityObserver observer(current_browser()->profile()); 327 DownloadTestFileActivityObserver observer(current_browser()->profile());
327 observer.EnableFileChooser(false); 328 observer.EnableFileChooser(false);
329 // Prevent platform from opening files and showing folders.
330 platform_util::internal::DisableShellOperationsForTesting();
328 } 331 }
329 332
330 void GoOnTheRecord() { current_browser_ = browser(); } 333 void GoOnTheRecord() { current_browser_ = browser(); }
331 334
332 void GoOffTheRecord() { 335 void GoOffTheRecord() {
333 if (!incognito_browser_) { 336 if (!incognito_browser_) {
334 incognito_browser_ = CreateIncognitoBrowser(); 337 incognito_browser_ = CreateIncognitoBrowser();
335 GetOffRecordManager()->RemoveAllDownloads(); 338 GetOffRecordManager()->RemoveAllDownloads();
336 // Disable file chooser for incognito profile. 339 // Disable file chooser for incognito profile.
337 DownloadTestFileActivityObserver observer(incognito_browser_->profile()); 340 DownloadTestFileActivityObserver observer(incognito_browser_->profile());
(...skipping 3965 matching lines...) Expand 10 before | Expand all | Expand 10 after
4303 EXPECT_EQ(downloads::FILENAME_CONFLICT_ACTION_PROMPT, conflict_action); 4306 EXPECT_EQ(downloads::FILENAME_CONFLICT_ACTION_PROMPT, conflict_action);
4304 EXPECT_FALSE(warnings.empty()); 4307 EXPECT_FALSE(warnings.empty());
4305 EXPECT_EQ(Warning::kDownloadFilenameConflict, 4308 EXPECT_EQ(Warning::kDownloadFilenameConflict,
4306 warnings.begin()->warning_type()); 4309 warnings.begin()->warning_type());
4307 EXPECT_EQ("incumbent", warnings.begin()->extension_id()); 4310 EXPECT_EQ("incumbent", warnings.begin()->extension_id());
4308 } 4311 }
4309 4312
4310 } // namespace extensions 4313 } // namespace extensions
4311 4314
4312 #endif // http://crbug.com/306144 4315 #endif // http://crbug.com/306144
OLDNEW
« no previous file with comments | « chrome/browser/download/download_item_model_unittest.cc ('k') | chrome/browser/ntp_snippets/fake_download_item.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698