| OLD | NEW |
| 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 <sstream> | 5 #include <sstream> |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 #include "chrome/browser/net/url_request_mock_util.h" | 33 #include "chrome/browser/net/url_request_mock_util.h" |
| 34 #include "chrome/browser/prefs/pref_service.h" | 34 #include "chrome/browser/prefs/pref_service.h" |
| 35 #include "chrome/browser/profiles/profile.h" | 35 #include "chrome/browser/profiles/profile.h" |
| 36 #include "chrome/browser/tab_contents/render_view_context_menu.h" | 36 #include "chrome/browser/tab_contents/render_view_context_menu.h" |
| 37 #include "chrome/browser/ui/browser.h" | 37 #include "chrome/browser/ui/browser.h" |
| 38 #include "chrome/browser/ui/browser_commands.h" | 38 #include "chrome/browser/ui/browser_commands.h" |
| 39 #include "chrome/browser/ui/browser_list.h" | 39 #include "chrome/browser/ui/browser_list.h" |
| 40 #include "chrome/browser/ui/browser_tabstrip.h" | 40 #include "chrome/browser/ui/browser_tabstrip.h" |
| 41 #include "chrome/browser/ui/browser_window.h" | 41 #include "chrome/browser/ui/browser_window.h" |
| 42 #include "chrome/browser/ui/chrome_pages.h" | 42 #include "chrome/browser/ui/chrome_pages.h" |
| 43 #include "chrome/browser/ui/host_desktop.h" |
| 43 #include "chrome/common/chrome_notification_types.h" | 44 #include "chrome/common/chrome_notification_types.h" |
| 44 #include "chrome/common/chrome_paths.h" | 45 #include "chrome/common/chrome_paths.h" |
| 45 #include "chrome/common/extensions/extension_switch_utils.h" | 46 #include "chrome/common/extensions/extension_switch_utils.h" |
| 46 #include "chrome/common/pref_names.h" | 47 #include "chrome/common/pref_names.h" |
| 47 #include "chrome/common/url_constants.h" | 48 #include "chrome/common/url_constants.h" |
| 48 #include "chrome/test/base/in_process_browser_test.h" | 49 #include "chrome/test/base/in_process_browser_test.h" |
| 49 #include "chrome/test/base/ui_test_utils.h" | 50 #include "chrome/test/base/ui_test_utils.h" |
| 50 #include "content/public/browser/download_item.h" | 51 #include "content/public/browser/download_item.h" |
| 51 #include "content/public/browser/download_manager.h" | 52 #include "content/public/browser/download_manager.h" |
| 52 #include "content/public/browser/download_persistent_store_info.h" | 53 #include "content/public/browser/download_persistent_store_info.h" |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 CancelableRequestConsumer callback_consumer_; | 137 CancelableRequestConsumer callback_consumer_; |
| 137 | 138 |
| 138 DISALLOW_COPY_AND_ASSIGN(DownloadsHistoryDataCollector); | 139 DISALLOW_COPY_AND_ASSIGN(DownloadsHistoryDataCollector); |
| 139 }; | 140 }; |
| 140 | 141 |
| 141 // Mock that simulates a permissions dialog where the user denies | 142 // Mock that simulates a permissions dialog where the user denies |
| 142 // permission to install. TODO(skerner): This could be shared with | 143 // permission to install. TODO(skerner): This could be shared with |
| 143 // extensions tests. Find a common place for this class. | 144 // extensions tests. Find a common place for this class. |
| 144 class MockAbortExtensionInstallPrompt : public ExtensionInstallPrompt { | 145 class MockAbortExtensionInstallPrompt : public ExtensionInstallPrompt { |
| 145 public: | 146 public: |
| 146 MockAbortExtensionInstallPrompt() : ExtensionInstallPrompt(NULL, NULL, NULL) { | 147 MockAbortExtensionInstallPrompt() : |
| 148 ExtensionInstallPrompt(NULL, NULL, NULL) { |
| 147 } | 149 } |
| 148 | 150 |
| 149 // Simulate a user abort on an extension installation. | 151 // Simulate a user abort on an extension installation. |
| 150 virtual void ConfirmInstall(Delegate* delegate, const Extension* extension) { | 152 virtual void ConfirmInstall(Delegate* delegate, const Extension* extension) { |
| 151 delegate->InstallUIAbort(true); | 153 delegate->InstallUIAbort(true); |
| 152 MessageLoopForUI::current()->Quit(); | 154 MessageLoopForUI::current()->Quit(); |
| 153 } | 155 } |
| 154 | 156 |
| 155 virtual void OnInstallSuccess(const Extension* extension, SkBitmap* icon) {} | 157 virtual void OnInstallSuccess(const Extension* extension, SkBitmap* icon) {} |
| 156 virtual void OnInstallFailure(const extensions::CrxInstallerError& error) {} | 158 virtual void OnInstallFailure(const extensions::CrxInstallerError& error) {} |
| (...skipping 2078 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2235 GetDownloads(browser(), &download_items); | 2237 GetDownloads(browser(), &download_items); |
| 2236 ASSERT_EQ(1u, download_items.size()); | 2238 ASSERT_EQ(1u, download_items.size()); |
| 2237 ASSERT_EQ(test_server()->GetURL("echoheader?Referer"), | 2239 ASSERT_EQ(test_server()->GetURL("echoheader?Referer"), |
| 2238 download_items[0]->GetOriginalUrl()); | 2240 download_items[0]->GetOriginalUrl()); |
| 2239 | 2241 |
| 2240 // Check that the file contains the expected referrer. | 2242 // Check that the file contains the expected referrer. |
| 2241 FilePath file(download_items[0]->GetFullPath()); | 2243 FilePath file(download_items[0]->GetFullPath()); |
| 2242 std::string expected_contents = test_server()->GetURL("").spec(); | 2244 std::string expected_contents = test_server()->GetURL("").spec(); |
| 2243 ASSERT_TRUE(VerifyFile(file, expected_contents, expected_contents.length())); | 2245 ASSERT_TRUE(VerifyFile(file, expected_contents, expected_contents.length())); |
| 2244 } | 2246 } |
| OLD | NEW |