OLD | NEW |
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 Loading... |
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 Status GetWebViews(std::list<WebView*>* web_views) OVERRIDE { | 34 virtual Status GetWebViews(std::list<WebView*>* web_views) OVERRIDE { |
35 web_views->clear(); | 35 web_views->clear(); |
36 web_views->push_back(&web_view_); | 36 web_views->push_back(&web_view_); |
37 return Status(kOk); | 37 return Status(kOk); |
38 } | 38 } |
39 | 39 |
40 private: | 40 private: |
41 StubWebView web_view_; | 41 StubWebView web_view_; |
42 }; | 42 }; |
43 | 43 |
44 } // namespace | 44 } // namespace |
(...skipping 13 matching lines...) Expand all Loading... |
58 } | 58 } |
59 | 59 |
60 TEST(Session, GetTargetWindowTargetWindowStillOpen) { | 60 TEST(Session, GetTargetWindowTargetWindowStillOpen) { |
61 scoped_ptr<Chrome> chrome(new MockChrome()); | 61 scoped_ptr<Chrome> chrome(new MockChrome()); |
62 Session session("1", chrome.Pass()); | 62 Session session("1", chrome.Pass()); |
63 session.window = "1"; | 63 session.window = "1"; |
64 WebView* web_view = NULL; | 64 WebView* web_view = NULL; |
65 ASSERT_EQ(kOk, session.GetTargetWindow(&web_view).code()); | 65 ASSERT_EQ(kOk, session.GetTargetWindow(&web_view).code()); |
66 ASSERT_TRUE(web_view); | 66 ASSERT_TRUE(web_view); |
67 } | 67 } |
OLD | NEW |