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

Side by Side Diff: chrome/browser/chromeos/login/test/js_checker.cc

Issue 2347013002: Fix how JsChecker::GetBoolImpl enforces boolean result (Closed)
Patch Set: Created 4 years, 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/browser/chromeos/login/test/js_checker.h" 5 #include "chrome/browser/chromeos/login/test/js_checker.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "content/public/browser/render_frame_host.h" 8 #include "content/public/browser/render_frame_host.h"
9 #include "content/public/browser/web_contents.h" 9 #include "content/public/browser/web_contents.h"
10 #include "content/public/test/browser_test_utils.h" 10 #include "content/public/test/browser_test_utils.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 EXPECT_EQ(GetString(expression), result) << expression; 79 EXPECT_EQ(GetString(expression), result) << expression;
80 } 80 }
81 81
82 void JSChecker::ExpectNE(const std::string& expression, 82 void JSChecker::ExpectNE(const std::string& expression,
83 const std::string& result) { 83 const std::string& result) {
84 EXPECT_NE(GetString(expression), result) << expression; 84 EXPECT_NE(GetString(expression), result) << expression;
85 } 85 }
86 86
87 void JSChecker::GetBoolImpl(const std::string& expression, bool* result) { 87 void JSChecker::GetBoolImpl(const std::string& expression, bool* result) {
88 CHECK(web_contents_); 88 CHECK(web_contents_);
89 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(web_contents_, 89 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(
90 "!!" + WrapSend(expression), 90 web_contents_, WrapSend("!!(" + expression + ")"), result));
91 result));
92 } 91 }
93 92
94 void JSChecker::GetIntImpl(const std::string& expression, int* result) { 93 void JSChecker::GetIntImpl(const std::string& expression, int* result) {
95 CHECK(web_contents_); 94 CHECK(web_contents_);
96 ASSERT_TRUE(content::ExecuteScriptAndExtractInt(web_contents_, 95 ASSERT_TRUE(content::ExecuteScriptAndExtractInt(web_contents_,
97 WrapSend(expression), 96 WrapSend(expression),
98 result)); 97 result));
99 } 98 }
100 99
101 void JSChecker::GetStringImpl(const std::string& expression, 100 void JSChecker::GetStringImpl(const std::string& expression,
102 std::string* result) { 101 std::string* result) {
103 CHECK(web_contents_); 102 CHECK(web_contents_);
104 ASSERT_TRUE(content::ExecuteScriptAndExtractString(web_contents_, 103 ASSERT_TRUE(content::ExecuteScriptAndExtractString(web_contents_,
105 WrapSend(expression), 104 WrapSend(expression),
106 result)); 105 result));
107 } 106 }
108 107
109 } // namespace test 108 } // namespace test
110 } // namespace chromeos 109 } // namespace chromeos
OLDNEW
« 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