| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/extensions/extension_gcm_app_handler.h" | 5 #include "chrome/browser/extensions/extension_gcm_app_handler.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 content::BrowserThread::PostTask( | 91 content::BrowserThread::PostTask( |
| 92 content::BrowserThread::IO, | 92 content::BrowserThread::IO, |
| 93 FROM_HERE, | 93 FROM_HERE, |
| 94 base::Bind(&Waiter::OnIOLoopPump, base::Unretained(this))); | 94 base::Bind(&Waiter::OnIOLoopPump, base::Unretained(this))); |
| 95 | 95 |
| 96 WaitUntilCompleted(); | 96 WaitUntilCompleted(); |
| 97 } | 97 } |
| 98 | 98 |
| 99 private: | 99 private: |
| 100 void PumpIOLoopCompleted() { | 100 void PumpIOLoopCompleted() { |
| 101 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 101 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 102 | 102 |
| 103 SignalCompleted(); | 103 SignalCompleted(); |
| 104 } | 104 } |
| 105 | 105 |
| 106 void OnIOLoopPump() { | 106 void OnIOLoopPump() { |
| 107 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); | 107 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
| 108 | 108 |
| 109 content::BrowserThread::PostTask( | 109 content::BrowserThread::PostTask( |
| 110 content::BrowserThread::IO, | 110 content::BrowserThread::IO, |
| 111 FROM_HERE, | 111 FROM_HERE, |
| 112 base::Bind(&Waiter::OnIOLoopPumpCompleted, base::Unretained(this))); | 112 base::Bind(&Waiter::OnIOLoopPumpCompleted, base::Unretained(this))); |
| 113 } | 113 } |
| 114 | 114 |
| 115 void OnIOLoopPumpCompleted() { | 115 void OnIOLoopPumpCompleted() { |
| 116 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); | 116 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
| 117 | 117 |
| 118 content::BrowserThread::PostTask( | 118 content::BrowserThread::PostTask( |
| 119 content::BrowserThread::UI, | 119 content::BrowserThread::UI, |
| 120 FROM_HERE, | 120 FROM_HERE, |
| 121 base::Bind(&Waiter::PumpIOLoopCompleted, base::Unretained(this))); | 121 base::Bind(&Waiter::PumpIOLoopCompleted, base::Unretained(this))); |
| 122 } | 122 } |
| 123 | 123 |
| 124 scoped_ptr<base::RunLoop> run_loop_; | 124 scoped_ptr<base::RunLoop> run_loop_; |
| 125 | 125 |
| 126 DISALLOW_COPY_AND_ASSIGN(Waiter); | 126 DISALLOW_COPY_AND_ASSIGN(Waiter); |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 | 450 |
| 451 // App handler is removed when the extension is updated to the version that | 451 // App handler is removed when the extension is updated to the version that |
| 452 // has GCM permission removed. | 452 // has GCM permission removed. |
| 453 UpdateExtension(extension.get(), "good2.crx"); | 453 UpdateExtension(extension.get(), "good2.crx"); |
| 454 waiter()->PumpUILoop(); | 454 waiter()->PumpUILoop(); |
| 455 EXPECT_TRUE(gcm_app_handler()->app_handler_count_drop_to_zero()); | 455 EXPECT_TRUE(gcm_app_handler()->app_handler_count_drop_to_zero()); |
| 456 EXPECT_FALSE(HasAppHandlers(extension->id())); | 456 EXPECT_FALSE(HasAppHandlers(extension->id())); |
| 457 } | 457 } |
| 458 | 458 |
| 459 } // namespace extensions | 459 } // namespace extensions |
| OLD | NEW |