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

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

Issue 12093057: [ChromeDriver] Send DOM.getDocument after each DOM.documentUpdated. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: actually uploaded the files 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
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include <list>
6 #include <string>
7
8 #include "base/compiler_specific.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/values.h"
11 #include "chrome/test/chromedriver/devtools_client.h"
12 #include "chrome/test/chromedriver/devtools_state.h"
13 #include "chrome/test/chromedriver/status.h"
14 #include "testing/gtest/include/gtest/gtest.h"
15
16 namespace {
17
18 class FakeDevToolsClient : public DevToolsClient {
19 public:
20 FakeDevToolsClient() : send_count_(0) {}
21 virtual ~FakeDevToolsClient() {}
22
23 int GetSendCount() {
24 return send_count_;
25 }
26
27 // Overridden from DevToolsClient:
28 virtual Status SendCommand(const std::string& method,
29 const base::DictionaryValue& params) OVERRIDE {
30 ++send_count_;
31 return Status(kOk);
32 }
33 virtual Status SendCommandAndGetResult(
34 const std::string& method,
35 const base::DictionaryValue& params,
36 scoped_ptr<base::DictionaryValue>* result) OVERRIDE {
37 ++send_count_;
38 return Status(kOk);
39 }
40 virtual void AddListener(DevToolsEventListener* listener) OVERRIDE {}
41 virtual Status HandleEventsUntil(
42 const ConditionalFunc& conditional_func) OVERRIDE {
43 return Status(kOk);
44 }
45
46 private:
kkania 2013/01/30 18:50:29 bad indent
craigdh 2013/01/30 22:20:04 Done.
47 int send_count_;
48 };
49
50 } // namespace
51
52 TEST(DevToolsState, Init) {
53 FakeDevToolsClient client;
54 DevToolsState state(&client);
55 base::DictionaryValue params;
56 state.Init();
57 ASSERT_EQ(client.GetSendCount(), 3);
kkania 2013/01/30 18:50:29 this is brittle and I'm not sure is very helpful.
craigdh 2013/01/30 22:20:04 Done.
58 }
59
60 TEST(DevToolsState, OnEvent) {
61 FakeDevToolsClient client;
62 DevToolsState state(&client);
63 base::DictionaryValue params;
64 state.OnEvent("DOM.documentUpdated", params);
65 ASSERT_EQ(client.GetSendCount(), 1);
66 }
OLDNEW
« chrome/test/chromedriver/devtools_state.cc ('K') | « chrome/test/chromedriver/devtools_state.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698