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

Side by Side Diff: chrome/test/chromedriver/frame_tracker.cc

Issue 12093057: [ChromeDriver] Send DOM.getDocument after each DOM.documentUpdated. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix compile error on win_rel Created 7 years, 10 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
« no previous file with comments | « chrome/test/chromedriver/frame_tracker.h ('k') | chrome/test/chromedriver/navigation_tracker.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/test/chromedriver/frame_tracker.h" 5 #include "chrome/test/chromedriver/frame_tracker.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/json/json_writer.h" 9 #include "base/json/json_writer.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/values.h" 11 #include "base/values.h"
12 #include "chrome/test/chromedriver/devtools_client.h"
12 #include "chrome/test/chromedriver/status.h" 13 #include "chrome/test/chromedriver/status.h"
13 14
14 FrameTracker::FrameTracker() {} 15 FrameTracker::FrameTracker() {}
15 16
16 FrameTracker::~FrameTracker() {} 17 FrameTracker::~FrameTracker() {}
17 18
19 Status FrameTracker::Init(DevToolsClient* client) {
20 // Enable runtime events to allow tracking execution context creation.
21 base::DictionaryValue params;
22 DCHECK(client);
23 return client->SendCommand("Runtime.enable", params);
24 }
25
18 Status FrameTracker::GetFrameForContextId( 26 Status FrameTracker::GetFrameForContextId(
19 int context_id, std::string* frame_id) { 27 int context_id, std::string* frame_id) {
20 if (context_to_frame_map_.count(context_id) == 0) 28 if (context_to_frame_map_.count(context_id) == 0)
21 return Status(kUnknownError, "execution context does not have a frame"); 29 return Status(kUnknownError, "execution context does not have a frame");
22 *frame_id = context_to_frame_map_[context_id]; 30 *frame_id = context_to_frame_map_[context_id];
23 return Status(kOk); 31 return Status(kOk);
24 } 32 }
25 33
26 Status FrameTracker::GetContextIdForFrame( 34 Status FrameTracker::GetContextIdForFrame(
27 const std::string& frame_id, int* context_id) { 35 const std::string& frame_id, int* context_id) {
(...skipping 21 matching lines...) Expand all
49 << json; 57 << json;
50 return; 58 return;
51 } 59 }
52 frame_to_context_map_.insert(std::make_pair(frame_id, context_id)); 60 frame_to_context_map_.insert(std::make_pair(frame_id, context_id));
53 context_to_frame_map_.insert(std::make_pair(context_id, frame_id)); 61 context_to_frame_map_.insert(std::make_pair(context_id, frame_id));
54 } else if (method == "DOM.documentUpdated") { 62 } else if (method == "DOM.documentUpdated") {
55 frame_to_context_map_.clear(); 63 frame_to_context_map_.clear();
56 context_to_frame_map_.clear(); 64 context_to_frame_map_.clear();
57 } 65 }
58 } 66 }
OLDNEW
« no previous file with comments | « chrome/test/chromedriver/frame_tracker.h ('k') | chrome/test/chromedriver/navigation_tracker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698