Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Move TestMetalContext/Surface to testing namespace #56602

Merged
merged 1 commit into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions testing/assertions.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,13 @@

#include <type_traits>

namespace flutter {
namespace testing {
namespace flutter::testing {

inline bool NumberNear(double a, double b) {
static const double epsilon = 1e-3;
return (a > (b - epsilon)) && (a < (b + epsilon));
}

} // namespace testing
} // namespace flutter
} // namespace flutter::testing

#endif // FLUTTER_TESTING_ASSERTIONS_H_
6 changes: 2 additions & 4 deletions testing/canvas_test.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
#include "gtest/gtest.h"
#include "third_party/skia/include/core/SkColorSpace.h"

namespace flutter {
namespace testing {
namespace flutter::testing {

// This fixture allows creating tests that make use of a mock |SkCanvas|.
template <typename BaseT>
Expand All @@ -27,7 +26,6 @@ class CanvasTestBase : public BaseT {
};
using CanvasTest = CanvasTestBase<::testing::Test>;

} // namespace testing
} // namespace flutter
} // namespace flutter::testing

#endif // FLUTTER_TESTING_CANVAS_TEST_H_
7 changes: 3 additions & 4 deletions testing/dart_isolate_runner.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

#include "flutter/runtime/isolate_configuration.h"

namespace flutter {
namespace testing {
namespace flutter::testing {

AutoIsolateShutdown::AutoIsolateShutdown(std::shared_ptr<DartIsolate> isolate,
fml::RefPtr<fml::TaskRunner> runner)
: isolate_(std::move(isolate)), runner_(std::move(runner)) {}
Expand Down Expand Up @@ -173,5 +173,4 @@ std::unique_ptr<AutoIsolateShutdown> RunDartCodeInIsolate(
return result;
}

} // namespace testing
} // namespace flutter
} // namespace flutter::testing
6 changes: 2 additions & 4 deletions testing/dart_isolate_runner.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
#include "flutter/runtime/dart_vm.h"
#include "flutter/runtime/dart_vm_lifecycle.h"

