| 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 "chrome/test/chromedriver/commands.h" |
| 6 |
| 5 #include <stddef.h> | 7 #include <stddef.h> |
| 6 | |
| 7 #include <string> | 8 #include <string> |
| 9 #include <utility> |
| 8 | 10 |
| 9 #include "base/bind.h" | 11 #include "base/bind.h" |
| 10 #include "base/callback.h" | 12 #include "base/callback.h" |
| 11 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 12 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
| 13 #include "base/location.h" | 15 #include "base/location.h" |
| 14 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/run_loop.h" | 17 #include "base/run_loop.h" |
| 16 #include "base/single_thread_task_runner.h" | 18 #include "base/single_thread_task_runner.h" |
| 17 #include "base/synchronization/lock.h" | 19 #include "base/synchronization/lock.h" |
| 18 #include "base/threading/thread.h" | 20 #include "base/threading/thread.h" |
| 19 #include "base/values.h" | 21 #include "base/values.h" |
| 20 #include "chrome/test/chromedriver/chrome/status.h" | 22 #include "chrome/test/chromedriver/chrome/status.h" |
| 21 #include "chrome/test/chromedriver/chrome/stub_chrome.h" | 23 #include "chrome/test/chromedriver/chrome/stub_chrome.h" |
| 22 #include "chrome/test/chromedriver/chrome/stub_web_view.h" | 24 #include "chrome/test/chromedriver/chrome/stub_web_view.h" |
| 23 #include "chrome/test/chromedriver/chrome/web_view.h" | 25 #include "chrome/test/chromedriver/chrome/web_view.h" |
| 24 #include "chrome/test/chromedriver/command_listener_proxy.h" | 26 #include "chrome/test/chromedriver/command_listener_proxy.h" |
| 25 #include "chrome/test/chromedriver/commands.h" | |
| 26 #include "chrome/test/chromedriver/element_commands.h" | 27 #include "chrome/test/chromedriver/element_commands.h" |
| 27 #include "chrome/test/chromedriver/session.h" | 28 #include "chrome/test/chromedriver/session.h" |
| 28 #include "chrome/test/chromedriver/session_commands.h" | 29 #include "chrome/test/chromedriver/session_commands.h" |
| 29 #include "chrome/test/chromedriver/window_commands.h" | 30 #include "chrome/test/chromedriver/window_commands.h" |
| 30 #include "testing/gtest/include/gtest/gtest.h" | 31 #include "testing/gtest/include/gtest/gtest.h" |
| 31 #include "third_party/webdriver/atoms.h" | 32 #include "third_party/webdriver/atoms.h" |
| 32 | 33 |
| 33 namespace { | 34 namespace { |
| 34 | 35 |
| 35 void OnGetStatus(const Status& status, | 36 void OnGetStatus(const Status& status, |
| (...skipping 27 matching lines...) Expand all Loading... |
| 63 } else { | 64 } else { |
| 64 EXPECT_STREQ("id2", session_id.c_str()); | 65 EXPECT_STREQ("id2", session_id.c_str()); |
| 65 } | 66 } |
| 66 (*count)++; | 67 (*count)++; |
| 67 | 68 |
| 68 scoped_ptr<base::DictionaryValue> capabilities(new base::DictionaryValue()); | 69 scoped_ptr<base::DictionaryValue> capabilities(new base::DictionaryValue()); |
| 69 | 70 |
| 70 capabilities->Set("capability1", new base::StringValue("test1")); | 71 capabilities->Set("capability1", new base::StringValue("test1")); |
| 71 capabilities->Set("capability2", new base::StringValue("test2")); | 72 capabilities->Set("capability2", new base::StringValue("test2")); |
| 72 | 73 |
| 73 callback.Run(Status(kOk), capabilities.Pass(), session_id); | 74 callback.Run(Status(kOk), std::move(capabilities), session_id); |
| 74 } | 75 } |
| 75 | 76 |
| 76 void OnGetSessions(const Status& status, | 77 void OnGetSessions(const Status& status, |
| 77 scoped_ptr<base::Value> value, | 78 scoped_ptr<base::Value> value, |
| 78 const std::string& session_id) { | 79 const std::string& session_id) { |
| 79 ASSERT_EQ(kOk, status.code()); | 80 ASSERT_EQ(kOk, status.code()); |
| 80 ASSERT_TRUE(value.get()); | 81 ASSERT_TRUE(value.get()); |
| 81 base::ListValue* sessions; | 82 base::ListValue* sessions; |
| 82 ASSERT_TRUE(value->GetAsList(&sessions)); | 83 ASSERT_TRUE(value->GetAsList(&sessions)); |
| 83 ASSERT_EQ(static_cast<size_t>(2), sessions->GetSize()); | 84 ASSERT_EQ(static_cast<size_t>(2), sessions->GetSize()); |
| (...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 816 cmd, | 817 cmd, |
| 817 false, | 818 false, |
| 818 params, | 819 params, |
| 819 id, | 820 id, |
| 820 base::Bind(&OnFailBecauseErrorNotifyingListeners, &run_loop)); | 821 base::Bind(&OnFailBecauseErrorNotifyingListeners, &run_loop)); |
| 821 run_loop.Run(); | 822 run_loop.Run(); |
| 822 | 823 |
| 823 thread->task_runner()->PostTask(FROM_HERE, | 824 thread->task_runner()->PostTask(FROM_HERE, |
| 824 base::Bind(&VerifySessionWasDeleted)); | 825 base::Bind(&VerifySessionWasDeleted)); |
| 825 } | 826 } |
| OLD | NEW |