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

Unified Diff: chrome_frame/test/chrome_frame_test_utils.cc

Issue 11048053: Fix IE version check. (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome_frame/test/chrome_frame_test_utils.cc
diff --git a/chrome_frame/test/chrome_frame_test_utils.cc b/chrome_frame/test/chrome_frame_test_utils.cc
index d8d1e133b3d0a6dd05166e0eddfd76f72a04ceb1..ecc95d5acd057d505a02683db8661a88bcf2b998 100644
--- a/chrome_frame/test/chrome_frame_test_utils.cc
+++ b/chrome_frame/test/chrome_frame_test_utils.cc
@@ -19,6 +19,8 @@
#include "base/path_service.h"
#include "base/process.h"
#include "base/process_util.h"
+#include "base/string_number_conversions.h"
+#include "base/string_piece.h"
#include "base/string_util.h"
#include "base/stringprintf.h"
#include "base/utf_string_conversions.h"
@@ -420,19 +422,27 @@ std::wstring GetExeVersion(const std::wstring& exe_path) {
}
IEVersion GetInstalledIEVersion() {
- std::wstring path = chrome_frame_test::GetExecutableAppPath(kIEImageName);
- std::wstring version = GetExeVersion(path);
-
- switch (version[0]) {
- case '6':
+ std::wstring path(chrome_frame_test::GetExecutableAppPath(kIEImageName));
+ std::wstring version(GetExeVersion(path));
+ size_t first_dot = version.find(L'.');
+ int major_version = 0;
+ if (!base::StringToInt(base::StringPiece16(
+ version.data(),
+ first_dot == std::wstring::npos ? version.size() : first_dot),
+ &major_version)) {
+ return IE_UNSUPPORTED;
+ }
+
+ switch (major_version) {
+ case 6:
return IE_6;
- case '7':
+ case 7:
return IE_7;
- case '8':
+ case 8:
return IE_8;
- case '9':
+ case 9:
return IE_9;
- case '10':
+ case 10:
return IE_10;
default:
break;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698