| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/browser/media/media_internals.h" | 5 #include "chrome/browser/media/media_internals.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "chrome/browser/media/media_internals_observer.h" | 8 #include "chrome/browser/media/media_internals_observer.h" |
| 9 #include "testing/gmock/include/gmock/gmock.h" | 9 #include "testing/gmock/include/gmock/gmock.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 11 | 11 |
| 12 class MockMediaInternalsObserver : public MediaInternalsObserver { | 12 class MockMediaInternalsObserver : public MediaInternalsObserver { |
| 13 public: | 13 public: |
| 14 MOCK_METHOD1(OnUpdate, void(const string16& javascript)); | 14 MOCK_METHOD1(OnUpdate, void(const string16& javascript)); |
| 15 }; | 15 }; |
| 16 | 16 |
| 17 class MediaInternalsTest : public testing::Test { | 17 class MediaInternalsTest : public testing::Test { |
| 18 public: | 18 public: |
| 19 DictionaryValue* data() { | 19 DictionaryValue* data() { |
| 20 return &internals_->data_; | 20 return &internals_->data_; |
| 21 } | 21 } |
| 22 | 22 |
| 23 void DeleteItem(const std::string& item) { | 23 void DeleteItem(const std::string& item) { |
| 24 internals_->DeleteItem(item); | 24 internals_->DeleteItem(item); |
| 25 } | 25 } |
| 26 | 26 |
| 27 void UpdateItem(const std::string& item, const std::string& property, | 27 void UpdateItem(const std::string& item, const std::string& property, |
| 28 Value* value) { | 28 Value* value) { |
| 29 internals_->UpdateItem("", item, property, value); | 29 internals_->SetItemProperty("", item, property, value); |
| 30 } | 30 } |
| 31 | 31 |
| 32 void SendUpdate(const std::string& function, Value* value) { | 32 void SendUpdate(const std::string& function, Value* value) { |
| 33 internals_->SendUpdate(function, value); | 33 internals_->SendUpdate(function, value); |
| 34 } | 34 } |
| 35 | 35 |
| 36 protected: | 36 protected: |
| 37 virtual void SetUp() { | 37 virtual void SetUp() { |
| 38 internals_.reset(new MediaInternals()); | 38 internals_.reset(new MediaInternals()); |
| 39 } | 39 } |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 EXPECT_TRUE(data()->Get("some", &out)); | 99 EXPECT_TRUE(data()->Get("some", &out)); |
| 100 | 100 |
| 101 DeleteItem("some.item"); | 101 DeleteItem("some.item"); |
| 102 EXPECT_FALSE(data()->Get("some.item", &out)); | 102 EXPECT_FALSE(data()->Get("some.item", &out)); |
| 103 EXPECT_TRUE(data()->Get("some", &out)); | 103 EXPECT_TRUE(data()->Get("some", &out)); |
| 104 | 104 |
| 105 DeleteItem("some"); | 105 DeleteItem("some"); |
| 106 EXPECT_FALSE(data()->Get("some.item", &out)); | 106 EXPECT_FALSE(data()->Get("some.item", &out)); |
| 107 EXPECT_FALSE(data()->Get("some", &out)); | 107 EXPECT_FALSE(data()->Get("some", &out)); |
| 108 } | 108 } |
| OLD | NEW |