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

Side by Side Diff: chrome/browser/ui/views/extensions/browser_action_drag_data_unittest.cc

Issue 7346024: Get rid of the ProfileId. It was added for ceee. I reverted the original change, since it led to ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "base/pickle.h" 5 #include "base/pickle.h"
6 #include "chrome/browser/ui/views/extensions/browser_action_drag_data.h" 6 #include "chrome/browser/ui/views/extensions/browser_action_drag_data.h"
7 #include "chrome/test/testing_profile.h" 7 #include "chrome/test/testing_profile.h"
8 #include "googleurl/src/gurl.h" 8 #include "googleurl/src/gurl.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "ui/base/dragdrop/os_exchange_data.h" 10 #include "ui/base/dragdrop/os_exchange_data.h"
(...skipping 17 matching lines...) Expand all
28 ui::OSExchangeData data; 28 ui::OSExchangeData data;
29 data.SetURL(GURL("http://www.google.com"), L"Title"); 29 data.SetURL(GURL("http://www.google.com"), L"Title");
30 30
31 // We only support our format, so this should not succeed. 31 // We only support our format, so this should not succeed.
32 BrowserActionDragData drag_data; 32 BrowserActionDragData drag_data;
33 EXPECT_FALSE(drag_data.Read(ui::OSExchangeData(CloneProvider(data)))); 33 EXPECT_FALSE(drag_data.Read(ui::OSExchangeData(CloneProvider(data))));
34 } 34 }
35 35
36 TEST_F(BrowserActionDragDataTest, BrowserActionDragDataFormat) { 36 TEST_F(BrowserActionDragDataTest, BrowserActionDragDataFormat) {
37 TestingProfile profile; 37 TestingProfile profile;
38 Profile* profile_ptr = &profile;
38 profile.SetID(L"id"); 39 profile.SetID(L"id");
39 40
40 const std::string extension_id = "42"; 41 const std::string extension_id = "42";
41 const ProfileId profile_id = profile.GetRuntimeId();
42 Pickle pickle; 42 Pickle pickle;
43 pickle.WriteBytes(&profile_id, sizeof(profile_id)); 43 pickle.WriteBytes(&profile_ptr, sizeof(&profile));
44 pickle.WriteString(extension_id); 44 pickle.WriteString(extension_id);
45 pickle.WriteInt(42); 45 pickle.WriteInt(42);
46 46
47 ui::OSExchangeData data; 47 ui::OSExchangeData data;
48 data.SetPickledData(BrowserActionDragData::GetBrowserActionCustomFormat(), 48 data.SetPickledData(BrowserActionDragData::GetBrowserActionCustomFormat(),
49 pickle); 49 pickle);
50 50
51 BrowserActionDragData drag_data; 51 BrowserActionDragData drag_data;
52 EXPECT_TRUE(drag_data.Read(ui::OSExchangeData(CloneProvider(data)))); 52 EXPECT_TRUE(drag_data.Read(ui::OSExchangeData(CloneProvider(data))));
53 ASSERT_TRUE(drag_data.IsFromProfile(profile.GetOriginalProfile())); 53 ASSERT_TRUE(drag_data.IsFromProfile(profile.GetOriginalProfile()));
54 ASSERT_STREQ(extension_id.c_str(), drag_data.id().c_str()); 54 ASSERT_STREQ(extension_id.c_str(), drag_data.id().c_str());
55 ASSERT_EQ(42, drag_data.index()); 55 ASSERT_EQ(42, drag_data.index());
56 } 56 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/extensions/browser_action_drag_data.cc ('k') | chrome/test/testing_profile.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698