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 <memory> | 5 #include <memory> |
6 #include <utility> | 6 #include <utility> |
7 | 7 |
8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
11 | 11 |
12 #if defined(OS_WIN) | 12 #if defined(OS_WIN) |
13 #include <windows.h> | 13 #include <windows.h> |
| 14 #include <objbase.h> |
14 #include <shlobj.h> | 15 #include <shlobj.h> |
15 #endif | 16 #endif |
16 | 17 |
17 #include <stdint.h> | 18 #include <stdint.h> |
18 | 19 |
19 #include <algorithm> | 20 #include <algorithm> |
20 #include <limits> | 21 #include <limits> |
21 | 22 |
22 #include "base/base64url.h" | 23 #include "base/base64url.h" |
23 #include "base/bind.h" | 24 #include "base/bind.h" |
(...skipping 1231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1255 app_path = app_path.Append(kTestFilePath); | 1256 app_path = app_path.Append(kTestFilePath); |
1256 app_path = app_path.AppendASCII("with-headers.html"); | 1257 app_path = app_path.AppendASCII("with-headers.html"); |
1257 | 1258 |
1258 std::wstring lnk_path = app_path.value() + L".lnk"; | 1259 std::wstring lnk_path = app_path.value() + L".lnk"; |
1259 | 1260 |
1260 base::win::ScopedCOMInitializer com_initializer; | 1261 base::win::ScopedCOMInitializer com_initializer; |
1261 | 1262 |
1262 // Temporarily create a shortcut for test | 1263 // Temporarily create a shortcut for test |
1263 { | 1264 { |
1264 base::win::ScopedComPtr<IShellLink> shell; | 1265 base::win::ScopedComPtr<IShellLink> shell; |
1265 ASSERT_TRUE(SUCCEEDED(shell.CreateInstance(CLSID_ShellLink, NULL, | 1266 ASSERT_TRUE(SUCCEEDED(::CoCreateInstance( |
1266 CLSCTX_INPROC_SERVER))); | 1267 CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&shell)))); |
1267 base::win::ScopedComPtr<IPersistFile> persist; | 1268 base::win::ScopedComPtr<IPersistFile> persist; |
1268 ASSERT_TRUE(SUCCEEDED(shell.CopyTo(persist.GetAddressOf()))); | 1269 ASSERT_TRUE(SUCCEEDED(shell.CopyTo(persist.GetAddressOf()))); |
1269 EXPECT_TRUE(SUCCEEDED(shell->SetPath(app_path.value().c_str()))); | 1270 EXPECT_TRUE(SUCCEEDED(shell->SetPath(app_path.value().c_str()))); |
1270 EXPECT_TRUE(SUCCEEDED(shell->SetDescription(L"ResolveShortcutTest"))); | 1271 EXPECT_TRUE(SUCCEEDED(shell->SetDescription(L"ResolveShortcutTest"))); |
1271 EXPECT_TRUE(SUCCEEDED(persist->Save(lnk_path.c_str(), TRUE))); | 1272 EXPECT_TRUE(SUCCEEDED(persist->Save(lnk_path.c_str(), TRUE))); |
1272 } | 1273 } |
1273 | 1274 |
1274 TestDelegate d; | 1275 TestDelegate d; |
1275 { | 1276 { |
1276 std::unique_ptr<URLRequest> r(default_context_.CreateRequest( | 1277 std::unique_ptr<URLRequest> r(default_context_.CreateRequest( |
(...skipping 9781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11058 AddTestInterceptor()->set_main_intercept_job(std::move(job)); | 11059 AddTestInterceptor()->set_main_intercept_job(std::move(job)); |
11059 | 11060 |
11060 req->Start(); | 11061 req->Start(); |
11061 req->Cancel(); | 11062 req->Cancel(); |
11062 base::RunLoop().RunUntilIdle(); | 11063 base::RunLoop().RunUntilIdle(); |
11063 EXPECT_EQ(ERR_ABORTED, d.request_status()); | 11064 EXPECT_EQ(ERR_ABORTED, d.request_status()); |
11064 EXPECT_EQ(0, d.received_redirect_count()); | 11065 EXPECT_EQ(0, d.received_redirect_count()); |
11065 } | 11066 } |
11066 | 11067 |
11067 } // namespace net | 11068 } // namespace net |
OLD | NEW |