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

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

Issue 12978003: [chromedriver] Fix 3 bugs about web view, window handle and target window. (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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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 <list> 5 #include <list>
6 #include <string> 6 #include <string>
7 7
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/synchronization/lock.h" 10 #include "base/synchronization/lock.h"
(...skipping 13 matching lines...) Expand all
24 ASSERT_TRUE(lock.get()); 24 ASSERT_TRUE(lock.get());
25 } 25 }
26 26
27 namespace { 27 namespace {
28 28
29 class MockChrome : public StubChrome { 29 class MockChrome : public StubChrome {
30 public: 30 public:
31 MockChrome() : web_view_("1") {} 31 MockChrome() : web_view_("1") {}
32 virtual ~MockChrome() {} 32 virtual ~MockChrome() {}
33 33
34 virtual Status GetWebViews(std::list<WebView*>* web_views) OVERRIDE { 34 virtual Status GetWebViewById(const std::string& id,
35 web_views->clear(); 35 WebView** web_view) OVERRIDE {
36 web_views->push_back(&web_view_); 36 if (id == web_view_.GetId()) {
37 return Status(kOk); 37 *web_view = &web_view_;
38 return Status(kOk);
39 }
40 return Status(kUnknownError);
38 } 41 }
39 42
40 private: 43 private:
41 StubWebView web_view_; 44 StubWebView web_view_;
42 }; 45 };
43 46
44 } // namespace 47 } // namespace
45 48
46 TEST(Session, GetTargetWindowNoChrome) { 49 TEST(Session, GetTargetWindowNoChrome) {
47 Session session("1"); 50 Session session("1");
(...skipping 10 matching lines...) Expand all
58 } 61 }
59 62
60 TEST(Session, GetTargetWindowTargetWindowStillOpen) { 63 TEST(Session, GetTargetWindowTargetWindowStillOpen) {
61 scoped_ptr<Chrome> chrome(new MockChrome()); 64 scoped_ptr<Chrome> chrome(new MockChrome());
62 Session session("1", chrome.Pass()); 65 Session session("1", chrome.Pass());
63 session.window = "1"; 66 session.window = "1";
64 WebView* web_view = NULL; 67 WebView* web_view = NULL;
65 ASSERT_EQ(kOk, session.GetTargetWindow(&web_view).code()); 68 ASSERT_EQ(kOk, session.GetTargetWindow(&web_view).code());
66 ASSERT_TRUE(web_view); 69 ASSERT_TRUE(web_view);
67 } 70 }
OLDNEW
« chrome/test/chromedriver/chrome/chrome_impl.h ('K') | « chrome/test/chromedriver/session_commands.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698