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

Side by Side Diff: net/url_request/url_request_unittest.cc

Issue 10991052: Miscellaneous tiny cleanups done while converting files to use ScopedCOMInitializer, pulled out sep… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 2 months 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 | Annotate | Revision Log
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 #include "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #include <shlobj.h> 9 #include <shlobj.h>
10 #endif 10 #endif
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after
695 TEST_F(URLRequestTest, ResolveShortcutTest) { 695 TEST_F(URLRequestTest, ResolveShortcutTest) {
696 FilePath app_path; 696 FilePath app_path;
697 PathService::Get(base::DIR_SOURCE_ROOT, &app_path); 697 PathService::Get(base::DIR_SOURCE_ROOT, &app_path);
698 app_path = app_path.AppendASCII("net"); 698 app_path = app_path.AppendASCII("net");
699 app_path = app_path.AppendASCII("data"); 699 app_path = app_path.AppendASCII("data");
700 app_path = app_path.AppendASCII("url_request_unittest"); 700 app_path = app_path.AppendASCII("url_request_unittest");
701 app_path = app_path.AppendASCII("with-headers.html"); 701 app_path = app_path.AppendASCII("with-headers.html");
702 702
703 std::wstring lnk_path = app_path.value() + L".lnk"; 703 std::wstring lnk_path = app_path.value() + L".lnk";
704 704
705 HRESULT result; 705 CoInitialize(NULL);
Ryan Sleevi 2012/10/01 14:21:01 According to the e-mail that went out, there shoul
Peter Kasting 2012/10/01 18:18:55 I am in fact going to change this to ScopedCOMInit
Ryan Sleevi 2012/10/01 20:54:43 For some reason, I thought there were more places
706
707 // Temporarily create a shortcut for test
706 IShellLink* shell = NULL; 708 IShellLink* shell = NULL;
709 ASSERT_TRUE(SUCCEEDED(CoCreateInstance(
710 CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink,
711 reinterpret_cast<LPVOID*>(&shell))));
707 IPersistFile* persist = NULL; 712 IPersistFile* persist = NULL;
708 713 ASSERT_TRUE(SUCCEEDED(shell->QueryInterface(
709 CoInitialize(NULL); 714 IID_IPersistFile, reinterpret_cast<LPVOID*>(&persist))));
710 // Temporarily create a shortcut for test 715 EXPECT_TRUE(SUCCEEDED(shell->SetPath(app_path.value().c_str())));
711 result = CoCreateInstance(CLSID_ShellLink, NULL, 716 EXPECT_TRUE(SUCCEEDED(shell->SetDescription(L"ResolveShortcutTest")));
712 CLSCTX_INPROC_SERVER, IID_IShellLink, 717 EXPECT_TRUE(SUCCEEDED(persist->Save(lnk_path.c_str(), TRUE)));
713 reinterpret_cast<LPVOID*>(&shell));
714 ASSERT_TRUE(SUCCEEDED(result));
715 result = shell->QueryInterface(IID_IPersistFile,
716 reinterpret_cast<LPVOID*>(&persist));
717 ASSERT_TRUE(SUCCEEDED(result));
718 result = shell->SetPath(app_path.value().c_str());
719 EXPECT_TRUE(SUCCEEDED(result));
720 result = shell->SetDescription(L"ResolveShortcutTest");
721 EXPECT_TRUE(SUCCEEDED(result));
722 result = persist->Save(lnk_path.c_str(), TRUE);
723 EXPECT_TRUE(SUCCEEDED(result));
724 if (persist) 718 if (persist)
725 persist->Release(); 719 persist->Release();
726 if (shell) 720 if (shell)
727 shell->Release(); 721 shell->Release();
728 722
729 TestDelegate d; 723 TestDelegate d;
730 { 724 {
731 URLRequest r(FilePathToFileURL(FilePath(lnk_path)), &d, &default_context_); 725 URLRequest r(FilePathToFileURL(FilePath(lnk_path)), &d, &default_context_);
732 726
733 r.Start(); 727 r.Start();
(...skipping 4057 matching lines...) Expand 10 before | Expand all | Expand 10 after
4791 4785
4792 EXPECT_FALSE(r.is_pending()); 4786 EXPECT_FALSE(r.is_pending());
4793 EXPECT_EQ(1, d->response_started_count()); 4787 EXPECT_EQ(1, d->response_started_count());
4794 EXPECT_FALSE(d->received_data_before_response()); 4788 EXPECT_FALSE(d->received_data_before_response());
4795 EXPECT_EQ(d->bytes_received(), static_cast<int>(file_size)); 4789 EXPECT_EQ(d->bytes_received(), static_cast<int>(file_size));
4796 } 4790 }
4797 } 4791 }
4798 #endif // !defined(DISABLE_FTP_SUPPORT) 4792 #endif // !defined(DISABLE_FTP_SUPPORT)
4799 4793
4800 } // namespace net 4794 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698