| 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "chrome/test/chromedriver/chrome/status.h" | 8 #include "chrome/test/chromedriver/chrome/status.h" |
| 9 #include "chrome/test/chromedriver/chrome/stub_chrome.h" | 9 #include "chrome/test/chromedriver/chrome/stub_chrome.h" |
| 10 #include "chrome/test/chromedriver/chrome/stub_web_view.h" | 10 #include "chrome/test/chromedriver/chrome/stub_web_view.h" |
| 11 #include "chrome/test/chromedriver/session.h" | 11 #include "chrome/test/chromedriver/session.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 13 | 13 |
| 14 namespace { | 14 namespace { |
| 15 | 15 |
| 16 class MockChrome : public StubChrome { | 16 class MockChrome : public StubChrome { |
| 17 public: | 17 public: |
| 18 MockChrome() : web_view_("1") {} | 18 MockChrome() : web_view_("1") {} |
| 19 virtual ~MockChrome() {} | 19 virtual ~MockChrome() {} |
| 20 | 20 |
| 21 virtual Status GetWebViewById(const std::string& id, | 21 virtual Status GetWebViewById(const std::string& id, |
| 22 WebView** web_view) OVERRIDE { | 22 WebView** web_view) override { |
| 23 if (id == web_view_.GetId()) { | 23 if (id == web_view_.GetId()) { |
| 24 *web_view = &web_view_; | 24 *web_view = &web_view_; |
| 25 return Status(kOk); | 25 return Status(kOk); |
| 26 } | 26 } |
| 27 return Status(kUnknownError); | 27 return Status(kUnknownError); |
| 28 } | 28 } |
| 29 | 29 |
| 30 private: | 30 private: |
| 31 StubWebView web_view_; | 31 StubWebView web_view_; |
| 32 }; | 32 }; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 session.SwitchToTopFrame(); | 93 session.SwitchToTopFrame(); |
| 94 ASSERT_EQ(std::string(), session.GetCurrentFrameId()); | 94 ASSERT_EQ(std::string(), session.GetCurrentFrameId()); |
| 95 | 95 |
| 96 session.SwitchToSubFrame("3.1", std::string()); | 96 session.SwitchToSubFrame("3.1", std::string()); |
| 97 ASSERT_EQ("3.1", session.GetCurrentFrameId()); | 97 ASSERT_EQ("3.1", session.GetCurrentFrameId()); |
| 98 session.SwitchToSubFrame("3.2", std::string()); | 98 session.SwitchToSubFrame("3.2", std::string()); |
| 99 ASSERT_EQ("3.2", session.GetCurrentFrameId()); | 99 ASSERT_EQ("3.2", session.GetCurrentFrameId()); |
| 100 session.SwitchToTopFrame(); | 100 session.SwitchToTopFrame(); |
| 101 ASSERT_EQ(std::string(), session.GetCurrentFrameId()); | 101 ASSERT_EQ(std::string(), session.GetCurrentFrameId()); |
| 102 } | 102 } |
| OLD | NEW |