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

Side by Side Diff: trunk/src/mojo/services/view_manager/view_manager_connection_unittest.cc

Issue 269973002: Revert 268218 "Add support for mapping node tree on the client." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 7 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
« no previous file with comments | « trunk/src/mojo/services/view_manager/ids.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <string> 5 #include <string>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
11 #include "base/run_loop.h" 11 #include "base/run_loop.h"
12 #include "base/strings/stringprintf.h" 12 #include "base/strings/stringprintf.h"
13 #include "mojo/public/cpp/bindings/allocation_scope.h" 13 #include "mojo/public/cpp/bindings/allocation_scope.h"
14 #include "mojo/public/cpp/environment/environment.h" 14 #include "mojo/public/cpp/environment/environment.h"
15 #include "mojo/services/public/cpp/view_manager/util.h"
16 #include "mojo/services/public/cpp/view_manager/view_manager_types.h" 15 #include "mojo/services/public/cpp/view_manager/view_manager_types.h"
17 #include "mojo/services/public/interfaces/view_manager/view_manager.mojom.h" 16 #include "mojo/services/public/interfaces/view_manager/view_manager.mojom.h"
18 #include "mojo/shell/shell_test_helper.h" 17 #include "mojo/shell/shell_test_helper.h"
19 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
20 19
21 namespace mojo { 20 namespace mojo {
22 namespace services { 21 namespace services {
23 namespace view_manager { 22 namespace view_manager {
24 23
25 namespace { 24 namespace {
26 25
27 base::RunLoop* current_run_loop = NULL; 26 base::RunLoop* current_run_loop = NULL;
28 27
28 uint16_t FirstIdFromTransportId(uint32_t id) {
29 return static_cast<uint16_t>((id >> 16) & 0xFFFF);
30 }
31
32 uint16_t SecondIdFromTransportId(uint32_t id) {
33 return static_cast<uint16_t>(id & 0xFFFF);
34 }
35
29 // Sets |current_run_loop| and runs it. It is expected that someone else quits 36 // Sets |current_run_loop| and runs it. It is expected that someone else quits
30 // the loop. 37 // the loop.
31 void DoRunLoop() { 38 void DoRunLoop() {
32 base::RunLoop run_loop; 39 base::RunLoop run_loop;
33 current_run_loop = &run_loop; 40 current_run_loop = &run_loop;
34 current_run_loop->Run(); 41 current_run_loop->Run();
35 current_run_loop = NULL; 42 current_run_loop = NULL;
36 } 43 }
37 44
38 // Converts |id| into a string. 45 // Converts |id| into a string.
39 std::string NodeIdToString(TransportNodeId id) { 46 std::string NodeIdToString(TransportNodeId id) {
40 return (id == 0) ? "null" : 47 return (id == 0) ? "null" :
41 base::StringPrintf("%d,%d", HiWord(id), LoWord(id)); 48 base::StringPrintf("%d,%d", FirstIdFromTransportId(id),
49 SecondIdFromTransportId(id));
42 } 50 }
43 51
44 // Boolean callback. Sets |result_cache| to the value of |result| and quits 52 // Boolean callback. Sets |result_cache| to the value of |result| and quits
45 // the run loop. 53 // the run loop.
46 void BooleanCallback(bool* result_cache, bool result) { 54 void BooleanCallback(bool* result_cache, bool result) {
47 *result_cache = result; 55 *result_cache = result;
48 current_run_loop->Quit(); 56 current_run_loop->Quit();
49 } 57 }
50 58
51 struct TestNode { 59 struct TestNode {
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 GetNodeTree(view_manager2_.get(), CreateNodeId(1, 1), &nodes); 629 GetNodeTree(view_manager2_.get(), CreateNodeId(1, 1), &nodes);
622 ASSERT_EQ(2u, nodes.size()); 630 ASSERT_EQ(2u, nodes.size());
623 EXPECT_EQ("node=1,1 parent=0,1 view=null", nodes[0].ToString()); 631 EXPECT_EQ("node=1,1 parent=0,1 view=null", nodes[0].ToString());
624 EXPECT_EQ("node=1,11 parent=1,1 view=1,51", nodes[1].ToString()); 632 EXPECT_EQ("node=1,11 parent=1,1 view=1,51", nodes[1].ToString());
625 } 633 }
626 } 634 }
627 635
628 } // namespace view_manager 636 } // namespace view_manager
629 } // namespace services 637 } // namespace services
630 } // namespace mojo 638 } // namespace mojo
OLDNEW
« no previous file with comments | « trunk/src/mojo/services/view_manager/ids.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698