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

Unified Diff: chrome/test/chromedriver/chrome/frame_tracker_unittest.cc

Issue 13651002: [chromedriver] Fix 3 bugs with frame handling. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 9 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 | « chrome/test/chromedriver/chrome/frame_tracker.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/chromedriver/chrome/frame_tracker_unittest.cc
diff --git a/chrome/test/chromedriver/chrome/frame_tracker_unittest.cc b/chrome/test/chromedriver/chrome/frame_tracker_unittest.cc
index c8c718ecd0e3b61cf81dbe790cea7ac58690c7a3..ea43a0db4383b2ab30382b58011b728435a101bb 100644
--- a/chrome/test/chromedriver/chrome/frame_tracker_unittest.cc
+++ b/chrome/test/chromedriver/chrome/frame_tracker_unittest.cc
@@ -22,7 +22,8 @@ TEST(FrameTracker, GetContextIdForFrame) {
base::DictionaryValue params;
params.Set("context", base::JSONReader::Read(context));
tracker.OnEvent("Runtime.executionContextCreated", params);
- ASSERT_TRUE(tracker.GetContextIdForFrame("foo", &context_id).IsError());
+ ASSERT_EQ(kNoSuchFrame,
+ tracker.GetContextIdForFrame("foo", &context_id).code());
ASSERT_EQ(-1, context_id);
ASSERT_TRUE(tracker.GetContextIdForFrame("f", &context_id).IsOk());
ASSERT_EQ(100, context_id);
@@ -33,5 +34,24 @@ TEST(FrameTracker, GetContextIdForFrame) {
ASSERT_TRUE(tracker.GetContextIdForFrame("f", &context_id).IsOk());
nav_params.Clear();
tracker.OnEvent("Page.frameNavigated", nav_params);
- ASSERT_TRUE(tracker.GetContextIdForFrame("f", &context_id).IsError());
+ ASSERT_EQ(kNoSuchFrame,
+ tracker.GetContextIdForFrame("f", &context_id).code());
+}
+
+TEST(FrameTracker, CanUpdateFrameContextId) {
+ StubDevToolsClient client;
+ FrameTracker tracker(&client);
+
+ const char context[] = "{\"id\":1,\"frameId\":\"f\"}";
+ base::DictionaryValue params;
+ params.Set("context", base::JSONReader::Read(context));
+ tracker.OnEvent("Runtime.executionContextCreated", params);
+ int context_id = -1;
+ ASSERT_TRUE(tracker.GetContextIdForFrame("f", &context_id).IsOk());
+ ASSERT_EQ(1, context_id);
+
+ params.SetInteger("context.id", 2);
+ tracker.OnEvent("Runtime.executionContextCreated", params);
+ ASSERT_TRUE(tracker.GetContextIdForFrame("f", &context_id).IsOk());
+ ASSERT_EQ(2, context_id);
}
« no previous file with comments | « chrome/test/chromedriver/chrome/frame_tracker.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698