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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 #include "net/base/net_util.h" | 63 #include "net/base/net_util.h" |
64 #include "net/test/test_server.h" | 64 #include "net/test/test_server.h" |
65 #include "testing/gtest/include/gtest/gtest.h" | 65 #include "testing/gtest/include/gtest/gtest.h" |
66 | 66 |
67 using content::BrowserThread; | 67 using content::BrowserThread; |
68 using content::DownloadItem; | 68 using content::DownloadItem; |
69 using content::DownloadManager; | 69 using content::DownloadManager; |
70 using content::DownloadPersistentStoreInfo; | 70 using content::DownloadPersistentStoreInfo; |
71 using content::DownloadUrlParameters; | 71 using content::DownloadUrlParameters; |
72 using content::WebContents; | 72 using content::WebContents; |
| 73 using extensions::Extension; |
73 | 74 |
74 namespace { | 75 namespace { |
75 | 76 |
76 // IDs and paths of CRX files used in tests. | 77 // IDs and paths of CRX files used in tests. |
77 const char kGoodCrxId[] = "ldnnhddmnhbkjipkidpdiheffobcpfmf"; | 78 const char kGoodCrxId[] = "ldnnhddmnhbkjipkidpdiheffobcpfmf"; |
78 const FilePath kGoodCrxPath(FILE_PATH_LITERAL("extensions/good.crx")); | 79 const FilePath kGoodCrxPath(FILE_PATH_LITERAL("extensions/good.crx")); |
79 | 80 |
80 const char kLargeThemeCrxId[] = "pjpgmfcmabopnnfonnhmdjglfpjjfkbf"; | 81 const char kLargeThemeCrxId[] = "pjpgmfcmabopnnfonnhmdjglfpjjfkbf"; |
81 const FilePath kLargeThemePath(FILE_PATH_LITERAL("extensions/theme2.crx")); | 82 const FilePath kLargeThemePath(FILE_PATH_LITERAL("extensions/theme2.crx")); |
82 | 83 |
(...skipping 2373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2456 GetDownloads(browser(), &download_items); | 2457 GetDownloads(browser(), &download_items); |
2457 ASSERT_EQ(1u, download_items.size()); | 2458 ASSERT_EQ(1u, download_items.size()); |
2458 ASSERT_EQ(test_server()->GetURL("echoheader?Referer"), | 2459 ASSERT_EQ(test_server()->GetURL("echoheader?Referer"), |
2459 download_items[0]->GetOriginalUrl()); | 2460 download_items[0]->GetOriginalUrl()); |
2460 | 2461 |
2461 // Check that the file contains the expected referrer. | 2462 // Check that the file contains the expected referrer. |
2462 FilePath file(download_items[0]->GetFullPath()); | 2463 FilePath file(download_items[0]->GetFullPath()); |
2463 std::string expected_contents = test_server()->GetURL("").spec(); | 2464 std::string expected_contents = test_server()->GetURL("").spec(); |
2464 ASSERT_TRUE(VerifyFile(file, expected_contents, expected_contents.length())); | 2465 ASSERT_TRUE(VerifyFile(file, expected_contents, expected_contents.length())); |
2465 } | 2466 } |
OLD | NEW |