diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-14 17:58:00 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-14 17:58:00 +0000 |
commit | 716775259699430736d1a461131d2bc9982e1dc3 (patch) | |
tree | 825820a1778ba504a8319cae95b9b8d79a0742b5 /content/browser/media | |
parent | 3eacfb1de4c166b7c5606ccc4e2943c80f75e16a (diff) | |
download | chromium_src-716775259699430736d1a461131d2bc9982e1dc3.zip chromium_src-716775259699430736d1a461131d2bc9982e1dc3.tar.gz chromium_src-716775259699430736d1a461131d2bc9982e1dc3.tar.bz2 |
Make content use base namespace for Values.
This is in preparation for removing the "using".
BUG=
TBR=jam@chromium.org
Review URL: https://codereview.chromium.org/17025003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@206442 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/media')
-rw-r--r-- | content/browser/media/media_internals.h | 8 | ||||
-rw-r--r-- | content/browser/media/webrtc_internals.cc | 34 | ||||
-rw-r--r-- | content/browser/media/webrtc_internals_browsertest.cc | 46 | ||||
-rw-r--r-- | content/browser/media/webrtc_internals_unittest.cc | 46 |
4 files changed, 67 insertions, 67 deletions
diff --git a/content/browser/media/media_internals.h b/content/browser/media/media_internals.h index 73deaad5..4a4d2ef 100644 --- a/content/browser/media/media_internals.h +++ b/content/browser/media/media_internals.h @@ -71,7 +71,7 @@ class CONTENT_EXPORT MediaInternals { // (host, stream_id) is a unique id for the audio stream. // |host| will never be dereferenced. void UpdateAudioStream(void* host, int stream_id, - const std::string& property, Value* value); + const std::string& property, base::Value* value); // Removes |item| from |data_|. void DeleteItem(const std::string& item); @@ -79,12 +79,12 @@ class CONTENT_EXPORT MediaInternals { // Sets data_.id.property = value and notifies attached UIs using update_fn. // id may be any depth, e.g. "video.decoders.1.2.3" void UpdateItem(const std::string& update_fn, const std::string& id, - const std::string& property, Value* value); + const std::string& property, base::Value* value); // Calls javascript |function|(|value|) on each attached UI. - void SendUpdate(const std::string& function, Value* value); + void SendUpdate(const std::string& function, base::Value* value); - DictionaryValue data_; + base::DictionaryValue data_; std::vector<UpdateCallback> update_callbacks_; diff --git a/content/browser/media/webrtc_internals.cc b/content/browser/media/webrtc_internals.cc index efdba58..f8bcdc3 100644 --- a/content/browser/media/webrtc_internals.cc +++ b/content/browser/media/webrtc_internals.cc @@ -11,8 +11,6 @@ #include "content/public/browser/notification_types.h" #include "content/public/browser/render_process_host.h" -using base::DictionaryValue; -using base::ListValue; using base::ProcessId; using std::string; @@ -20,10 +18,10 @@ namespace content { namespace { // Makes sure that |dict| has a ListValue under path "log". -static ListValue* EnsureLogList(DictionaryValue* dict) { - ListValue* log = NULL; +static base::ListValue* EnsureLogList(base::DictionaryValue* dict) { + base::ListValue* log = NULL; if (!dict->GetList("log", &log)) { - log = new ListValue(); + log = new base::ListValue(); if (log) dict->Set("log", log); } @@ -55,7 +53,7 @@ void WebRTCInternals::OnAddPeerConnection(int render_process_id, const string& constraints) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - DictionaryValue* dict = new DictionaryValue(); + base::DictionaryValue* dict = new base::DictionaryValue(); if (!dict) return; @@ -74,7 +72,7 @@ void WebRTCInternals::OnAddPeerConnection(int render_process_id, void WebRTCInternals::OnRemovePeerConnection(ProcessId pid, int lid) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); for (size_t i = 0; i < peer_connection_data_.GetSize(); ++i) { - DictionaryValue* dict = NULL; + base::DictionaryValue* dict = NULL; peer_connection_data_.GetDictionary(i, &dict); int this_pid = 0; @@ -88,7 +86,7 @@ void WebRTCInternals::OnRemovePeerConnection(ProcessId pid, int lid) { peer_connection_data_.Remove(i, NULL); if (observers_.size() > 0) { - DictionaryValue id; + base::DictionaryValue id; id.SetInteger("pid", static_cast<int>(pid)); id.SetInteger("lid", lid); SendUpdate("removePeerConnection", &id); @@ -102,7 +100,7 @@ void WebRTCInternals::OnUpdatePeerConnection( DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); for (size_t i = 0; i < peer_connection_data_.GetSize(); ++i) { - DictionaryValue* record = NULL; + base::DictionaryValue* record = NULL; peer_connection_data_.GetDictionary(i, &record); int this_pid = 0, this_lid = 0; @@ -113,11 +111,11 @@ void WebRTCInternals::OnUpdatePeerConnection( continue; // Append the update to the end of the log. - ListValue* log = EnsureLogList(record); + base::ListValue* log = EnsureLogList(record); if (!log) return; - DictionaryValue* log_entry = new DictionaryValue(); + base::DictionaryValue* log_entry = new base::DictionaryValue(); if (!log_entry) return; @@ -126,7 +124,7 @@ void WebRTCInternals::OnUpdatePeerConnection( log->Append(log_entry); if (observers_.size() > 0) { - DictionaryValue update; + base::DictionaryValue update; update.SetInteger("pid", static_cast<int>(pid)); update.SetInteger("lid", lid); update.SetString("type", type); @@ -143,11 +141,11 @@ void WebRTCInternals::OnAddStats(base::ProcessId pid, int lid, if (observers_.size() == 0) return; - DictionaryValue dict; + base::DictionaryValue dict; dict.SetInteger("pid", static_cast<int>(pid)); dict.SetInteger("lid", lid); - ListValue* list = value.DeepCopy(); + base::ListValue* list = value.DeepCopy(); if (!list) return; @@ -185,7 +183,7 @@ void WebRTCInternals::StopRtpRecording() { } } -void WebRTCInternals::SendUpdate(const string& command, Value* value) { +void WebRTCInternals::SendUpdate(const string& command, base::Value* value) { DCHECK_GT(observers_.size(), (size_t)0); FOR_EACH_OBSERVER(WebRTCInternalsUIObserver, @@ -211,7 +209,7 @@ void WebRTCInternals::OnRendererExit(int render_process_id) { // Iterates from the end of the list to remove the PeerConnections created // by the exitting renderer. for (int i = peer_connection_data_.GetSize() - 1; i >= 0; --i) { - DictionaryValue* record = NULL; + base::DictionaryValue* record = NULL; peer_connection_data_.GetDictionary(i, &record); int this_rid = 0; @@ -223,7 +221,7 @@ void WebRTCInternals::OnRendererExit(int render_process_id) { record->GetInteger("lid", &lid); record->GetInteger("pid", &pid); - DictionaryValue update; + base::DictionaryValue update; update.SetInteger("lid", lid); update.SetInteger("pid", pid); SendUpdate("removePeerConnection", &update); @@ -237,7 +235,7 @@ void WebRTCInternals::OnRendererExit(int render_process_id) { // UI. void WebRTCInternals::SendRtpRecordingUpdate() { DCHECK(is_recording_rtp_); - DictionaryValue update; + base::DictionaryValue update; // TODO(justinlin): Fill in |update| with values as appropriate. SendUpdate("updateDumpStatus", &update); } diff --git a/content/browser/media/webrtc_internals_browsertest.cc b/content/browser/media/webrtc_internals_browsertest.cc index 85309cb..816b595 100644 --- a/content/browser/media/webrtc_internals_browsertest.cc +++ b/content/browser/media/webrtc_internals_browsertest.cc @@ -331,60 +331,64 @@ class WebRTCInternalsBrowserTest: public ContentBrowserTest { // Verifies |dump| contains |peer_connection_number| peer connection dumps, // each containing |update_number| updates and |stats_number| stats tables. - void VerifyPageDumpStructure(Value* dump, + void VerifyPageDumpStructure(base::Value* dump, int peer_connection_number, int update_number, int stats_number) { - EXPECT_NE((Value*)NULL, dump); - EXPECT_EQ(Value::TYPE_DICTIONARY, dump->GetType()); + EXPECT_NE((base::Value*)NULL, dump); + EXPECT_EQ(base::Value::TYPE_DICTIONARY, dump->GetType()); - DictionaryValue* dict_dump = static_cast<DictionaryValue*>(dump); + base::DictionaryValue* dict_dump = + static_cast<base::DictionaryValue*>(dump); EXPECT_EQ((size_t) peer_connection_number, dict_dump->size()); - DictionaryValue::Iterator it(*dict_dump); + base::DictionaryValue::Iterator it(*dict_dump); for (; !it.IsAtEnd(); it.Advance()) { - Value* value = NULL; + base::Value* value = NULL; dict_dump->Get(it.key(), &value); - EXPECT_EQ(Value::TYPE_DICTIONARY, value->GetType()); - DictionaryValue* pc_dump = static_cast<DictionaryValue*>(value); + EXPECT_EQ(base::Value::TYPE_DICTIONARY, value->GetType()); + base::DictionaryValue* pc_dump = + static_cast<base::DictionaryValue*>(value); EXPECT_TRUE(pc_dump->HasKey("updateLog")); EXPECT_TRUE(pc_dump->HasKey("stats")); // Verifies the number of updates. pc_dump->Get("updateLog", &value); - EXPECT_EQ(Value::TYPE_LIST, value->GetType()); - ListValue* list = static_cast<ListValue*>(value); + EXPECT_EQ(base::Value::TYPE_LIST, value->GetType()); + base::ListValue* list = static_cast<base::ListValue*>(value); EXPECT_EQ((size_t) update_number, list->GetSize()); // Verifies the number of stats tables. pc_dump->Get("stats", &value); - EXPECT_EQ(Value::TYPE_DICTIONARY, value->GetType()); - DictionaryValue* dict = static_cast<DictionaryValue*>(value); + EXPECT_EQ(base::Value::TYPE_DICTIONARY, value->GetType()); + base::DictionaryValue* dict = static_cast<base::DictionaryValue*>(value); EXPECT_EQ((size_t) stats_number, dict->size()); } } // Verifies |dump| contains the correct statsTable and statsDataSeries for // |pc|. - void VerifyStatsDump(Value* dump, + void VerifyStatsDump(base::Value* dump, const PeerConnectionEntry& pc, const string& report_type, const string& report_id, const StatsUnit& stats) { - EXPECT_NE((Value*)NULL, dump); - EXPECT_EQ(Value::TYPE_DICTIONARY, dump->GetType()); + EXPECT_NE((base::Value*)NULL, dump); + EXPECT_EQ(base::Value::TYPE_DICTIONARY, dump->GetType()); - DictionaryValue* dict_dump = static_cast<DictionaryValue*>(dump); - Value* value = NULL; + base::DictionaryValue* dict_dump = + static_cast<base::DictionaryValue*>(dump); + base::Value* value = NULL; dict_dump->Get(pc.getIdString(), &value); - DictionaryValue* pc_dump = static_cast<DictionaryValue*>(value); + base::DictionaryValue* pc_dump = static_cast<base::DictionaryValue*>(value); // Verifies there is one data series per stats name. value = NULL; pc_dump->Get("stats", &value); - EXPECT_EQ(Value::TYPE_DICTIONARY, value->GetType()); + EXPECT_EQ(base::Value::TYPE_DICTIONARY, value->GetType()); - DictionaryValue* dataSeries = static_cast<DictionaryValue*>(value); + base::DictionaryValue* dataSeries = + static_cast<base::DictionaryValue*>(value); EXPECT_EQ(stats.values.size(), dataSeries->size()); } }; @@ -681,7 +685,7 @@ IN_PROC_BROWSER_TEST_F(WebRTCInternalsBrowserTest, CreatePageDump) { "window.domAutomationController.send(" "JSON.stringify(peerConnectionDataStore));", &dump_json)); - scoped_ptr<Value> dump; + scoped_ptr<base::Value> dump; dump.reset(base::JSONReader::Read(dump_json)); VerifyPageDumpStructure(dump.get(), 2 /*peer_connection_number*/, diff --git a/content/browser/media/webrtc_internals_unittest.cc b/content/browser/media/webrtc_internals_unittest.cc index 58c7d8d..3078db9c 100644 --- a/content/browser/media/webrtc_internals_unittest.cc +++ b/content/browser/media/webrtc_internals_unittest.cc @@ -10,35 +10,33 @@ #include "content/public/test/test_browser_thread.h" #include "testing/gtest/include/gtest/gtest.h" -using base::Value; -using base::DictionaryValue; -using std::string; - namespace content { namespace { -static const string kContraints = "c"; -static const string kServers = "s"; -static const string kUrl = "u"; + +static const std::string kContraints = "c"; +static const std::string kServers = "s"; +static const std::string kUrl = "u"; class MockWebRTCInternalsProxy : public WebRTCInternalsUIObserver { public: - virtual void OnUpdate(const string& command, const Value* value) OVERRIDE { + virtual void OnUpdate(const std::string& command, + const base::Value* value) OVERRIDE { command_ = command; value_.reset(value->DeepCopy()); } - string command() { + std::string command() { return command_; } - Value* value() { + base::Value* value() { return value_.get(); } private: - string command_; - scoped_ptr<Value> value_; + std::string command_; + scoped_ptr<base::Value> value_; }; class WebRTCInternalsTest : public testing::Test { @@ -46,12 +44,12 @@ class WebRTCInternalsTest : public testing::Test { WebRTCInternalsTest() : io_thread_(BrowserThread::UI, &io_loop_) {} protected: - string ExpectedInfo(string prefix, - string id, - string suffix) { - static const string kstatic_part1 = string( + std::string ExpectedInfo(std::string prefix, + std::string id, + std::string suffix) { + static const std::string kstatic_part1 = std::string( "{\"constraints\":\"c\","); - static const string kstatic_part2 = string( + static const std::string kstatic_part2 = std::string( ",\"servers\":\"s\",\"url\":\"u\"}"); return prefix + kstatic_part1 + id + kstatic_part2 + suffix; } @@ -82,7 +80,7 @@ TEST_F(WebRTCInternalsTest, SendAddPeerConnectionUpdate) { 0, 1, 2, kUrl, kServers, kContraints); EXPECT_EQ("addPeerConnection", observer->command()); - DictionaryValue* dict = NULL; + base::DictionaryValue* dict = NULL; EXPECT_TRUE(observer->value()->GetAsDictionary(&dict)); int int_value; @@ -91,7 +89,7 @@ TEST_F(WebRTCInternalsTest, SendAddPeerConnectionUpdate) { EXPECT_TRUE(dict->GetInteger("lid", &int_value)); EXPECT_EQ(2, int_value); - string value; + std::string value; EXPECT_TRUE(dict->GetString("url", &value)); EXPECT_EQ(kUrl, value); EXPECT_TRUE(dict->GetString("servers", &value)); @@ -112,7 +110,7 @@ TEST_F(WebRTCInternalsTest, SendRemovePeerConnectionUpdate) { WebRTCInternals::GetInstance()->OnRemovePeerConnection(1, 2); EXPECT_EQ("removePeerConnection", observer->command()); - DictionaryValue* dict = NULL; + base::DictionaryValue* dict = NULL; EXPECT_TRUE(observer->value()->GetAsDictionary(&dict)); int int_value; @@ -131,14 +129,14 @@ TEST_F(WebRTCInternalsTest, SendUpdatePeerConnectionUpdate) { WebRTCInternals::GetInstance()->OnAddPeerConnection( 0, 1, 2, kUrl, kServers, kContraints); - const string update_type = "fakeType"; - const string update_value = "fakeValue"; + const std::string update_type = "fakeType"; + const std::string update_value = "fakeValue"; WebRTCInternals::GetInstance()->OnUpdatePeerConnection( 1, 2, update_type, update_value); EXPECT_EQ("updatePeerConnection", observer->command()); - DictionaryValue* dict = NULL; + base::DictionaryValue* dict = NULL; EXPECT_TRUE(observer->value()->GetAsDictionary(&dict)); int int_value; @@ -147,7 +145,7 @@ TEST_F(WebRTCInternalsTest, SendUpdatePeerConnectionUpdate) { EXPECT_TRUE(dict->GetInteger("lid", &int_value)); EXPECT_EQ(2, int_value); - string value; + std::string value; EXPECT_TRUE(dict->GetString("type", &value)); EXPECT_EQ(update_type, value); EXPECT_TRUE(dict->GetString("value", &value)); |