Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Unified Diff: chrome/browser/ui/tabs/tab_strip_model_unittest.cc

Issue 10831407: Kill PropertyBag, switch WebContents to SupportsUserData. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase only Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/tabs/tab_strip_model_unittest.cc
diff --git a/chrome/browser/ui/tabs/tab_strip_model_unittest.cc b/chrome/browser/ui/tabs/tab_strip_model_unittest.cc
index 0c38f9fef633e3023c0cb2a5f3be603cdd7e326e..8c311898932195e06db9a00d1d2be444d0251a1e 100644
--- a/chrome/browser/ui/tabs/tab_strip_model_unittest.cc
+++ b/chrome/browser/ui/tabs/tab_strip_model_unittest.cc
@@ -11,7 +11,6 @@
#include "base/file_util.h"
#include "base/memory/scoped_ptr.h"
#include "base/path_service.h"
-#include "base/property_bag.h"
#include "base/stl_util.h"
#include "base/string_number_conversions.h"
#include "base/string_split.h"
@@ -117,6 +116,22 @@ class TabStripDummyDelegate : public TestTabStripModelDelegate {
DISALLOW_COPY_AND_ASSIGN(TabStripDummyDelegate);
};
+namespace {
+
+const char kTabStripModelTestIDUserDataKey[] = "TabStripModelTestIDUserData";
+
+class TabStripModelTestIDUserData : public base::SupportsUserData::Data {
+ public:
+ explicit TabStripModelTestIDUserData(int id) : id_(id) {}
+ virtual ~TabStripModelTestIDUserData() {}
+ int id() { return id_; }
+
+ private:
+ int id_;
+};
+
+} // namespace
+
class TabStripModelTest : public ChromeRenderViewHostTestHarness {
public:
TabStripModelTest() : browser_thread_(BrowserThread::UI, &message_loop_) {
@@ -157,12 +172,17 @@ class TabStripModelTest : public ChromeRenderViewHostTestHarness {
// Sets the id of the specified contents.
void SetID(WebContents* contents, int id) {
- GetIDAccessor()->SetProperty(contents->GetPropertyBag(), id);
+ contents->SetUserData(&kTabStripModelTestIDUserDataKey,
+ new TabStripModelTestIDUserData(id));
}
// Returns the id of the specified contents.
int GetID(WebContents* contents) {
- return *GetIDAccessor()->GetProperty(contents->GetPropertyBag());
+ TabStripModelTestIDUserData* user_data =
+ static_cast<TabStripModelTestIDUserData*>(
+ contents->GetUserData(&kTabStripModelTestIDUserDataKey));
+
+ return user_data ? user_data->id() : -1;
}
// Returns the state of the given tab strip as a string. The state consists
@@ -226,11 +246,6 @@ class TabStripModelTest : public ChromeRenderViewHostTestHarness {
}
private:
- base::PropertyAccessor<int>* GetIDAccessor() {
- static base::PropertyAccessor<int> accessor;
- return &accessor;
- }
-
content::TestBrowserThread browser_thread_;
std::wstring test_dir_;
« no previous file with comments | « chrome/browser/ui/tab_contents/tab_contents.cc ('k') | chrome/browser/ui/views/omnibox/omnibox_view_views.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698