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

Side by Side Diff: chrome_frame/test/chrome_frame_test_utils.cc

Issue 10197011: Share the "get CF profile dir" code between ChromeFramePlugin and chrome_frame_test_utils.h. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 7 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 "chrome_frame/test/chrome_frame_test_utils.h" 5 #include "chrome_frame/test/chrome_frame_test_utils.h"
6 6
7 #include <atlapp.h> 7 #include <atlapp.h>
8 #include <atlmisc.h> 8 #include <atlmisc.h>
9 #include <iepmapi.h> 9 #include <iepmapi.h>
10 #include <sddl.h> 10 #include <sddl.h>
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 cocreate_flags |= CLSCTX_ENABLE_CLOAKING; 406 cocreate_flags |= CLSCTX_ENABLE_CLOAKING;
407 } 407 }
408 408
409 hr = ::CoCreateInstance(CLSID_InternetExplorer, NULL, 409 hr = ::CoCreateInstance(CLSID_InternetExplorer, NULL,
410 cocreate_flags, IID_IWebBrowser2, 410 cocreate_flags, IID_IWebBrowser2,
411 reinterpret_cast<void**>(web_browser)); 411 reinterpret_cast<void**>(web_browser));
412 // ~LowIntegrityToken() will switch integrity back to medium. 412 // ~LowIntegrityToken() will switch integrity back to medium.
413 return hr; 413 return hr;
414 } 414 }
415 415
416 // TODO(joi@chromium.org) Could share this code with chrome_frame_plugin.h
417 FilePath GetProfilePath(const std::wstring& profile_name) {
418 FilePath profile_path;
419 chrome::GetChromeFrameUserDataDirectory(&profile_path);
420 return profile_path.Append(profile_name);
421 }
422
423 std::wstring GetExeVersion(const std::wstring& exe_path) { 416 std::wstring GetExeVersion(const std::wstring& exe_path) {
424 scoped_ptr<FileVersionInfo> ie_version_info( 417 scoped_ptr<FileVersionInfo> ie_version_info(
425 FileVersionInfo::CreateFileVersionInfo(FilePath(exe_path))); 418 FileVersionInfo::CreateFileVersionInfo(FilePath(exe_path)));
426 return ie_version_info->product_version(); 419 return ie_version_info->product_version();
427 } 420 }
428 421
429 IEVersion GetInstalledIEVersion() { 422 IEVersion GetInstalledIEVersion() {
430 std::wstring path = chrome_frame_test::GetExecutableAppPath(kIEImageName); 423 std::wstring path = chrome_frame_test::GetExecutableAppPath(kIEImageName);
431 std::wstring version = GetExeVersion(path); 424 std::wstring version = GetExeVersion(path);
432 425
(...skipping 18 matching lines...) Expand all
451 FilePath GetProfilePathForIE() { 444 FilePath GetProfilePathForIE() {
452 FilePath profile_path; 445 FilePath profile_path;
453 // Browsers without IDeleteBrowsingHistory in non-priv mode 446 // Browsers without IDeleteBrowsingHistory in non-priv mode
454 // have their profiles moved into "Temporary Internet Files". 447 // have their profiles moved into "Temporary Internet Files".
455 // The code below basically retrieves the version of IE and computes 448 // The code below basically retrieves the version of IE and computes
456 // the profile directory accordingly. 449 // the profile directory accordingly.
457 if (GetInstalledIEVersion() <= IE_7) { 450 if (GetInstalledIEVersion() <= IE_7) {
458 profile_path = GetIETemporaryFilesFolder(); 451 profile_path = GetIETemporaryFilesFolder();
459 profile_path = profile_path.Append(L"Google Chrome Frame"); 452 profile_path = profile_path.Append(L"Google Chrome Frame");
460 } else { 453 } else {
461 profile_path = GetProfilePath(kIEProfileName); 454 GetChromeFrameProfilePath(kIEProfileName, &profile_path);
462 } 455 }
463 return profile_path; 456 return profile_path;
464 } 457 }
465 458
466 FilePath GetTestDataFolder() { 459 FilePath GetTestDataFolder() {
467 FilePath test_dir; 460 FilePath test_dir;
468 PathService::Get(base::DIR_SOURCE_ROOT, &test_dir); 461 PathService::Get(base::DIR_SOURCE_ROOT, &test_dir);
469 test_dir = test_dir.Append(FILE_PATH_LITERAL("chrome_frame")) 462 test_dir = test_dir.Append(FILE_PATH_LITERAL("chrome_frame"))
470 .Append(FILE_PATH_LITERAL("test")) 463 .Append(FILE_PATH_LITERAL("test"))
471 .Append(FILE_PATH_LITERAL("data")); 464 .Append(FILE_PATH_LITERAL("data"));
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
707 if (address.empty()) { 700 if (address.empty()) {
708 LOG(ERROR) << "Failed to find a non-loopback IP_V4 address. Tests will be " 701 LOG(ERROR) << "Failed to find a non-loopback IP_V4 address. Tests will be "
709 << "run over the loopback adapter, which may result in hangs."; 702 << "run over the loopback adapter, which may result in hangs.";
710 address.assign("127.0.0.1"); 703 address.assign("127.0.0.1");
711 } 704 }
712 705
713 return address; 706 return address;
714 } 707 }
715 708
716 } // namespace chrome_frame_test 709 } // namespace chrome_frame_test
OLDNEW
« no previous file with comments | « chrome_frame/test/chrome_frame_test_utils.h ('k') | chrome_frame/test/delete_chrome_history_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698