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

Unified Diff: chrome/browser/ui/webui/engagement/site_engagement_ui_browsertest.cc

Issue 2808663002: Add base and bonus scores to site-engagement WebUI. (Closed)
Patch Set: Address review comments Created 3 years, 8 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
Index: chrome/browser/ui/webui/engagement/site_engagement_ui_browsertest.cc
diff --git a/chrome/browser/ui/webui/engagement/site_engagement_ui_browsertest.cc b/chrome/browser/ui/webui/engagement/site_engagement_ui_browsertest.cc
index 7a437bdf3c24f87a946a32249a64d06dd4dd7f85..7ca297b7c85e0c5e0d0beed50314760b4145feff 100644
--- a/chrome/browser/ui/webui/engagement/site_engagement_ui_browsertest.cc
+++ b/chrome/browser/ui/webui/engagement/site_engagement_ui_browsertest.cc
@@ -96,17 +96,50 @@ class SiteEngagementUiBrowserTest : public InProcessBrowserTest {
return origin_url;
}
- // Returns the stringified score at the specified zero-based row index.
- std::string ScoreAtRow(int index) {
+ // Returns the stringified base score at the specified zero-based row index.
+ std::string BaseScoreAtRow(int index) {
EXPECT_TRUE(page_is_populated_);
std::string score_string;
EXPECT_TRUE(content::ExecuteScriptAndExtractString(
browser()->tab_strip_model()->GetActiveWebContents(),
- base::JoinString({"window.domAutomationController.send("
- " document.getElementsByClassName('score-input')[",
- base::IntToString(index), "].value);"},
- ""),
+ base::JoinString(
+ {"window.domAutomationController.send("
+ " document.getElementsByClassName('base-score-input')[",
+ base::IntToString(index), "].value);"},
+ ""),
+ &score_string));
+
+ return score_string;
+ }
+
+ std::string BonusScoreAtRow(int index) {
+ EXPECT_TRUE(page_is_populated_);
+
+ std::string score_string;
+ EXPECT_TRUE(content::ExecuteScriptAndExtractString(
+ browser()->tab_strip_model()->GetActiveWebContents(),
+ base::JoinString(
+ {"window.domAutomationController.send("
+ " document.getElementsByClassName('bonus-score-cell')[",
+ base::IntToString(index), "].innerHTML);"},
+ ""),
+ &score_string));
+
+ return score_string;
+ }
+
+ std::string TotalScoreAtRow(int index) {
+ EXPECT_TRUE(page_is_populated_);
+
+ std::string score_string;
+ EXPECT_TRUE(content::ExecuteScriptAndExtractString(
+ browser()->tab_strip_model()->GetActiveWebContents(),
+ base::JoinString(
+ {"window.domAutomationController.send("
+ " document.getElementsByClassName('total-score-cell')[",
+ base::IntToString(index), "].innerHTML);"},
+ ""),
&score_string));
return score_string;
@@ -135,5 +168,7 @@ IN_PROC_BROWSER_TEST_F(SiteEngagementUiBrowserTest,
WaitUntilPagePopulated();
EXPECT_EQ(1, NumberOfRows());
- EXPECT_EQ("3.14", ScoreAtRow(0));
+ EXPECT_EQ("3.14", BaseScoreAtRow(0));
+ EXPECT_EQ("0", BonusScoreAtRow(0));
+ EXPECT_EQ("3.14", TotalScoreAtRow(0));
}

Powered by Google App Engine
This is Rietveld 408576698