namespace flutter {
namespace testing {
namespace flutter::testing {

class AutoIsolateShutdown {
public:
Expand Down Expand Up @@ -66,7 +65,6 @@ std::unique_ptr<AutoIsolateShutdown> RunDartCodeInIsolate(
fml::WeakPtr<IOManager> io_manager = {},
std::unique_ptr<PlatformConfiguration> platform_configuration = nullptr);

} // namespace testing
} // namespace flutter
} // namespace flutter::testing

#endif // FLUTTER_TESTING_DART_ISOLATE_RUNNER_H_
8 changes: 3 additions & 5 deletions testing/debugger_detection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
#include <windows.h>
#endif // FML_OS_WIN

namespace flutter {
namespace testing {
namespace flutter::testing {

DebuggerStatus GetDebuggerStatus() {
#if FML_OS_MACOSX
Expand Down Expand Up @@ -61,7 +60,6 @@ DebuggerStatus GetDebuggerStatus() {
#else
return DebuggerStatus::kDontKnow;
#endif
} // namespace testing
}

} // namespace testing
} // namespace flutter
} // namespace flutter::testing
6 changes: 2 additions & 4 deletions testing/debugger_detection.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@

#include "flutter/fml/macros.h"

namespace flutter {
namespace testing {
namespace flutter::testing {

enum class DebuggerStatus {
kDontKnow,
Expand All @@ -17,7 +16,6 @@ enum class DebuggerStatus {

DebuggerStatus GetDebuggerStatus();

} // namespace testing
} // namespace flutter
} // namespace flutter::testing

#endif // FLUTTER_TESTING_DEBUGGER_DETECTION_H_
12 changes: 4 additions & 8 deletions testing/display_list_testing.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
#include "flutter/display_list/display_list.h"
#include "flutter/display_list/effects/dl_image_filter.h"

namespace flutter {
namespace testing {
namespace flutter::testing {

// clang-format off
bool DisplayListsEQ_Verbose(const DisplayList* a, const DisplayList* b) {
Expand All @@ -37,8 +36,7 @@ bool DisplayListsNE_Verbose(const DisplayList* a, const DisplayList* b) {
return true;
}

} // namespace testing
} // namespace flutter
} // namespace flutter::testing

namespace std {

Expand Down Expand Up @@ -389,8 +387,7 @@ std::ostream& operator<<(std::ostream& os, const DlImage* image) {

} // namespace std

namespace flutter {
namespace testing {
namespace flutter::testing {

std::ostream& DisplayListStreamDispatcher::startl() {
for (int i = 0; i < cur_indent_; i++) {
Expand Down Expand Up @@ -978,5 +975,4 @@ void DisplayListStreamDispatcher::drawShadow(const DlPath& path,
}
// clang-format on

} // namespace testing
} // namespace flutter
} // namespace flutter::testing
12 changes: 4 additions & 8 deletions testing/display_list_testing.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
#include "flutter/display_list/display_list.h"
#include "flutter/display_list/dl_op_receiver.h"

namespace flutter {
namespace testing {
namespace flutter::testing {

[[nodiscard]] bool DisplayListsEQ_Verbose(const DisplayList* a,
const DisplayList* b);
Expand All @@ -37,8 +36,7 @@ namespace testing {
return DisplayListsNE_Verbose(a.get(), b.get());
}

} // namespace testing
} // namespace flutter
} // namespace flutter::testing

namespace std {

Expand Down Expand Up @@ -84,8 +82,7 @@ extern std::ostream& operator<<(std::ostream& os, const flutter::DlPath& path);

} // namespace std

namespace flutter {
namespace testing {
namespace flutter::testing {

class DisplayListStreamDispatcher final : public DlOpReceiver {
public:
Expand Down Expand Up @@ -609,7 +606,6 @@ class DisplayListGeneralReceiver : public DlOpReceiver {
uint32_t op_count_ = 0u;
};

} // namespace testing
} // namespace flutter
} // namespace flutter::testing

#endif // FLUTTER_TESTING_DISPLAY_LIST_TESTING_H_
6 changes: 2 additions & 4 deletions testing/elf_loader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
#include "flutter/runtime/dart_vm.h"
#include "flutter/testing/testing.h"

namespace flutter {
namespace testing {
namespace flutter::testing {

ELFAOTSymbols LoadELFSymbolFromFixturesIfNeccessary(std::string elf_filename) {
if (!DartVM::IsRunningPrecompiledCode()) {
Expand Down Expand Up @@ -135,5 +134,4 @@ bool PrepareSettingsForAOTWithSymbols(Settings& settings,
return true;
}

} // namespace testing
} // namespace flutter
} // namespace flutter::testing
6 changes: 2 additions & 4 deletions testing/elf_loader.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
#include "flutter/fml/macros.h"
#include "third_party/dart/runtime/bin/elf_loader.h"

namespace flutter {
namespace testing {
namespace flutter::testing {

inline constexpr const char* kDefaultAOTAppELFFileName = "app_elf_snapshot.so";

Expand Down Expand Up @@ -81,7 +80,6 @@ ELFAOTSymbols LoadELFSplitSymbolFromFixturesIfNeccessary(
bool PrepareSettingsForAOTWithSymbols(Settings& settings,
const ELFAOTSymbols& symbols);

} // namespace testing
} // namespace flutter
} // namespace flutter::testing

#endif // FLUTTER_TESTING_ELF_LOADER_H_
6 changes: 2 additions & 4 deletions testing/fixture_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@

#include "flutter/testing/dart_fixture.h"

namespace flutter {
namespace testing {
namespace flutter::testing {

FixtureTest::FixtureTest() : DartFixture() {}

Expand All @@ -20,5 +19,4 @@ FixtureTest::FixtureTest(std::string kernel_filename,
std::move(elf_filename),
std::move(elf_split_filename)) {}

} // namespace testing
} // namespace flutter
} // namespace flutter::testing
6 changes: 2 additions & 4 deletions testing/fixture_test.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@

#include "flutter/testing/dart_fixture.h"

namespace flutter {
namespace testing {
namespace flutter::testing {

class FixtureTest : public DartFixture, public ThreadTest {
public:
Expand All @@ -24,7 +23,6 @@ class FixtureTest : public DartFixture, public ThreadTest {
FML_DISALLOW_COPY_AND_ASSIGN(FixtureTest);
};

} // namespace testing
} // namespace flutter
} // namespace flutter::testing

#endif // FLUTTER_TESTING_FIXTURE_TEST_H_
6 changes: 2 additions & 4 deletions testing/post_task_sync.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@

#include "flutter/fml/synchronization/waitable_event.h"

namespace flutter {
namespace testing {
namespace flutter::testing {

void PostTaskSync(const fml::RefPtr<fml::TaskRunner>& task_runner,
const std::function<void()>& function) {
Expand All @@ -19,5 +18,4 @@ void PostTaskSync(const fml::RefPtr<fml::TaskRunner>& task_runner,
latch.Wait();
}

} // namespace testing
} // namespace flutter
} // namespace flutter::testing
6 changes: 2 additions & 4 deletions testing/post_task_sync.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,11 @@

#include "flutter/fml/task_runner.h"

namespace flutter {
namespace testing {
namespace flutter::testing {

void PostTaskSync(const fml::RefPtr<fml::TaskRunner>& task_runner,
const std::function<void()>& function);

} // namespace testing
} // namespace flutter
} // namespace flutter::testing

#endif // FLUTTER_TESTING_POST_TASK_SYNC_H_
6 changes: 2 additions & 4 deletions testing/stream_capture.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@

#include "flutter/testing/stream_capture.h"

namespace flutter {
namespace testing {
namespace flutter::testing {

StreamCapture::StreamCapture(std::ostream* ostream)
: ostream_(ostream), old_buffer_(ostream_->rdbuf()) {
Expand All @@ -27,5 +26,4 @@ std::string StreamCapture::GetOutput() const {
return buffer_.str();
}

} // namespace testing
} // namespace flutter
} // namespace flutter::testing
6 changes: 2 additions & 4 deletions testing/stream_capture.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
#include <sstream>
#include <string>

namespace flutter {
namespace testing {
namespace flutter::testing {

// Temporarily replaces the specified stream's output buffer to capture output.
//
Expand Down Expand Up @@ -41,7 +40,6 @@ class StreamCapture {
std::streambuf* old_buffer_;
};

} // namespace testing
} // namespace flutter
} // namespace flutter::testing

#endif // FLUTTER_TESTING_STREAM_CAPTURE_H_
6 changes: 2 additions & 4 deletions testing/test_args.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@

#include "flutter/testing/test_args.h"

namespace flutter {
namespace testing {
namespace flutter::testing {

static fml::CommandLine gProcessArgs;

Expand All @@ -17,5 +16,4 @@ void SetArgsForProcess(int argc, char** argv) {
gProcessArgs = fml::CommandLineFromArgcArgv(argc, argv);
}

} // namespace testing
} // namespace flutter
} // namespace flutter::testing
6 changes: 2 additions & 4 deletions testing/test_args.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,12 @@

#include "flutter/fml/command_line.h"

namespace flutter {
namespace testing {
namespace flutter::testing {

const fml::CommandLine& GetArgsForProcess();

void SetArgsForProcess(int argc, char** argv);

} // namespace testing
} // namespace flutter
} // namespace flutter::testing

#endif // FLUTTER_TESTING_TEST_ARGS_H_
6 changes: 2 additions & 4 deletions testing/test_dart_native_resolver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
#include "third_party/tonic/logging/dart_error.h"
#include "tonic/converter/dart_converter.h"

namespace flutter {
namespace testing {
namespace flutter::testing {

TestDartNativeResolver::TestDartNativeResolver() = default;

Expand Down Expand Up @@ -124,5 +123,4 @@ void TestDartNativeResolver::SetNativeResolverForIsolate() {
}
}

} // namespace testing
} // namespace flutter
} // namespace flutter::testing
6 changes: 2 additions & 4 deletions testing/test_dart_native_resolver.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
return entrypoint; \
})()

namespace flutter {
namespace testing {
namespace flutter::testing {

using NativeEntry = std::function<void(Dart_NativeArguments)>;

Expand Down Expand Up @@ -56,7 +55,6 @@ class TestDartNativeResolver
FML_DISALLOW_COPY_AND_ASSIGN(TestDartNativeResolver);
};

} // namespace testing
} // namespace flutter
} // namespace flutter::testing

#endif // FLUTTER_TESTING_TEST_DART_NATIVE_RESOLVER_H_
Loading