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

Side by Side Diff: chrome/browser/extensions/app_notify_channel_setup_unittest.cc

Issue 8727024: Save the oauth client id used in App Notification setup (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed nits Created 9 years 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/bind.h" 5 #include "base/bind.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/memory/weak_ptr.h" 8 #include "base/memory/weak_ptr.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "chrome/browser/extensions/app_notify_channel_setup.h" 10 #include "chrome/browser/extensions/app_notify_channel_setup.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 64
65 class TestDelegate : public AppNotifyChannelSetup::Delegate, 65 class TestDelegate : public AppNotifyChannelSetup::Delegate,
66 public base::SupportsWeakPtr<TestDelegate> { 66 public base::SupportsWeakPtr<TestDelegate> {
67 public: 67 public:
68 TestDelegate() : was_called_(false) {} 68 TestDelegate() : was_called_(false) {}
69 virtual ~TestDelegate() {} 69 virtual ~TestDelegate() {}
70 70
71 virtual void AppNotifyChannelSetupComplete( 71 virtual void AppNotifyChannelSetupComplete(
72 const std::string& channel_id, 72 const std::string& channel_id,
73 const std::string& error, 73 const std::string& error,
74 int route_id, 74 const AppNotifyChannelSetup* setup) OVERRIDE {
75 int callback_id) OVERRIDE {
76 EXPECT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::UI)); 75 EXPECT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::UI));
77 EXPECT_FALSE(was_called_); 76 EXPECT_FALSE(was_called_);
78 was_called_ = true; 77 was_called_ = true;
79 error_ = error; 78 error_ = error;
80 route_id_ = route_id; 79 route_id_ = setup->return_route_id();
81 callback_id_ = callback_id; 80 callback_id_ = setup->callback_id();
82 MessageLoop::current()->Quit(); 81 MessageLoop::current()->Quit();
83 } 82 }
84 83
85 // Called to check that we were called with the expected arguments. 84 // Called to check that we were called with the expected arguments.
86 void ExpectWasCalled(const std::string& expected_channel_id, 85 void ExpectWasCalled(const std::string& expected_channel_id,
87 const std::string& expected_error) { 86 const std::string& expected_error) {
88 EXPECT_TRUE(was_called_); 87 EXPECT_TRUE(was_called_);
89 EXPECT_EQ(expected_error, error_); 88 EXPECT_EQ(expected_error, error_);
90 EXPECT_EQ(kRouteId, route_id_); 89 EXPECT_EQ(kRouteId, route_id_);
91 EXPECT_EQ(kCallbackId, callback_id_); 90 EXPECT_EQ(kCallbackId, callback_id_);
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 265
267 TEST_F(AppNotifyChannelSetupTest, ServerSuccess) { 266 TEST_F(AppNotifyChannelSetupTest, ServerSuccess) {
268 SetupLogin(true); 267 SetupLogin(true);
269 SetupFetchTokens(true, false); 268 SetupFetchTokens(true, false);
270 SetupRecordGrant(true); 269 SetupRecordGrant(true);
271 SetupGetChannelId(true); 270 SetupGetChannelId(true);
272 271
273 scoped_refptr<AppNotifyChannelSetup> setup = CreateInstance(); 272 scoped_refptr<AppNotifyChannelSetup> setup = CreateInstance();
274 RunServerTest(setup, "dummy_do_not_use", ""); 273 RunServerTest(setup, "dummy_do_not_use", "");
275 } 274 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/app_notify_channel_setup.cc ('k') | chrome/browser/extensions/extension_prefs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698