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" |
| 11 #include "chrome/test/chromedriver/chrome/status.h" |
| 12 #include "chrome/test/chromedriver/chrome/stub_chrome.h" |
| 13 #include "chrome/test/chromedriver/chrome/stub_web_view.h" |
11 #include "chrome/test/chromedriver/session.h" | 14 #include "chrome/test/chromedriver/session.h" |
12 #include "chrome/test/chromedriver/status.h" | |
13 #include "chrome/test/chromedriver/stub_chrome.h" | |
14 #include "chrome/test/chromedriver/stub_web_view.h" | |
15 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
16 | 16 |
17 TEST(SessionAccessorTest, LocksSession) { | 17 TEST(SessionAccessorTest, LocksSession) { |
18 scoped_ptr<Session> scoped_session(new Session("id")); | 18 scoped_ptr<Session> scoped_session(new Session("id")); |
19 Session* session = scoped_session.get(); | 19 Session* session = scoped_session.get(); |
20 scoped_refptr<SessionAccessor> accessor( | 20 scoped_refptr<SessionAccessor> accessor( |
21 new SessionAccessorImpl(scoped_session.Pass())); | 21 new SessionAccessorImpl(scoped_session.Pass())); |
22 scoped_ptr<base::AutoLock> lock; | 22 scoped_ptr<base::AutoLock> lock; |
23 ASSERT_EQ(session, accessor->Access(&lock)); | 23 ASSERT_EQ(session, accessor->Access(&lock)); |
24 ASSERT_TRUE(lock.get()); | 24 ASSERT_TRUE(lock.get()); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |